In blocking mode, I can do this:
from scapy.all import * sniff(filter"tcp and port 80", count=10, prn = labmda x:x.summary())
I want to be able to sniff packets with scapy in a non-blocking way, something like this:
def packet_recevied_event(p): print "Packet received event!" print p.summary()
To summarize: my question is pretty clear, I want to be able to continue executing the code without the sniff function blocking it. One option is to open a separate thread for this, but I would like to avoid it and use scapy native tools, if possible.
Environmental Information:
python: 2.7
scapy: 2.1.0
os: ubuntu 12.04 64bit
Michael
source share