When I run the script, scapy
does not listen on the interface, it just print out this error:
Traceback (most recent call last): File "keylogger.py", line 91, in sniff_packets(scapy_expression, target_site) File "keylogger.py", line 15, in sniff_packets sniff(filter=scapy_expression, prn=sniffer_callback(target_site), store=0, iface="eth0") TypeError: sniffer_callback() takes exactly 2 arguments (1 given)
The code where the error occurs is the following (the expression that sniff)
def sniff_packets(scapy_expression, target_site):
sniff(filter=scapy_expression, prn=sniffer_callback(target_site), store=0, iface="eth0")
This is the callback function:
def sniffer_callback(packet, target_site):
print "[*] Got a packet"
I am not sure why scapy
doesn't listen to the wire. Any help is appreciated.
sniffer_callback(target_site)
? I'm weary of any answer that seems so simple, but it looks like changingprn=sniffer_callback(target_site)
toprn=sniffer_callback
would actually work – Jason Sperskesniffer_callback(target_site)
(which isn't working because you have definedsniffer_callback()
to take 2 arguments instead of one), but the correct way to use this is to pass the function – Jason Sperskesniffer_callback(target_site)
returned a function then I would see how this could work, but assniffer_callback()
is defined it is going to returnNone
(the default of any def where a return isn't present) – Jason Sperske