Search code examples
pythonpcappacket-capturepacket-snifferswinpcap

Python Packet Sniffer


What Python module should I be using to sniff packets? 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.

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. Also, the python-libpcap sourceforge page seems to be unavailable, so I can't try that.


Solution

  • 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.

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

    Hope this helps