我尝试通过scapy使用sendp发送255个differnet arp数据包,并且所有这些数据包都在几秒钟内发送完毕,但是当我尝试发送ICMP数据包时,要花费很多时间才能发送每个数据包。请告诉我如何发送与ARP数据包一样快的ICMP数据包? 谢谢
for ip in get_all_ip():
pkt1 = Ether(dst = "ff:ff:ff:ff:ff:ff", type = 2054)/ARP(pdst = ip)
pkt2 = Ether()/IP(dst = ip)/ICMP()
packets_ip.append(pkt2)
packets_p.append(pkt1)
sendp(packets_p) # Takes seconds
send(packets_ip) # Takes a lot of time
答案 0 :(得分:0)
I don't know what you are trying to do, but you are using send()
with Ethernet packets. send()
is used to send "layer 3" packets (e.g., IP()
or IPv6()
).