hping命令介绍
程序员文章站
2022-06-25 12:15:03
...
一 对特定目标端口发起tcp探测
-p 端口
-S 设置TCP模式SYN包
二 伪造来源IP,模拟Ddos工具
-a 伪造IP地址
三 实战
[root@localhost hping-master]# hping -p 22 -S 127.0.0.1
HPING 127.0.0.1 (lo 127.0.0.1): S set, 40 headers + 0 data bytes
len=44 ip=127.0.0.1 ttl=64 DF id=0 sport=22 flags=SA seq=0 win=43690 rtt=0.3 ms
len=44 ip=127.0.0.1 ttl=64 DF id=0 sport=22 flags=SA seq=1 win=43690 rtt=0.3 ms
len=44 ip=127.0.0.1 ttl=64 DF id=0 sport=22 flags=SA seq=2 win=43690 rtt=0.2 ms
len=44 ip=127.0.0.1 ttl=64 DF id=0 sport=22 flags=SA seq=3 win=43690 rtt=0.2 ms
1、关闭ICMP后,普通ping命令ping不通,但hping命令可以ping通。
[root@localhost hping-master]# sysctl -w net.ipv4.icmp_echo_ignore_all=1
net.ipv4.icmp_echo_ignore_all = 1
[root@localhost hping-master]# ping 127.0.0.1
PING 127.0.0.1 (127.0.0.1) 56(84) bytes of data.
[root@localhost hping-master]# hping -p 22 -S 127.0.0.1
HPING 127.0.0.1 (lo 127.0.0.1): S set, 40 headers + 0 data bytes
len=44 ip=127.0.0.1 ttl=64 DF id=0 sport=22 flags=SA seq=0 win=43690 rtt=0.6 ms
len=44 ip=127.0.0.1 ttl=64 DF id=0 sport=22 flags=SA seq=1 win=43690 rtt=0.4 ms
len=44 ip=127.0.0.1 ttl=64 DF id=0 sport=22 flags=SA seq=2 win=43690 rtt=0.4 ms
len=44 ip=127.0.0.1 ttl=64 DF id=0 sport=22 flags=SA seq=3 win=43690 rtt=0.2 ms
len=44 ip=127.0.0.1 ttl=64 DF id=0 sport=22 flags=SA seq=4 win=43690 rtt=0.2 ms
2、伪造Ddos
[root@localhost ~]# hping -p 22 -S 127.0.0.1 -a 127.0.0.2