Network Mapper (Nmap) is the industry-standard tool for network discovery and security auditing. It uses raw packets to identify hosts, open ports, running services, OS versions, and firewall configurations.
Nmap divides its scanning into five main techniques:
nmap <scan types> <options> <target>| Flag | Description |
|---|---|
| -sS | TCP SYN Scan. Default & most popular. Fast and "stealthy." |
| -sT | TCP Connect Scan. Completes full 3-way handshake (noisier). |
| -sU | UDP Scan. Scans for open UDP ports. |
| -sI | Idle Scan. Uses a zombie host to scan blindly. |
| -O | OS Detection. Identifies IP protocol. |
This scan is efficient because it performs a half-open scan. It sends a SYN packet but never completes the TCP 3-way handshake, making it faster and harder to log.
sudo nmap -sS localhost
Starting Nmap 7.80 ( https://nmap.org ) at 2020-06-11 22:50 UTC
Nmap scan report for localhost (127.0.0.1)
Host is up (0.000010s latency).
Not shown: 996 closed ports
PORT STATE SERVICE
22/tcp open ssh
80/tcp open http
5432/tcp open postgresql
5901/tcp open vnc-1
Nmap done: 1 IP address (1 host up) scanned in 0.18 seconds| PORT | STATE | SERVICE |
|---|---|---|
| 22/tcp | open | ssh |
| 80/tcp | open | http |
| 443/tcp | filtered | https |