Python获取局域网中IP及对应的MAC地址

2015-07-31 0 568
Python获取局域网中IP及对应的MAC地址
#!/usr/bin/env python2.7
# -*- coding: utf-8 -*-
  

from scapy.all import srp, Ether, ARP, conf

lan = '10.10.10.0/24'

ans, unans = srp(Ether(dst="FF:FF:FF:FF:FF:FF")/ARP(pdst=lan), timeout=2)
for snd, rcv in ans:
	cur_mac = rcv.sprintf("%Ether.src%")
	cur_ip  = rcv.sprintf("%ARP.psrc%")
	print cur_mac + ' - ' +cur_ip

遇见资源网 python Python获取局域网中IP及对应的MAC地址 http://www.ox520.com/15655.html

常见问题

相关文章

发表评论
暂无评论
官方客服团队

为您解决烦忧 - 24小时在线 专业服务