首页 > 代码库 > hping的用法

hping的用法

 hping --help | head -1
usage: hping host [options]

$ hping lonlife.net -S -p 80 -c 5             # 默认为tcp ping : -S SYN : -p destination port : -c 发送测试包总数
HPING lonlife.net (eth0 210.77.146.101): S set, 40 headers + 0 data bytes
len=48 ip=210.77.146.101 ttl=48 DF id=0 sport=80 flags=SA seq=0 win=14600 rtt=38.1 ms
len=48 ip=210.77.146.101 ttl=48 DF id=0 sport=80 flags=SA seq=1 win=14600 rtt=40.0 ms
len=48 ip=210.77.146.101 ttl=48 DF id=0 sport=80 flags=SA seq=2 win=14600 rtt=36.7 ms
len=48 ip=210.77.146.101 ttl=48 DF id=0 sport=80 flags=SA seq=3 win=14600 rtt=41.5 ms
len=48 ip=210.77.146.101 ttl=48 DF id=0 sport=80 flags=SA seq=4 win=14600 rtt=44.2 ms

--- lonlife.net hping statistic ---
5 packets transmitted, 5 packets received, 0% packet loss
round-trip min/avg/max = 36.7/40.1/44.2 ms

$  hping lonlife.net -2 -p 80 -c 5             # -2  UDP-ping 
HPING lonlife.net (eth0 210.77.146.101): udp mode set, 28 headers + 0 data bytes
ICMP Port Unreachable from ip=210.77.146.101 name=UNKNOWN
ICMP Port Unreachable from ip=210.77.146.101 name=UNKNOWN
ICMP Port Unreachable from ip=210.77.146.101 name=UNKNOWN
ICMP Port Unreachable from ip=210.77.146.101 name=UNKNOWN

--- lonlife.net hping statistic ---
5 packets transmitted, 4 packets received, 20% packet loss
round-trip min/avg/max = 0.0/0.0/0.0 ms

$ hping xy.com --rand-source --syn --flood               # 这个不解释了


  总结: 
        hping的udp ping,当对方的回复ICMP Port Unreachable时,下面的时间统计竟然没有有效数据,而nmap的nping不存在此类问题,建议使用nping  (另外一个原因,hping早已停止更新,nmap一直在更新)




来自为知笔记(Wiz)


hping的用法