Skip to content

Commit

Permalink
Resolves fribbels#50. Force sniff all interfaces
Browse files Browse the repository at this point in the history
  • Loading branch information
jmferreirab committed Dec 27, 2022
1 parent 741ea1d commit f85ec6c
Showing 1 changed file with 12 additions and 14 deletions.
26 changes: 12 additions & 14 deletions data/py/scanner.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def try_buffer(currAck):
print(hexStr);
print('&');

def check_packet(packet, index):
def check_packet(packet):
if IP in packet:
if Raw in packet and packet[Raw].load:
currAck = packet.ack
Expand All @@ -53,25 +53,23 @@ def check_packet(packet, index):
# if 'F' in packet[TCP].flags:
# try_buffer(currAck)

def thread_sniff(i, index):
def terminate():
os._exit(0)

def thread_sniff():
try:
sniff(iface=i, prn=lambda x: check_packet(x, index), filter="tcp and ( port 3333 )", session=TCPSession)
# EpicSeven traffic was confirmed to travel over tcp port 3333 via Wireshark
# Omitting sniff() iface parameter to force all interfaces to be sniffed.
# This may lead to more processing but prevents needing to specify an network interface manually in some cases.
sniff(prn=lambda x: check_packet(x), filter="tcp and ( port 3333 )", session=TCPSession)
except:
pass

index = 0
for i in list(conf.ifaces.data.values()):
try:
x = threading.Thread(target=thread_sniff, args=(i, index,))
x.daemon = True;
x.start()

index = index + 1
except:
pass
x = threading.Thread(target=thread_sniff)
x.daemon = True;
x.start()

def terminate():
os._exit(0)

t = threading.Timer(3600.0, terminate)
t.start()
Expand Down

0 comments on commit f85ec6c

Please sign in to comment.