Exploit-DB updates

Monday, May 2, 2011

hping3 Packet assembler/analyzer

 hping is a TCP/IP packet assembler/analyzer which I've only recently began playing with, so I've decided to make a quick post about it as well as some basic usage. Here's a bit from the site;

While hping was mainly used as a security tool in the past, it can be used in many ways by people that don't care about security to test networks and hosts. A subset of the stuff you can do using hping:
  • Firewall testing
  • Advanced port scanning
  • Network testing, using different protocols, TOS, fragmentation
  • Manual path MTU discovery
  • Advanced traceroute, under all the supported protocols
  • Remote OS fingerprinting
  • Remote uptime guessing
  • TCP/IP stacks auditing
  • hping can also be useful to students that are learning TCP/IP. 
For our first example we will be doing a simple ping to check if a ssh servers up on our network.

hping3 -c 2 -S -p 22 10.0.0.5

This command would send a packet count (-c) of two using the SYN flag (-S) to port 22 (-p) on the host 10.0.0.5 in order to see if it's live. We can also set it to send packets every specified interval as you'll see below.


hping3 -S -p 22 -V 10.0.0.5 -i 10 -I wlan0


This command would send a packet using the SYN flag every 10 seconds (-i) to port 22 with verbose output (-V) utilizing the wireless interface (-I).

This tool is so flexible that it can even be used as a scanner (though I wouldn't go and replace nmap just yet)

hping3 -S --scan 21-25,80,8080 -V 10.0.0.5 -I wlan0

Another example worth showing is the data manipulation available with hping. We will make a file with the contents we'd like out packets to display (to mess with those who actually read their logs and give them a laugh)

Now create your payload with the data you'd like your packets to contain, I'll just make mine "Pathogen was here" and save it as payload.txt (You will see the contents when looking through wireshark logs for example.) 

Do note the default data size is zero, so you will have to specify a data size (-d) in order to utilize the file option.


hping3 hakhub.tk -V -d 10 --file payload.txt -S -I wlan0

There's tons of other commands such as a listener and anonymity options, but these are a few of the possible things this tool is capable of. You can download it using your repository of choice or visit http://www.hping.org/download.php

No comments:

Post a Comment