Python与Scapy send函数有关的问题

2024-09-30 08:37:39 发布

您现在位置:Python中文网/ 问答频道 /正文

如何使这些函数中的2个与loop=1一起工作?出于某种原因,如果loop=to 1,它除了发送之外什么也不做,所以我的计时器停止倒计时,它也不会做时间。睡眠(3) 每次它发送loop=1时,如何使这些函数工作

import time
import threading
from scapy.all import *

try:
    ip = raw_input("IP Address: ")

    timeout = time.time() + 1 * 12

    def sendicmp():
        try:
            while True:
                if time.time() > timeout:
                    break
                packet = IP(dst=ip)/ICMP()
                send(fragment(packet), loop=1, verbose=0)
                time.sleep(3)
        except:
            pass

    for i in range(1):
        thread = threading.Thread(target=sendicmp)
        thread.start()
except:
    pass

Tags: to函数importiplooptimepackettimeout

热门问题