CentOS 7下安裝Slowhttptest DDoS檢測工具


Slowhttptest是依賴HTTP協議的慢速攻擊DoS攻擊工具,設計的基本原理是服務器在請求完全接收后才會進行處理,如果客戶端的發送速度緩慢或者發送不完整,服務端為其保留連接資源池占用,大量此類請求並發將導致DoS。安裝Slowhttptest需要依賴以下組件,可按照以下步驟來進行(如果組件已經安裝,可以跳過):

一、安裝libssl-dev

# yum install openssl openssl-devel

  

二、安裝C++編譯器

# yum install gcc-c++

如果未安裝C++編譯器,在linux下執行 ./configure 時,會報如下錯誤:

checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking for g++... no
checking for c++... no
checking for gpp... no
checking for aCC... no
checking for CC... no
checking for cxx... no
checking for cc++... no
checking for cl... no
checking for FCC... no
checking for KCC... no
checking for RCC... no
checking for xlC_r... no
checking for xlC... no
checking for C++ compiler default output file name... configure: error: C++ compiler cannot create executables
See `config.log' for more details.

  

三、安裝m4、autoconf、perl和automake

方法一:通過yum直接安裝(本例中automake是通過下載包進行安裝,原因為通過yum中的版本1.13較低,而安裝slowhttptest需要automake-1.16版本)

# yum install m4
# yum install autoconf
# yum install perl
# yum install automake 

執行上述命令會分別通過yum安裝m4-1.4.18,autoconf-2.69,perl-5.16.3,automake-1.13。
注意:需要按照順序進行安裝,因為automake依賴於m4,autoconf和perl,autoconf依賴於m4。

 

方法二:通過直接下載包文件進行安裝(m4、autoconf和automake是GNU中的開源軟件,本例中automake安裝在/usr/local/下)

//安裝路徑
# cd /usr/local/

//安m4-1.4.18
# wget http://ftp.gnu.org/gnu/m4/m4-1.4.18.tar.gz
# tar -zxvf m4-1.4.18.tar.gz
# cd m4-1.4.18/
# ./configure
# make
# make install
# cd ..

//安裝autoconf-2.69
# wget http://ftp.gnu.org/gnu/autoconf/autoconf-2.69.tar.gz
# tar -zxvf autoconf-2.69.tar.gz
# cd autoconf-2.69/
# ./configure
# make
# make install
# cd ..

//安裝automake-1.16.1
# wget http://ftp.gnu.org/gnu/automake/automake-1.16.1.tar.gz
# tar -xvf automake-1.16.1.tar.gz
# cd automake-1.16.1/
# ./configure --prefix=/usr/  //本例實際過程中添加了--prefix=/usr/
# make
# make install

 

直接下載包文件進行安裝時遇到的一些問題和解決方法:

問題1:執行./configure時提示“沒有權限”。

解決方法:可以用以下命令解決。

# chmod -R 777 ./

  

問題2:安裝automake-1.16在make失敗,提示–no-discard-stderr。

解決方法:修改automake-1.16文件夾下Makefile源代碼第3694行,在其后增加–no-discard-stderr:

#3694行  automake-$(APIVERSION) --no-discard-stderr

  

問題3:安裝automake-1.16后,后續對slowhttptest執行make操作時仍然提示missing automake-1.16 –foreign
解決方法:建議安裝automake-1.16.1

 

四、安裝Slowhttptest
Slowhttptest的代碼托管在https://github.com/shekyan/slowhttptest,需要下載解壓后從源碼編譯安裝。

# cd /usr/local/slowhttptest
# ./configure --prefix=/usr/  //本例實際過程中添加了--prefix=/usr/
# sudo autoreconf -ivf  //這句很關鍵,就是這一句解決了問題
# make
# make install

如果在make的時候提示“missing automake-1.16”或“aclocal-1.16: 未找到命令”,是因為缺少缺少automake組件造成的。aclocal是automake中的一部分。請檢查上面的組件安裝是否完整。

至此,Slowhttptest安裝成功。

 

五、運行Slowhttptest

//slowloris模式:
# slowhttptest -c 1000 -H -g -o my_header_stats -i 10 -r 200 -t GET -u https://host.example.com/index.html -x 24 -p 3

//slow post模式:
# slowhttptest -c 3000 -B -g -o my_body_stats -i 110 -r 200 -s 8192 -t FAKEVERB -u http://host.example.com/loginform.html -x 10 -p 3

//slow read模式:
# slowhttptest -c 8000 -X -r 200 -w 512 -y 1024 -n 5 -z 32 -k 3 -u https://host.example.com/resources/index.html -p 3

  

六、其他
如果安裝的組件版本不正確,建議卸載,並進行清理(刪除對應文件夾)。一些常用的命令如下:

# m4 --version                          //查看m4的版本
# autoconf --version                    //查看autoconf的版本
# perl --version                        //查看perl的版本
# aclocal --version                     //查看aclocal(automake)的版本
# rpm -qa |grep automake                //查看automake的安裝情況
# rpm -ql automake-1.13.4-3.el7.noarch  //查看automake的安裝路徑
# yum list installed |grep automake     //查看通過yum安裝的automake信息
# yum -y remove automake.noarch         //通過yum刪除已安裝的automake
# make uninstall                        //在make install文件夾中通過uninstall卸載已安裝的內容。

  

參考頁面:

1.https://blog.csdn.net/m0_38016951/article/details/81195377
2.https://www.landui.com/help/show-4482.html
3.https://www.cnblogs.com/softidea/p/3328572.html
4.https://jingyan.baidu.com/article/8275fc8691d01a46a03cf6a5.html?qq-pf-to=pcqq.c2c
5.https://www.cnblogs.com/huanghuang/archive/2012/12/13/2816741.html
6.https://bbs.csdn.net/topics/370153679
7.https://blog.csdn.net/developerof/article/details/88206384
8.https://blog.csdn.net/oWuMingXiaoBei1/article/details/89167140
9.https://blog.csdn.net/qq_39869935/article/details/77248515
10.https://www.cnblogs.com/shenlinken/p/7400336.html
11.https://blog.csdn.net/DXZCZH/article/details/88374476
12.https://www.jianshu.com/p/5ec96f76e25b
13.https://www.itdaan.com/keywords/slowhttptest安裝及使用.html
14.https://blog.csdn.net/adamlinsfz/article/details/84307097
15.https://blog.csdn.net/liyyzz33/article/details/89402504


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM