3

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.

gwenger
  • 1,211
  • 3
  • 12
  • 11

2 Answers2

0

py-pcap from dirtbags.net doesn't depend on a pcap lib so it might work for you. Though, I'm not sure how fast it is or if it works on windows.

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

tMC
  • 18,105
  • 14
  • 62
  • 98
0

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

nonot1
  • 2,788
  • 4
  • 25
  • 41
  • I'm reading through the page you linked to, but could you give me a bit more of a shove in the correct direction? I have never done anything with networking before and I also haven't used ctypes, so this is all new to me. – gwenger Jul 06 '11 at 18:25
  • 1
    That would be a pretty low level way to access the pcap functionality. Really for wrtting python wrapper around the pcap software. Just try to follow the tutorials at http://www.winpcap.org/. They will assume C, but you are going to use python. (w/ the ctypes translation layer.) – nonot1 Jul 06 '11 at 18:33