这个代码是一个arp扫描器,它扫描网络上除电话以外的所有主机。
程序只打印计算机的ip和mac地址,而不打印电话
没人知道为什么会这样吗?谢谢
import scapy.all as scapy
class scan:
def Arp(self, ip):
self.ip = ip
print(ip)
arp_r = scapy.ARP(pdst=ip)
br = scapy.Ether(dst='ff:ff:ff:ff:ff:ff')
request = br/arp_r
answered, unanswered = scapy.srp(request, timeout=1)
print('\tIP\t\t\t\t\tMAC')
print('_' * 37)
for i in answered:
ip, mac = i[1].psrc, i[1].hwsrc
print(ip, '\t\t' + mac)
print('-' * 37)
arp = scan() # create an instance of the class
arp.Arp('192.168.0.1/24') # call the method发布于 2020-01-04 22:49:20
看看https://stackoverflow.com/a/57017630/5459467有些手机根本不能响应ARP ping,主要是iPhones。
这不一定在任何地方都有解释,并且可能有多种解释,例如:-安全问题-电池管理
他们也会倾向于忽略不必要的ARP。实际上,您可以执行的唯一操作是在路由器执行实际的ARP请求时以比路由器更快的速度响应,或者只是被动地嗅探所有ARP请求。
发布于 2020-12-14 17:25:27
您需要添加设备正在使用的接口。
answered, unanswered = srp(Ether(dst = "FF:FF:FF:FF:FF:FF") / ARP(pdst = ip), timeout = 1, iface = 'wlp1s0', inter = 0.1)https://stackoverflow.com/questions/59589190
复制相似问题