def procpkt(pkt):
now = time()
output = '{seconds}\t{ip}\t{hwaddr}\t{vendor}'
if 'ARP' in pkt:
hosts[pkt[ARP].psrc] = {}
hosts[pkt[ARP].psrc]['hwaddr'] = pkt[ARP].hwsrc
hosts[pkt[ARP].psrc]['vendor'] = mac2vendor.get_comment(pkt[ARP].hwsrc)
hosts[pkt[ARP].psrc]['time'] = time()
click.clear()
for ip in sorted(hosts):
print(output.format(
seconds = int(now - hosts[ip]['time']),
ip = ip,
hwaddr = hosts[ip]['hwaddr'],
vendor = hosts[ip]['vendor']
))
评论列表
文章目录