简单的 scapy 脚本不发送数据包
Simple scapy script not sending packet
我有最简单的 scapy 脚本,但它不起作用。请帮助:
import scapy.all as scapy
def scan(ip):
scapy.arping(ip)
scan("192.169.11.117")
当它运行时我得到这个:
Begin emission:
Finished sending 1 packets.
Received 0 packets, got 0 answers, remaining 1 packets
我怎样才能解决这个问题并真正得到答案?
那不是你使用它的方式。
看看文档:
https://scapy.readthedocs.io/en/latest/usage.html#arp-ping
arping("192.169.11.*")
你应该看看什么是ARP扫描。您不只是将数据包发送到单个 IP,而是发送到一个范围(使用子掩码)。
问题 #1
您可能使用了错误的子网。私有子网 (RFC 1918) 是
- 10.0.0.0/8
- 172.16.0.0/12
- 192.168.0.0/16
您可能打算这样做,这是一个私有 IP 地址
scan("192.168.11.117")
而不是这个
scan("192.169.11.117")
这是一个 public IP 地址。也有可能您拥有此 public 子网,在这种情况下这无关紧要。
问题 #2
远程主机可能没有响应,因为它不存在于该地址。确保仔细检查您在 arping
中使用其 IP 的目标是否在线且可访问。
您可以在命令行中使用 arp -a
检查 *nix 和 windows 上的 arp 映射
$ arp -a
? (192.168.1.111) at 0:1b:78:20:ee:40 on en0 ifscope [ethernet]
? (192.168.1.112) at a4:77:33:88:92:62 on en0 ifscope [ethernet]
? (192.168.1.117) at 6c:33:a9:42:6a:18 on en0 ifscope [ethernet]
...
对于目标 IP 以确保 scapy arping
应该 解析。
如果您正在尝试进行 ARP 扫描,那么您应该查看 Cukic0 的回答。
我有最简单的 scapy 脚本,但它不起作用。请帮助:
import scapy.all as scapy
def scan(ip):
scapy.arping(ip)
scan("192.169.11.117")
当它运行时我得到这个:
Begin emission:
Finished sending 1 packets.
Received 0 packets, got 0 answers, remaining 1 packets
我怎样才能解决这个问题并真正得到答案?
那不是你使用它的方式。
看看文档: https://scapy.readthedocs.io/en/latest/usage.html#arp-ping
arping("192.169.11.*")
你应该看看什么是ARP扫描。您不只是将数据包发送到单个 IP,而是发送到一个范围(使用子掩码)。
问题 #1
您可能使用了错误的子网。私有子网 (RFC 1918) 是
- 10.0.0.0/8
- 172.16.0.0/12
- 192.168.0.0/16
您可能打算这样做,这是一个私有 IP 地址
scan("192.168.11.117")
而不是这个
scan("192.169.11.117")
这是一个 public IP 地址。也有可能您拥有此 public 子网,在这种情况下这无关紧要。
问题 #2
远程主机可能没有响应,因为它不存在于该地址。确保仔细检查您在 arping
中使用其 IP 的目标是否在线且可访问。
您可以在命令行中使用 arp -a
检查 *nix 和 windows 上的 arp 映射
$ arp -a
? (192.168.1.111) at 0:1b:78:20:ee:40 on en0 ifscope [ethernet]
? (192.168.1.112) at a4:77:33:88:92:62 on en0 ifscope [ethernet]
? (192.168.1.117) at 6c:33:a9:42:6a:18 on en0 ifscope [ethernet]
...
对于目标 IP 以确保 scapy arping
应该 解析。
如果您正在尝试进行 ARP 扫描,那么您应该查看 Cukic0 的回答。