pcap 中缺少元素吗?
当我检查模块 pcap 可用的属性时,我希望看到类似的内容
[ ...剪掉...
'dltvalue', 'findalldevs', 'lookupdev', 'lookupnet', 'ntoa', 'pcapObject', 'pcapObjectPtr']
有关 pcapObject 的注释。但是,运行 dir(pcap) 时我得到的只是
[...剪断...'版权', 'doc'、'文件'、'许可证'、 '名称'、'网址'、'版本'、 'bpf'、'dltoff'、'ex_name'、 'lookupdev','pcap','sys']
注意到缺少 pcapObject。这是为什么呢?什么可能导致这种情况?
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',
'name', 'url', 'version',
'bpf', 'dltoff', 'ex_name',
'lookupdev', 'pcap', 'sys']
Noting the lack of pcapObject. Why is this? What could cause this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您需要 pylibpcap,但您安装的是 pypcap,一个不同的 Python libpcap 绑定,具有不兼容的 API。
野外使用了三种 Python libpcap 绑定: pypcap (由 scapy 推荐用于在 Windows 上使用)、pylibcap 和 pcapy。请参阅 scapy/pcapdnet.py 了解它们的 API 差异。由于他们的名字相似,人们一定经常把他们混淆......
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 ...
您也可以尝试
sudo apt-get install libpcap-dev
You could also try
sudo apt-get install libpcap-dev