This page looks best with JavaScript enabled

Nmap and Hping

 ·  🎃 kr0m

Once again, we are back to talk about two essential tools for any network administrator, Nmap and Hping.

I will explain how each type of scan works and the flags that are activated in the IP packets depending on the port status.

In Hping, you have to pay attention to the flags=RA RST ACK

nmap -A IP

Complete scan with version number of services, OS...

Complete connection: NOROOT

nmap -sT IP

->SYN <-syn-ack ->ACK => OPEN
->SYN <-rst-ack => CLOSED

Half-open connection:

nmap -sS IP
hping3 -c 4 -S -p PORT IP

->SYN <-syn-ack ->RST => OPEN
->SYN <-rst-ack => CLOSED

TCP ACK connection: Always responds with an RST, used to discover if the machine is active.

hping3 -c 4 -A -p PORT IP

->ACK <-rst => ACTIVE

TCP SYN ACK connection: Depends on the OS stack

hping3 -c 4 -S -A -p PORT IP

->SYN-ACK <-nothing => OPEN
->SYN-ACK <-rst => CLOSED

TCP FIN connection: Quite “clandestine”

nmap -sF IP
hping3 -c 4 -F -p PORT IP

->FIN <-nothing => OPEN
->FIN <-rst => CLOSED

TCP Null Flag: No flag marked

nmap -sN IP
hping3 -c 4 -p PORT IP

->Tcp Null <-nothing => OPEN
->Tcp Null <-rst => CLOSED

TCP Xmas: All flags marked

nmap -sX IP
hping3 -c 4 -F -S -R -P -A -U -X -Y -p PORT IP

->Tcp Xmas <-nothing => OPEN
->Tcp Xmas <-rst => CLOSED

UDP Scan:

nmap -sU IP
hping3 -V -c 4 -2 -p PORT

Ping Scan (type 8):

ping IP

->type 8 <-type 0

Broadcast Ping:

hping3 -1 -c 5 IP

ICMP type 10 (Presence of a Router):

icmpush -vv -rts IP

ICMP type 13 (Timestamps): Provides information about the machine regarding the time zone (geographical location) and whether it is active or not.

icmpush -vv -tstamp IP

ICMP type 15 (Request for Network Address):

icmpush -vv -info IP

ICMP type 17 (Request for Network Mask):

icmpush -vv -mask IP

OS Analysis:

nmap -O IP

Fragment Scan:

nmap -f IP

FTP Bounce Scan:

nmap -P0 -b username:password@server:port IP

Dumb Host Scan: False source address, the zombie should not send packets during the scan.

nmap -P0 -sI IPZombie:Port IP

IP Protocol Scan: Determines which IP protocols the victim supports (ICMP TCP UDP GRE).

nmap -sO IP

Well, I think I have summarized it quite well and I hope it helps someone.

If you liked the article, you can treat me to a RedBull here