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 192.168.149.1
				
			
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 192.168.149.1 -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 192.168.149.1 -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 192.168.149.1
				
			

Raw IP

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

				
					sudo hping3 -0 192.168.149.1
				
			

Other commands

				
					#ICMP
sudo hping3 -1 192.168.149.1
#UDP
sudo hping3 -2 192.168.149.1
#Between port scan
sudo hping3 -8 1-30 -A 192.168.149.1
#Listen
sudo hping3 -9 192.169.149.1
#Verbose
sudo hping3 -2 192.169.149.1 -V
#sequesnce number
sudo hping3 192.168.1.103 -Q -p 139
#Firewall
sudo hping3 -S 72.14.207.99 -p 80 --tcp-timestamp
#Subnet
sudo hping3 -1 10.0.1.x --rand-dest –I eth0
#HTTP
sudo hping3 -9 HTTP -I eth0
#SYN Flood
sudo hping3 -S 192.168.1.1 -a 192.168.1.254 -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.

RELATED ARTICLES

Leave A Reply

Please enter your comment!
Please enter your name here

- Advertisment -

Most Popular