scapy - 为什么 Scapy ICMP 无法得到答案但“ping”工作正常
问题描述
从 10.18.90.139 到 10.18.90.254,通过 python 使用普通的 icmp 协议和 scapy 没有答案;但是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
解决方案
尝试使用这样的东西:
sr1(IP(dst="10.18.90.254") / ICMP())
推荐阅读
- php - CodeIgniter 4 结构和路线
- sql - 希望这些是两个单独的列,都来自不同的表。我正在使用 concat 来组合原始变量
- google-cloud-firestore - Firestore 集合组安全规则,验证父文档值
- html - 同一 Css Grid 区域中的图像和文本
- ios - 迅速。将持久数据从一个视图控制器传递到另一个视图控制器并存储在标签数组中
- flutter - Flutter 移动设备图像屏幕变大
- plugins - 大堂系统不工作?我的世界插件
- javascript - 评估 JavaScript 中的 if 语句
- reactjs - 出乎意料的'!在 'worker-loader!mapbox-gl/dist/mapbox-gl-csp-worker'
- github - 克隆 github 存储库时如何解决错误