I’m trying to use this Python libpcap library:
https://pypi.org/project/python-libpcap/
I have installed using:
sudo apt-get install libpcap-dev
pip3 install python-libpcap
but when I run the capture example code in script using sudo python3:
from pylibpcap.pcap import sniff
for plen, t, buf in sniff("my_interface", count=-1, promisc=1, out_file="pcap.pcap"):
print("[+]: Payload len=", plen)
print("[+]: Time", t)
print("[+]: Payload", buf)
I get this error:
from pylibpcap.pcap import sniff
ModuleNotFoundError: No module named 'pylibpcap'
How can I fix this/what’s wrong?
I’m on Ubuntu 22.04.