为什么Scapy ICMP无法获得答案但“ ping”可以正常工作

时间:2018-08-16 08:48:28

标签: scapy icmp

从10.18.90.139到10.18.90.254,使用通过scapy的普通icmp协议通过python无法得到答案;但ping收到回复,可能是原因

试图通过Scapy ping IP

>>> ip = "10.18.90.254"
>>> from scapy.all import sr1, IP, ICMP
>>> sr1(IP(ip/ICMP()))
Begin emission:
.......Finished sending 1 packets.
..........................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................^C
Received 1073 packets, got 0 answers, remaining 1 packets

检查没有代理

[root@ run]# env | grep -i pro
[root@ run]# env | grep -i ht

但是ping可以正常工作

PING 10.18.90.254 (10.18.90.254) 56(84) bytes of data.
64 bytes from 10.18.90.254: icmp_seq=1 ttl=64 time=0.315 ms
64 bytes from 10.18.90.254: icmp_seq=2 ttl=64 time=0.264 ms
^C
--- 10.18.90.254 ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1462ms
rtt min/avg/max/mdev = 0.264/0.289/0.315/0.030 ms

Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
192.168.1.0     0.0.0.0         255.255.255.0   U     0      0        0 eth3
10.18.90.0      0.0.0.0         255.255.255.0   U     0      0        0 eth4
10.9.67.0       0.0.0.0         255.255.255.0   U     0      0        0 eth5
169.254.0.0     0.0.0.0         255.255.0.0     U     1002   0        0 eth5
169.254.0.0     0.0.0.0         255.255.0.0     U     1003   0        0 eth4
135.0.0.0       10.9.67.1       255.0.0.0       UG    0      0        0 eth5
0.0.0.0         10.18.90.254    0.0.0.0         UG    0      0        0 eth4

1 个答案:

答案 0 :(得分:0)

尝试使用类似这样的内容:

sr1(IP(dst="10.18.90.254") / ICMP())