Ping with hping
hping 192.168.1.100 -> simple ping
hping -1 -c 100 192.168.0.2 -> send 100 (-c ) pings
Ping with data in the packet
first create a text file with the Textdata. Sample: "data in my ICMP packet" with the length of 22 characters
echo "data in my ICMP packet" > data.txt
now send the packet.
hping -d 22 -E data.txt -1 -c 100 192.168.2.200
and the tcpdump output is the following
sudo tcpdump -X -nn -s 0 -i eth0 icmp
18:29:30.930009 IP 192.168.2.100 > 192.168.2.200: ICMP echo request, id 27678, seq 2560, length 30
0x0000: 4500 0032 75e4 0000 4001 7e6a c0a8 0264 E..2u...@.~j...d
0x0010: c0a8 02c8 0800 c023 6c1e 0a00 6461 7461 .......#l...data
0x0020: 2069 6e20 6d79 2049 434d 5020 7061 636b .in.my.ICMP.pack
0x0030: 6574 et
18:29:30.930454 IP 192.168.2.200 > 192.168.2.100: ICMP echo reply, id 27678, seq 2560, length 30
0x0000: 4500 0032 4f3c 0000 ff01 e611 c0a8 02c8 E..2O<..........
0x0010: c0a8 0264 0000 c823 6c1e 0a00 6461 7461 ...d...#l...data
0x0020: 2069 6e20 6d79 2049 434d 5020 7061 636b .in.my.ICMP.pack
0x0030: 6574 et
TCP Packete with hping
Syn packets to port 80 on host 192.168.2.200
hping 192.168.2.200 -p 80 -S
Syn packets to port 80 on host 192.168.2.200 with spoof source address 192.168.2.1
hping 192.168.2.200 -p 80 -S -a 192.168.2.1
Syn Scanning Scanning
hping -S 192.168.2.200 -p ++0 --fast
and the answer is:
HPING 192.168.2.200 (eth0 192.168.2.200): S set, 40 headers + 0 data bytes
len=46 ip=192.168.2.200 ttl=255 id=31515 sport=0 flags=RA seq=0 win=0 rtt=0.5 ms
len=46 ip=192.168.2.200 ttl=255 id=31516 sport=1 flags=RA seq=1 win=0 rtt=0.5 ms
len=46 ip=192.168.2.200 ttl=255 id=31518 sport=2 flags=RA seq=2 win=0 rtt=0.5 ms
len=46 ip=192.168.2.200 ttl=255 id=31519 sport=3 flags=RA seq=3 win=0 rtt=0.6 ms
len=46 ip=192.168.2.200 ttl=255 id=31520 sport=4 flags=RA seq=4 win=0 rtt=3.8 ms
len=46 ip=192.168.2.200 ttl=255 id=31521 sport=5 flags=RA seq=5 win=0 rtt=0.5 ms
.
.
len=46 ip=192.168.2.200 ttl=255 id=31547 sport=21 flags=RA seq=21 win=0 rtt=0.5 ms
len=46 ip=192.168.2.200 ttl=255 id=31548 sport=22 flags=RA seq=22 win=0 rtt=2.7 ms
len=46 ip=192.168.2.200 ttl=255 id=31549 sport=23 flags=SA seq=23 win=2048 rtt=2.1 ms
len=46 ip=192.168.2.200 ttl=255 id=31550 sport=24 flags=RA seq=24 win=0 rtt=0.5 ms
if the answer is SA (Syn/Ack) not RA (reset/ack), there is a open Port
hping -S 192.168.2.200 -p ++0 --fast | fgrep "flags=SA"
len=46 ip=192.168.2.200 ttl=255 id=32193 sport=23 flags=SA seq=23 win=2048 rtt=0.7 ms
len=46 ip=192.168.2.200 ttl=255 id=32275 sport=80 flags=SA seq=80 win=2048 rtt=0.8 ms
DSCP
Samples for setting DSCP Bits
hping 192.168.3.1 --tos 28 -S -a 192.168.2.99 -p 80 (0x28)
hping 192.168.3.1 --tos 58 -S -a 192.168.2.99 -p 80 (0x58)
hping 192.168.3.1 --tos B8 -S -a 192.168.2.99 -p 80 (0xB8)
Flooding
Syn Flooding
normal, ever sec a packet is send, to do this faster user following options
-i n: alle n Sekunden
-i un: alle n Mikrosekunden (ein Millionstel einer Sekunde)
--fast: 10 Mal in der Sekunde (wie -i u100000)
samples:
hping 192.168.1.1 --fast -p 80 -S -c 100000
hping3 --udp --flood -p 53 192.168.1.1
Other Samples found on the internet
hping3 -c 1 --syn -p 80 192.168.2.1
hping3 -c 1 --syn -p 80 192.168.2.1
hping3 -c 1 --fin --push --urg -p 80 192.168.2.1
hping3 -c 1 --ack -p 80 192.168.2.1
hping3 -c 1 --udp -p 53 192.168.2.1
hping3 -c 1 --rawip --ipproto 0 192.168.2.1
hping3 -c 1 --icmp 192.168.2.1
hping3 -c 1 --rawip --ipproto 2 192.168.2.1
hping -c 1 --icmp-ts 192.168.2.200
hping --icmp-addr -c 1 10.10.10.255
hping --udp -c 1 -p 1 10.10.10.10
hping -V -c 1 10.10.10.10
hping -V -c 1 --icmptype 10 10.10.10.254
hping –a 10.10.10.3 –S 10.10.10.10 –p 80 –i u10000