๐ Why you need to know this
In the previous lesson, we understood the idea: a scanner walks around a house and tries every window. Now โ how to do it.
Imagine you are an investigator. You have 4 levels of house inspection:
- A quick glance from the street โ which windows are lit
- Careful โ what kind of lamp is in each window, what brand
- Standard inspection with basic tests โ is the gate open, is there a dog
- Full portrait โ all of the above + find out whose house it is
These are the 4 main ways to use nmap. You don't need to memorize a bunch of flags โ you need to understand the 4 levels and when to use each.
๐ช Level 1: "A Quick Glance"
๐ฏ In a nutshell in 30 seconds
The very first command of any hacker. Run it and in 5-30 seconds find out which windows (ports) are open on the server.
nmap scanme.nmap.org
What you'll see:
PORT STATE SERVICE
22/tcp open ssh
80/tcp open http
9929/tcp open nping-echo
31337/tcp open Elite
That's it. Which windows are open, what's roughly inside them. No details. This is how every server investigation in the world begins.
๐ Level 2: "What version is the program in the window"
๐ฏ In a nutshell in 30 seconds
Knowing "window 22 is SSH" is useful. Knowing "window 22 is OpenSSH 6.6 from 2014" is 100 times more valuable.
Old version = high chance that methods for exploiting it have already been published on the internet (this is called CVE โ Common Vulnerabilities and Exposures).
nmap -sV scanme.nmap.org
The flag -sV = "Version". Don't memorize it as a formula โ remember "s-V adds versions".
PORT STATE SERVICE VERSION
22/tcp open ssh OpenSSH 6.6.1p1 Ubuntu โ version!
80/tcp open http Apache httpd 2.4.7 โ version!
Now Google: "OpenSSH 6.6.1 CVE" โ you'll find specific vulnerabilities. This is the main mechanism for exploiting old servers.
๐ค Level 3: "Standard Checks"
๐ฏ In a nutshell in 30 seconds
nmap has ~600 built-in checks for common issues. You can run a "basic set" with a single command โ it will check the most popular ones itself.
nmap -sC scanme.nmap.org
The flag -sC = "Scripts default". What it will check itself:
- On a web server โ what technologies, if robots.txt exists, headers
- On SSH โ what encryption versions (are there any weak ones)
- On FTP โ is passwordless login allowed (anonymous)
- On Windows networks (SMB) โ which folders are open to everyone
You don't need to memorize every check. Run it and read the output โ everything is clearly labeled there.
๐ Level 4: "Full Server Portrait"
๐ฏ In a nutshell in 30 seconds
One command โ everything above + OS + route to the server.
This is the main command for the first 5 minutes of any investigation.
sudo nmap -A scanme.nmap.org
The flag -A = "All / Aggressive". Remember it as "aggressive โ that's a full portrait".
What you'll get in one minute:
- Which windows are open
- What version of the program is in each window
- All standard checks (as in -sC)
- Server OS (Ubuntu 22, Windows Server 2019, etc.)
- How many "hops" across the network to the server
This is enough to immediately understand โ "is there anything interesting here to investigate".
๐ Cheat Sheet: Which Level When
| What I want | Command | Time |
| Quickly understand what's open | nmap target | ~10 sec |
| Find out service versions | nmap -sV target | ~30 sec |
| Run standard checks | nmap -sC target | ~1 min |
| Full portrait | sudo nmap -A target | ~2-5 min |
๐ How to scan specific windows
By default, nmap will check the "top-1000" windows. This is sufficient in 99% of cases. But sometimes you want to do it differently:
# Only windows 80 and 443
nmap -p 80,443 target
# ALL 65535 windows (slow, but complete)
nmap -p- target
Memorizing is not mandatory. When you need it โ ask Claude or Google it.
๐ฏ How a real pentester uses nmap
๐ก Two-step strategy
Experienced hackers don't do a full scan right away. They do this:
- Step 1 โ quick reconnaissance:
nmap -p- --min-rate 5000 target โ which windows are open at all (5 minutes instead of an hour)
- Step 2 โ full portrait of only the found windows:
sudo nmap -A -p 22,80,443 target
Why this way? Because a full portrait of 65,535 windows would take an hour. And the two-step strategy โ 10 minutes.
๐ค Simple understanding check test
- Which command will simply show "which windows are open"? โ
nmap target
- Which flag adds program versions? โ
-sV
- Which flag creates a "full portrait" with one command? โ
-A
- Why does a hacker need to know the service version? โ To look for CVEs โ a catalog of known vulnerabilities for that version
- Should you immediately run
nmap -A on all 65,535 windows? โ No, first a quick scan โ then detailed on the found ones
๐ You don't have to do it, but it's interesting
Open Kali and perform 3 scans of scanme.nmap.org. This is legal โ the site is specifically for practice.
# 1. Quick glance
nmap scanme.nmap.org
# 2. Versions + standard checks
nmap -sV -sC scanme.nmap.org
# 3. Full portrait
sudo nmap -A scanme.nmap.org
Read the output. What did you learn? What OS? What services? What versions? Take this output and go to the next lesson โ there we will learn to analyze what we found.
๐ค Vibe-task: Ask Claude
Open Claude and ask:
I scanned scanme.nmap.org with the command `sudo nmap -A`.
Here is my output:
[insert nmap -A output here]
Explain to me like I'm 10 years old โ what am I looking at here?
Which windows are open? What roughly lives inside them?
What is the server's OS? How old are these programs?
Is there anything "juicy" here to investigate?