python通过scapy获取局域网所有主机mac地址示例
python通过scapy获取局域网所有主机mac地址
代码如下:
#!/usr/bin/env python # -*- coding: utf-8 -*- from scapy.all import srp,Ether,ARP,conf ipscan='192.168.1.1/24' try: ans,unans = srp(Ether(dst="FF:FF:FF:FF:FF:FF")/ARP(pdst=ipscan),timeout=2,verbose=False) except Exception,e: print str(e) else: for snd,rcv in ans: list_mac=rcv.sprintf("%Ether.src% - %ARP.psrc%") print list_mac
相关推荐
Jungzhang 2020-02-24
efeve 2018-08-08
listep 2019-03-08
Runningfree 2017-07-08
python0 2014-10-23
PythonBiglove 2019-02-02
Python探路者 2018-11-20
cassiePython 2018-11-20