Home > other >  Use scapy send icmp message gateway to detect survival, no response
Use scapy send icmp message gateway to detect survival, no response

Time:09-20



Caught analysis is also did not respond, but is attached to my wift, open my home routers, ping, is this??????
what happened?


My code is as follows, the gateway is the default gateway 192.168.0.1, no trouble,
The from scapy. All import *
DstHost="192.168.0.1"
Def the alive (DstHost) :
Pkts_ping=[IP (DST=DstHost)/ICMP ()/" hello "]
Pkts_ping=pkts_ping * 4
Pkt_ans=sr1 (pkts_ping, timeout=1, Intel=0.01) between # 0.01
If pkt_ans is not None:
Print (" echo request criterion: the host has been open ")
Pkt_ans. The show ()
Return 1
The else:
Print (" not open "echo request discriminant: host)
Return 0
The alive (DstHost)
Pause (system)
  • Related