Reputation: 621
Ok so I am making a program that is supposed to capture packets, the program used to work just fine, but now for some reason it just stopped working.
This is not my actual code, however it is having the same problem as my actual code:
from scapy.all import *
counter = 0
def action(packet):
global counter
counter += 1
return 'Packet #{}: {} ==> {}'.format(counter, packet[0][1].src, packet[0][1].dst)
sniff(filter="ip", prn=action)
Once again, this used to work just fine, but now it doesnt. It captures a packet very rarely, and when it does capture packets it looks like this:
It seems like it is capturing from the wrong source or something, but I ain't a computer genius so I am probably wrong. Thank you if you are able to answer this!
Upvotes: 0
Views: 679
Reputation: 6237
You probably want to specify an interface: sniff([...], iface=<iface>)
. By default, sniff()
will only capture packets from the default interface (see conf.iface
value).
Under Windows, the IFACES
variable contains all the interfaces usable by Scapy.
Upvotes: 1