python-pcap模块解析mac地址
作者:vpoet
mail:vpoet_sir@163.com
import pcap
import binascii a = pcap.pcap()
a.setfilter('arp') for i,j in a:
if binascii.hexlify(j[21])=="":
print 'Mac Reply!'
for index in range(len(j)):
if index>=22 and index<=27:
print binascii.hexlify(j[index])+":"
print "Over"
break
运行结果: