scapy.srp() 未响应预期结果
scapy.srp() doesn't responds with expected result
我正在尝试对网络扫描仪进行编码,而且当我尝试打印响应时,它没有显示任何内容。
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")
然后在你的 shell:
$ 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
...
Arping 文档是 here。
调用函数的时候改,应该是/24,不是上面写的。
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/24")
我正在尝试对网络扫描仪进行编码,而且当我尝试打印响应时,它没有显示任何内容。
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")
然后在你的 shell:
$ 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
...
Arping 文档是 here。
调用函数的时候改,应该是/24,不是上面写的。
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/24")