[英]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,而是發送到一個范圍(使用子掩碼)。
您可能使用了錯誤的子網。 私有子網 ( RFC 1918 ) 是
您可能打算這樣做,這是一個私有 IP 地址
scan("192.168.11.117")
而不是這個
scan("192.169.11.117")
這是一個公共 IP 地址。 您也可能擁有此公共子網,在這種情況下,這無關緊要。
遠程主機可能沒有響應,因為它在該地址不存在。 確保仔細檢查您在 arping 中使用的arping
的目標是否在線且可訪問。
您可以在命令行上使用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'ds 的答案。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.