Homelinux tutorialHow to use hping3 in Linux

How to use hping3 in Linux

hping3 - send (almost) arbitrary TCP/IP packets to network hosts

In this post we will see how to use hping3 tool in LinuxThis tool is pre-installed on a Linux device, and you can install it on your Linux using the command below when you do not have this tool.

					sudo apt-get install hping3

What is hping3?

hping3 is a network tool able to send custom TCP/IP packets and display target replies like the ping program does with ICMP replies. hping3 handles fragmentation, arbitrary packets body, and size and can be used in order to transfer files encapsulated under supported protocols. Using hping3 you are able to perform at least the following stuff:

– Test firewall rules
– Advanced port scanning
– Test net performance using different protocols, packet size, TOS (type of service), and fragmentation.
– Path MTU discovery
– Transferring files between even really fascist firewall rules.
– Traceroute-like under different protocols.
– Firewalk-like usage.
– Remote OS fingerprinting.
– TCP/IP stack auditing.
– A lot of others.

Standard scan

First, we will see how to do a standard scan using hping3. For this, you need to type the following command in your terminal. This standard scan will send SYN packets to your target IP address

					sudo hping3 -S
How to use hping3 in Linux

In the place of -S you could add

-L –setack set TCP ack
-F –fin set FIN flag
-S –synset 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)

Port Scan

Every website must have open ports, so any open ports can be scanned by the hping3 tool to check vulnerability, but only the specified port can be scanned.

					sudo hping3 -S -p 80
How to use hping3 in Linux

-p for specifying the port

-S is SYN, (You could enter any protocol you want as I mentioned in the Standard scan)

Number of Packets

With this hping3 tool, we can control the packets that can be sent to an IP address.

					sudo hping3 -S -p 80 -c 5
Output for send number of packets

-S SYN flag
-p Specify the port
-c No of packets to send

Send TCP Packets

If you want to send TCP packets to your target then run the following command in your terminal.

					sudo hping3

Raw IP

Now, Let’s send raw IP through the network with the below commands

					sudo hping3 -0

Other commands

sudo hping3 -1
sudo hping3 -2
#Between port scan
sudo hping3 -8 1-30 -A
sudo hping3 -9
sudo hping3 -2 -V
#sequesnce number
sudo hping3 -Q -p 139
sudo hping3 -S -p 80 --tcp-timestamp
sudo hping3 -1 10.0.1.x --rand-dest –I eth0
sudo hping3 -9 HTTP -I eth0
#SYN Flood
sudo hping3 -S -a -p 22 --flood

I hope this post was very helpful to you and I want to share this post with your friends too, you can ask me through the command section if you have any doubts about this post.


Leave A Reply

Please enter your comment!
Please enter your name here

Most Popular