gpt4 book ai didi

python - scapy 发送数据包直到 ctrl+c 不工作

转载 作者:行者123 更新时间:2023-11-28 18:32:07 28 4
gpt4 key购买 nike

首先我尝试运行这个:

from scapy.all import *
while True:
send([ARP(op=ARP.who_has, psrc="192.168.1.60")])

我发送了 9 个数据包然后停止。我希望它一直运行到我按下 ctrl+c。我有一个 ip 列表 ["192.168.1.7","192.168.1.12","192.168.1.32","192.168.1.223"]我试过运行:

from scapy.all import *
while True:
for ip in mylist:
send([ARP(op=ARP.who_has, psrc="192.168.1.60")])

它仍然发送 9 个数据包并停止。我想知道在按下 ctrl+C 之前如何发送数据包。

最佳答案

你可以使用:

 send(ARP(op=1,psrc='172.16.16.255'),loop=1)

它应该一直运行,直到您按下 Ctrl+C。

好的。我对其进行了编辑以遍历您的列表:

mylist = ('192.168.1.12','192.168.1.32','192.168.1.223')
while True:
for i in mylist:
send(ARP(op=1,psrc='192.168.1.60',pdst=i))

关于python - scapy 发送数据包直到 ctrl+c 不工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35974341/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com