Pentest Tools


Nmap Cheatsheet

How to Install Nmap

Nmap installation:

Installation
username@machine_name:~$ sudo apt install nmap

Useful Commands for Nmap


-sS: Perform a stealthy SYN scan
-sT: Perform a TCP connect scan
-sU: Perform a UDP scan
-p [port]: Specify the port to scan
-p-: Scan all 65535 ports
-O: Enable OS detection
-A: Enable OS detection, version detection, script scanning, and traceroute
-v: Increase verbosity level
-Pn: Disable host discovery
-T[0-5]: Set timing template (0 = slowest, 5 = fastest)
--script [script]: Specify a script to run
-oN [file]: Save output in normal format
-oX [file]: Save output in XML format
-oG [file]: Save output in grepable format

Examples of Nmap Commands

Perform a basic SYN scan:

SYN Scan
username@machine_name:~$ nmap -sS 192.168.1.1

Perform a TCP connect scan:

TCP Connect Scan
username@machine_name:~$ nmap -sT 192.168.1.1

Perform a UDP scan:

UDP Scan
username@machine_name:~$ nmap -sU 192.168.1.1

Perform OS detection:

OS Detection
username@machine_name:~$ nmap -O 192.168.1.1

Scan all ports:

All Ports Scan
username@machine_name:~$ nmap -p- 192.168.1.1

Perform a service version detection scan:

Version Detection
username@machine_name:~$ nmap -sV 192.168.1.1

Save the output in normal format:

Save Output
username@machine_name:~$ nmap -oN output.txt 192.168.1.1