歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
Linux教程網 >> Linux基礎 >> Linux教程 >> hping網絡安全工具的安裝及使用

hping網絡安全工具的安裝及使用

日期:2017/2/28 13:46:31   编辑:Linux教程

hping是用於生成和解析TCPIP協議數據包的開源工具。創作者是Salvatore Sanfilippo。目前最新版是hping3,支持使用tcl腳本自動化地調用其API。hping是安全審計、防火牆測試等工作的標配工具。hping優勢在於能夠定制數據包的各個部分,因此用戶可以靈活對目標機進行細致地探測。

1.獲取hping的源碼:
https://github.com/antirez/hping/archive/master.zip
unzip master
cd hping-master
yum install libpcap-devel
./configure
make
make install

報錯:
build byteorder.c...
./configure: line 19: cc: command not found

解決辦法:
yum install -y gcc gcc-c++

hping依賴libpcap-devel,所以需要先進行安裝,make過程中還可能出現以下兩個問題:

出現問題:
libpcap_stuff.c:19:21: error: net/bpf.h: No such file or directory
make: *** [libpcap_stuff.o] Error 1

解決辦法:ln -sf /usr/include/pcap-bpf.h /usr/include/net/bpf.h

出現問題:
al/lib -lpcap -ltcl -lm -lpthread
/usr/bin/ld: cannot find -ltcl
collect2: ld returned 1 exit status
make: *** [hping3] Error 1

解決辦法:yum -y install tcl tcl-devel

make報錯:
main.o: In function `main':
/root/hping-master/main.c:190: undefined reference to `hping_script'
collect2: ld returned 1 exit status
make: *** [hping3] Error 1

解決辦法:
make clean,重新./configure

然後輸入:

make strip

make install

驗證是否安裝正確
# hping3 -v
hping version 3.0.0-alpha-1 ($Id: release.h,v 1.4 2004/04/09 23:38:56 antirez Exp $)
This binary is TCL scripting capable

如果防火牆或運營商屏蔽ICMP的話,hping可以對指定目標端口發起TCP探測,常用的參數:

-p 端口號

-S 發送TCP的SYN包

-A 發送TCP的ACK包

-a 偽造源IP

--flood 盡可能快的發送,慎用

輸入示例:

hping 192.168.3.13 -p 80 -S
hping 192.168.3.13 -p 80 -A
hping 192.168.3.13 -p 80 -S -a 192.168.3.13

# hping3 -c 100000 -d 120 -S -w 64 -p 80 --flood --rand-source 192.168.3.13

該命令中使用的語法:
1. hping3 = 應用程序二進制代碼的名稱。
2. -c 100000 = 發送的數據包的數量。
3. -d 120 = 發送到目標機器的每個數據包的大小。
4. -S = 只發送SYN數據包。
5. -w 64 = TCP窗口大小。
6. -p 80 = 目的地端口(80是WEB端口)。你在這裡可以使用任何端口。
7. --flood = 盡可能快地發送數據包,不需要考慮顯示入站回復。洪水攻擊模式。
8. --rand-source = 使用隨機性的源頭IP地址。你還可以使用-a或–spoof來隱藏主機名。詳見文章末尾的參考手冊頁。
9. 192.168.3.13 = 目的地IP地址或目標機器的IP地址。你在這裡還可以使用網站名稱。在本文中解析至127.0.0.1(已在/etc/hosts文件中輸入)。

被測試的機器效果:

Copyright © Linux教程網 All Rights Reserved