简体   繁体   English

Python 数据包嗅探器

[英]Python Packet Sniffer

What Python module should I be using to sniff packets?我应该使用什么 Python 模块来嗅探数据包? I don't need anything too complex, I just need to get the data out of some packets being sent to my computer.我不需要任何太复杂的东西,我只需要从一些发送到我的计算机的数据包中获取数据。 I am using Python 2.6 and Windows 7, and I have installed WinPcap 4.1.2.我正在使用 Python 2.6 和 Windows 7,并且我已经安装了 WinPcap 4.1.2。

So far I've seen people suggest pcapy and pypcap, but when I try to install those, they both fail and tell me I am missing msvcr71.dll even though it is on my computer.到目前为止,我已经看到人们建议使用 pcapy 和 pypcap,但是当我尝试安装它们时,它们都失败了并告诉我我缺少 msvcr71.dll,即使它在我的计算机上也是如此。 Also, the python-libpcap sourceforge page seems to be unavailable, so I can't try that.另外,python-libpcap sourceforge 页面似乎不可用,所以我不能尝试。

py-pcap from dirtbags.net doesn't depend on a pcap lib so it might work for you.来自dirtbags.net 的 py-pcap 不依赖于 pcap 库,因此它可能对您有用。 Though, I'm not sure how fast it is or if it works on windows.不过,我不确定它有多快,或者它是否适用于 windows。

http://dirtbags.net/py-pcap.html http://dirtbags.net/py-pcap.html

Obviously you want to use a ready-made wrapper, but keep in mind that you can always use Ctypes to directly access the capture functions.显然您想使用现成的包装器,但请记住,您始终可以使用 Ctypes 直接访问捕获函数。

See: http://www.python.org/doc/current/library/ctypes.html参见: http://www.python.org/doc/current/library/ctypes.html

Hope this helps希望这可以帮助

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM