Python ARP扫描器

问题描述 投票:0回答:1

此代码是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
python python-3.x networking network-programming scapy
1个回答
0
投票

看看https://stackoverflow.com/a/57017630/5459467有些电话根本无法回答ARP ping,大部分是iPhone。

并不一定在任何地方都有解释,它可能有多种解释,例如:- 安全问题-电池管理

他们还将倾向于忽略免费的ARP。实际上,您唯一可以做的就是在路由器执行实际的ARP请求时,比路由器更快地应答,或者只是被动地嗅探所有ARP请求。

© www.soinside.com 2019 - 2024. All rights reserved.