Reputation: 840
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.
Upvotes: 0
Views: 2610
Reputation: 2223
The problem is: prn=sniffer_callback(target_site)
. You call sniffer_callback
with one argument, which is wrong.
It should probably be: prn=sniffer_callback
. Because it is a callback function, sniffer_callback
should be called from somewhere inside function sniff
. Therefor you give the function itself as an argument, not a value that it has computed.
Upvotes: 1