Scapy ARP功能运行时未提供正确的输出

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

我有一个简单的脚本:

import scapy.all as scapy

def scan(ip):
    arg = scapy.ARP(pdst=ip)
    print(arg.summary())
scan("192.168.11.0/24")

但是当我运行此脚本时,我得到的输出是:

ARP who has ?? says ??

通常,摘要将为我提供2个问号所在的2个IP地址,但由于某种原因,情况并非如此。我也做了网络扫描仪,昨天工作正常,并把网络上的所有IP和MAC地址都还给了我,但今天我似乎无法通过范围(例如:“ 192.168.11.0/24”)我得到的唯一输出是:

IP          MAC Address
----------------------------------------------------
192.168.11.1        08:02:8e:a1:6a:d0

即使网络中有更多设备。船尾有什么问题吗?如果是这样,我应该如何删除并重新安装它,因为我已经完成了pip install scapy和pip install scapy的工作,但仍然无法正常工作。

python python-3.x networking scapy arp
1个回答
0
投票

您实际上没有对脚本执行任何操作。您的功能包括arg = scapy.ARP(pdst=ip),它将创建ARP数据包。要发送,请使用sr or sr1。也有ARP示例单线覆盖ARP pings。在这里应用,

from scapy.all import *

def arp_scan(ips):
    resp = arping(ips)
    print(resp)
arp_scan("192.168.11.0/24")

我们将获得类似于以下的输出

Begin emission:
*Finished sending 256 packets.

Received 1 packets, got 1 answers, remaining 255 packets
  9c:5c:12:ca:7b:6f 192.168.11.1
© www.soinside.com 2019 - 2024. All rights reserved.