我正在尝试对网络扫描仪进行编码,并且一旦我尝试打印响应,它就不会显示任何内容。
import scapy.all as scapy
def scan(ip):
packet1 = scapy.ARP(pdst=ip)
etherpacket = scapy.Ether(dst = 'ff:ff:ff:ff:ff:ff')
broadcast_packet = etherpacket/packet1
ans, unans = scapy.srp(broadcast_packet, timeout=10)
print(ans.summary())
scan("192.168.1.1-254")
下面是结果。
$sudo python3 networkscanner.py
Begin emission:
........Finished sending 1 packets.
..........
Received 18 packets, got 0 answers, remaining 1 packets
None
使用scapy的内置arping
进行ARP扫描:
from scapy.all import arping
arping("192.168.1.0/24")
然后进入您的外壳:
$ python3 arping.py
Begin emission:
*****************Finished sending 256 packets.
Received 17 packets, got 17 answers, remaining 239 packets
00:1b:78:20:ee:40 192.168.1.48
a4:77:33:88:92:62 192.168.1.66
6c:33:a9:42:6a:18 192.168.1.67
...
存档文档为here。