-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtester.py
31 lines (26 loc) · 903 Bytes
/
tester.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
import requests
import threading
import time
# Target URL
url = "http://127.0.0.1:8000" # Change to your Django app URL
# Number of requests
num_requests = 10000 # Change to the desired number of requests
threads = 300 # Number of concurrent threads
def send_request():
while True:
try:
response = requests.get(url)
print(f"Request sent, response code: {response.status_code}")
except Exception as e:
print(f"Error: {e}")
def start_attack():
for _ in range(threads):
t = threading.Thread(target=send_request)
t.daemon = True # Daemonize thread
t.start()
if __name__ == "__main__":
print(f"Starting DDoS simulation on {url}...")
start_attack()
# Run the attack for a specified time
time.sleep(10) # Change the duration as needed
print("Simulation finished.")