python - Scapy windows - sniff() - 'log_runtime' 未定义

标签 python windows python-2.7 scapy

我按照支持的程序安装了 python 2.7 和 scapy:pywin32、WinPcap、Pypcap 和 libdnet。我觉得说我的操作系统是 Windows 7 很重要。

当我使用函数 sniff 时,它似乎引发错误:http://prntscr.com/dbd79a .我已经尝试了另一个 scapy 的函数和类作为 IP 和 sendp,它工作正常,问题只在于嗅探。

我已经从许多安装链接中尝试了多个版本的 scapy,但没有任何变化。

最佳答案

您的问题是 2.3.3 版 scapy(16 年 10 月 18 日上传)中的错误。 它可能会在下一个版本中修复,同时您可以通过以下方式安装以前的版本

pip install scapy==2.3.2

我检查了提交,这个错误不在那个版本中。但是我还没有测试它,所以它可能包含其他错误(因为 2.3.3 一定已经改变了一些更好的东西,至少我希望如此),所以如果你出于某种原因必须使用 2.3.3,你可以像这样修补它:

from scapy.arch.windows import compatibility
from scapy.all import log_runtime, MTU, ETH_P_ALL, PcapTimeoutElapsed, plist

compatibility.log_runtime = log_runtime
compatibility.MTU = MTU
compatibility.PcapTimeoutElapsed = PcapTimeoutElapsed
compatibility.ETH_P_ALL = ETH_P_ALL
compatibility.plist = plist

compatibility.sniff(1) # call the sniff function however you like

关于python - Scapy windows - sniff() - 'log_runtime' 未定义,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40793615/

相关文章:

python - Django 表单 : "Select a valid choice. That choice is not one of the available choices."

python - Google 应用引擎后端

python - Python 中有哪些线程安全的数据持久化对象用于数据持久化?

python - 继承和修改 __init__() 方法

windows - 为什么 “ifconfig” docker 命令在 Windows 上响应 "bash: ifconfig: command not found"?

windows - 将 Windows 批处理文件变量设置为星期几

Python:使用selenium清除搜索框中的现有字符串

c++ - 为什么返回 Windows BOOL 数据类型而不是 int?

python - 如何通过 "Duck Typing"区分元组和简单字符串?

python - Numpy - 用向量行创建矩阵