Scapy ARP 函数在运行时没有给出正确的输出 [英] Scapy ARP function not giving proper output when running it

查看:64
本文介绍了Scapy ARP 函数在运行时没有给出正确的输出的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个简单的脚本:

import scapy.all as scapy

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

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

But when I run this script the output I get is:

ARP who has ?? says ??

通常情况下,摘要会给我 2 个 IP 地址,其中 2 个问号所在,但由于某种原因,情况并非如此.我还做了一个网络扫描仪,昨天工作正常,并将网络上的所有 ip 和 mac 地址返回给我,但今天我似乎无法传递一个范围(例如:192.168.11.0/24")当我做我得到的唯一输出是:

Normally the summary would give me 2 IP address's where the 2 question marks are but for some reason that is not the case. Also I have made a network scanner and It was working fine yesterday and returned to me all ip and mac address on the network but today I can't seem to pass in a range(ex:"192.168.11.0/24")when I do the only output I get is:

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

即使网络中有更多设备.scapy 有什么问题吗?如果是这样,我应该如何删除并重新安装它,因为我已经完成了 pip uninstall scapy 和 pip install scapy 并且没有任何效果.

Even though there are more devices in the network. Is there something wrong with scapy? If so how should I delete and reinstall it because I have already done pip uninstall scapy and pip install scapy and nothing works still.

推荐答案

您实际上并未对脚本执行任何操作.您的函数包括 arg = scapy.ARP(pdst=ip),它创建一个 ARP 数据包.要发送它,请使用 sr 或 sr1.还有 ARP 示例 one-liners 涵盖了 ARP pings.应用在这里,

You're not actually doing anything with your script. Your function includes arg = scapy.ARP(pdst=ip), which creates an ARP packet. To send it, use sr or sr1. There are also ARP example one-liners that cover ARP pings. Applied here,

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

这篇关于Scapy ARP 函数在运行时没有给出正确的输出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆