Python Arping代码不工作
我有下面的代码,它给出了本地网络的MAC和IP地址。但是,代码并不一致,因为有时连接的设备会出现,几秒钟后,它们就会从结果中消失 我不明白为什么 代码如下:Python Arping代码不工作,python,scapy,arp,Python,Scapy,Arp,我有下面的代码,它给出了本地网络的MAC和IP地址。但是,代码并不一致,因为有时连接的设备会出现,几秒钟后,它们就会从结果中消失 我不明白为什么 代码如下: import logging logging.getLogger("scapy.runtime").setLevel(logging.ERROR) from scapy.all import arping import time def sniffer(): res = arping("192.168.2.*") mac
import logging
logging.getLogger("scapy.runtime").setLevel(logging.ERROR)
from scapy.all import arping
import time
def sniffer():
res = arping("192.168.2.*")
mac = '91:b7:66:cd:d6:7n'
print check_MAC(res, mac)
def check_MAC(res, mac):
for r in res[0]:
if r[1].src == mac:
return "MAC found!"
return "MAC not found..."
while (True):
sniffer()
time.sleep(30)
print""
我仍然无法理解为什么每次扫描都不能给出相同的结果。有人能分享一个提示吗?我仍然不明白为什么每次扫描都不能给出相同的结果。有人能分享小费吗??