About Me

header ads

Mastering hping3 Tool - From Basic to Advanced Usage Network Testing

Hping3 is a powerful network tool that allows users to generate customized TCP/IP packets and perform various network-related tasks. This guide will take you from the basics of hping3 to advanced options, demonstrating how to use this tool effectively for tasks such as packet sending, port scanning, and network testing.

Key Functions of Hping3:

  1. Firewall testing
  2. Advanced port scanning
  3. Network testing
  4. MTU discovery (Manual path discovery)
  5. Advanced traceroute (supports all protocols)
  6. Remote OS fingerprinting
  7. Remote uptime guessing
  8. TCP/IP stack auditing

Useful Commands in Hping3:

  • -c or --count: Specify the packet count
  • --faster: Alias for -i u1000 (send 100 packets per second)
  • --flood: Send packets as fast as possible without displaying replies
  • -V or --verbose: Enable verbose mode
  • -0 or --rawip: RAW IP mode
  • -1 or --icmp: ICMP mode
  • -2 or --udp: UDP mode
  • -8 or --scan: SCAN mode
  • -9 or --listen: Listen mode
  • -a or --spoof: Spoof source address
  • -C or --icmptype: ICMP type
  • -K or --icmpcode: ICMP code
  • -L or --setack: Set TCP ACK
  • -F or --fin: Set FIN flag
  • -S or --syn: Set SYN flag
  • -R or --rst: Set RST flag
  • -A or --ack: Set ACK flag
  • -X or --xmas: Set X unused flag (0x40)
  • -Y or --ymas: Set Y unused flag (0x80)

  • Installation

Before diving into hping3, ensure it is installed on your system. You can install it on Debian-based systems using the following command:

bash
sudo apt-get install hping3

Basic Usage

1. Sending a SYN Packet

To send a SYN packet to a target IP address, use the following command:

bash
hping3 -S <target-IP>

Replace <target-IP> with the IP address of the target.

2. Port Scanning

Conduct a port scan on a specific port:

bash
hping3 -S -p <port> <target-IP>

Replace <port> with the desired port number.

3. Specify Number of Packets

bash
hping3 -S -p 80 -c 5 <target-IP>

This example sends 5 SYN packets to port 80 of the target.

4. UDP Packets

Use hping3 to send UDP packets:

bash
hping3 -2 -p 53 -c 5 <target-IP>

This example sends 5 UDP packets to port 53 of the target.

5. ICMP Packets

Send ICMP packets to the target:

bash
hping3 -1 <target-IP>

6. Raw IP Mode

Send raw IP packets:

bash
hping3 -0 <target-IP>

7. TCP Flags

Set specific TCP flags (e.g., SYN, ACK, RST) using options like -S, -A, -R

bash
hping3 -S -p 80 <target-IP>

Advanced Options

8. Verbose Mode

Use verbose mode to see detailed information about packets:

bash
hping3 -2 -V <target-IP>

9. Spoof Source Address

Spoof the source address of the packets:

bash
hping3 -S -p 80 -a <spoofed-IP> <target-IP>

10. TCP Flags Combination

Set various TCP flags for different purposes:

bash
hping3 -S -p 80 -F -A -U <target-IP>

Conclusion

Hping3 is a versatile tool that provides a wide range of capabilities for network testing. By mastering both basic and advanced options, you can tailor your network assessments to meet specific requirements. Always use hping3 responsibly and ensure you have the necessary permissions before conducting any network-related activities. Whether you are a beginner or an experienced user, hping3 offers a valuable toolkit for understanding and testing network protocols.

Post a Comment

0 Comments