MoinMoin Logo
  • Comments
  • Immutable Page
  • Menu
    • Navigation
    • RecentChanges
    • FindPage
    • Local Site Map
    • Help
    • HelpContents
    • HelpOnMoinWikiSyntax
    • Display
    • Attachments
    • Info
    • Raw Text
    • Print View
    • Edit
    • Load
    • Save
  • Login

Navigation

  • Start
  • Sitemap
Revision 3 as of 2013-11-13 17:06:33
  • Python
  • pcapy

pcapy

Pcapy is a Python extension module that interfaces with the libpcap packet capture library.

Windows install 32 bit

Pcapy requires python 2.5.

Python 32 bit: http://www.python.org/ftp/python/2.5.4/python-2.5.4.msi

pcapy: http://corelabs.coresecurity.com/index.php?module=Wiki&action=attachment&type=tool&page=Pcapy&file=pcapy-0.10.8.win32-py2.5.exe

winpcap: http://www.winpcap.org/install/bin/WinPcap_4_1_3.exe

Install python to C:\Python25\.

Show packets in hex in windows

   1 import pcapy
   2 
   3 devs=pcapy.findalldevs()
   4 
   5 for d in devs:
   6     r = pcapy.open_live(d,8192,0,0)
   7     if r.getnet()=="192.168.1.0":
   8         print "Dev:%s Network:%s Subnet:%s %d"%(d, r.getnet() , r.getmask(),r.datalink() )
   9         count=0 
  10 
  11         while count<7:
  12             (header,data)=r.next()
  13             ipPacket=data[14:]
  14             datax='>>'
  15             for c in ipPacket:
  16                 datax='%s%02X '%(datax,ord(c)) 
  17             print datax 
  18             count=count+1 
  • MoinMoin Powered
  • Python Powered
  • GPL licensed
  • Valid HTML 4.01