Size: 479
Comment:
|
Size: 1046
Comment:
|
Deletions are marked like this. | Additions are marked like this. |
Line 8: | Line 8: |
Line 9: | Line 10: |
Line 12: | Line 14: |
== Show packets in hex in windows == {{{#!highlight python import pcapy devs=pcapy.findalldevs() for d in devs: r = pcapy.open_live(d,8192,0,0) if r.getnet()=="192.168.1.0": print "Dev:%s Network:%s Subnet:%s %d"%(d, r.getnet() , r.getmask(),r.datalink() ) count=0 while count<7: (header,data)=r.next() ipPacket=data[14:] datax='>>' for c in ipPacket: datax='%s%02X '%(datax,ord(c)) print datax count=count+1 }}} |
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
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