python-pcap模块解析mac地址
作者:vpoet
mail:vpoet_sir@163.com
1 import pcap 2 import binascii 3 4 5 a = pcap.pcap() 6 a.setfilter('arp') 7 8 for i,j in a: 9 if binascii.hexlify(j[21])=="02": 10 print 'Mac Reply!' 11 for index in range(len(j)): 12 if index>=22 and index<=27: 13 print binascii.hexlify(j[index])+":" 14 print "Over" 15 break 16
运行结果: