ARP code
Nattapong Limprungpattanakit
nattapong__ at hotmail.com
Tue Sep 29 16:01:14 EDT 2009
Hello.
I have a problem can not run.
I'm not understand.
Help me please.
How to use and detail ?
Thanks.
#!/usr/bin/python2.5
import py_net_libs
class dissect:
def __init__(self,pkt,offset):
self.pkt, self.offset = py_net_libs.arp_dissect(pkt,offset)
self.next = None
def format(self):
mac_s, mac_d, ip_src, ip_dst = '','','',''
for n in (self.pkt[5]): mac_s = mac_s + '%02x:' % n
for n in (self.pkt[7]): mac_d = mac_d + '%02x:' % n
for n in (self.pkt[6]): ip_src = ip_src + '%d.' % n
for n in (self.pkt[8]): ip_dst = ip_dst + '%d.' % n
return [ 'HW Type = 0x%02x' % self.pkt[0],
'Protocol Type = 0x%x' % self.pkt[1],
'HW Address Lenght = %d' % self.pkt[2],
'Procol Address Length = %d' % self.pkt[3],
'OP code = %x' % self.pkt[4],
'Sender HW Addr = %s' % mac_s [:-1],
'Sender IP Addr = %s' % ip_src[:-1],
'Target HW Addr = %s' % mac_d [:-1],
'Target IP Addr = %s' % ip_dst[:-1] ]
_________________________________________________________________
áÊ´§àÊé¹·Ò§! à¾ÔèÁá¼¹·ÕèáÅзÔÈ·Ò§ä»ÊÙè§Ò¹»ÒÃìµÕé¢Í§¤Ø³
http://www.microsoft.com/windows/windowslive/products/events.aspx
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20090930/8cc9e860/attachment.html>
More information about the Python-list
mailing list