Im new to python and I'm testing the library pyshark.
I want to sniff the traffic all the time and do other things. But when I start the sniffer, all other code stop working. I've tried asyincio thread and multithreading, but it always give me different errors.
This the code that I want to run without blocking the application.
import pyshark
import asyncio
class Sniffer:
@staticmethod
@asyncio.coroutine
def sniff():
cap = pyshark.LiveCapture(interface='en0')
cap.sniff_continuously(packet_count=0)
for pkt in cap:
print(pkt)
Thanks in advice.