When I check the attributes available to the module pcap, I expect to see something like
[ ...snip...
'dltvalue', 'findalldevs', 'lookupdev', 'lookupnet', 'ntoa', 'pcapObject', 'pcapObjectPtr']
With note on pcapObject. However, all I get when running dir(pcap)
is
[ ... snip... 'copyright', 'doc', 'file', 'license', '开发者_JS百科name', 'url', 'version', 'bpf', 'dltoff', 'ex_name', 'lookupdev', 'pcap', 'sys']
Noting the lack of pcapObject. Why is this? What could cause this?
You want pylibpcap but what you have installed is pypcap, a different Python libpcap binding with an incompatible API.
There are three Python libpcap bindings used in the wild: pypcap (recommended by scapy for use on Windowas), pylibcap and pcapy. See scapy/pcapdnet.py for a taste of their API differences. With their similar names people must have them mixed up pretty regularly ...
You could also try
sudo apt-get install libpcap-dev
精彩评论