Week 3 Active Reconnaissance & Nmap
CSS484 — Week 3 Cheat Sheet: Active Reconnaissance & Nmap
"Crossing the line: probing systems directly to map what is exposed."
0. Learning Objectives (Roadmap)
| # | Objective |
|---|---|
| 01 | Discover targets & services — how attackers actively reach out and discover systems/services that respond |
| 02 | Perform & interpret Nmap scans — run multiple scan techniques AND understand what results actually mean |
| 03 | Identify exposed services & flaws — open services, exact versions, and misconfigurations that create real risk |
| 04 | Turn fingerprints into exploits — how banners & OS fingerprints lead directly to known vulnerabilities |
| 05 | Operate responsibly — reconnaissance tools only within the isolated lab, always within authorization |
1. Networking Foundations for Recon
Core idea: Reconnaissance is a networking skill first, a tooling skill second. Nmap sends packets and tabulates responses — knowing why a port is silent, why UDP is ambiguous, or why the inside looks nothing like the outside is entirely on you.
Analogy: A scanner is like a stethoscope — it just reports the sound it hears. Whether that sound means "healthy" or "problem" depends entirely on the doctor's (your) knowledge of anatomy (networking).
| Key principle | Meaning |
|---|---|
| Tools interact with live services | Scanners send crafted packets and watch exactly what comes back — nothing more |
| Attackers focus on what responds | You need to read a response and know what it means, not memorize OSI layers |
| Open ports define the attack surface | Every listening service is a door — discovering them is the whole point of a scan |
| Your position shapes what you see | The same target looks completely different from inside the LAN vs. out on the internet |
LAN vs. WAN — two very different vantage points
| Property | LAN: internal | WAN: the internet |
|---|---|---|
| Scope | Private, internal networks | Large-scale public networks |
| Addressing | Private (RFC 1918): 10.x / 172.16.x / 192.168.x | Public, globally routable IPs |
| Trust & filtering | High trust, low filtering inside | Hardened perimeter, heavy filtering |
| What a scan sees | Everything — full internal surface | Only deliberately exposed services |
| Scan speed | Fast, relatively unrestricted | Slower, restricted by the firewall |
| Attacker's goal | Impact — reach the real objectives | Entry — find one weak door in |
The strategic move: WAN recon finds the door; LAN recon, after you pivot inside, finds the impact. Attacks flow from the outside in.
Why the inside is the real prize
| Zone | Reality |
|---|---|
| Outside — a hardened wall | Only a few public services visible; firewall hides everything internal; each exposed service is likely well-defended |
| Inside — a soft, sprawling surface | Hundreds of internal services reachable once inside; hosts trust each other, filtering is minimal, services once invisible are suddenly reachable and often unpatched |
| The bridge — pivoting | 1 door is all it takes: compromise one public-facing host, get inside the NAT boundary, and the whole internal surface opens up |
Analogy: A building's exterior has one locked front door and reinforced windows. Once you're inside, every office door is unlocked and every filing cabinet is reachable.
IP addressing — public vs. private
| Private (hidden inside LANs) — NOT routable | Public (exposed to the world) — globally routable |
|---|---|
10.0.0.0/8 — one huge block | Assigned by ISPs for an org's external systems |
172.16.0.0–172.31.255.255 — 16 contiguous blocks | Carries public services: web, mail, VPN |
192.168.0.0/16 — the home-router classic | Every one grows the surface — visible to the entire internet |
| Invisible from outside; reachable only from inside (or via NAT) | Enumerate these first for external recon |
NAT / PAT — why outside is not inside
Many private hosts share one public IP. The router rewrites addresses on the way out and tracks each connection by port, so an external scan sees only the router, never the hosts behind it.
Private LAN NAT/PAT Router Internet sees:
Host A 192.168.1.10 ┐
Host B 192.168.1.11 ├──────────────▶ 203.0.113.5 ────────▶ ONE public IP
Host C 192.168.1.12 ┘
- Many hosts, one public IP — PAT distinguishes connections by port number
- External scans stop at the boundary — you can't even tell how many hosts exist
- To reach them, get inside first — compromise something public, then scan from within
Analogy: NAT/PAT is like an office receptionist with one phone number — every employee's outgoing calls show the same caller ID, and outsiders can't dial an employee directly without the receptionist forwarding the call.
Ports as the attack surface
Anatomy of a socket address: 10.10.2.244:443
10.10.2.244→ which host (IP address)443→ which service (port)
| Principle | Meaning |
|---|---|
| Ports are entry points | Where a service listens for connections |
| More open ports = bigger target | 1 door is trivial; 20 is a sprawling surface |
| Unneeded services = free risk | A door open for no reason — pure exposure |
$ netstat -tuln
Proto Local Address State
tcp 0.0.0.0:22 LISTEN # SSH, needed?
tcp 0.0.0.0:445 LISTEN # SMB, high risk
tcp 0.0.0.0:3389 LISTEN # RDP, exposed!
tcp 0.0.0.0:8080 LISTEN # old web app?High-value targets to know:
| Port | Service |
|---|---|
| 22 | SSH |
| 23 | Telnet |
| 80/443 | HTTP/S |
| 445 | SMB |
| 3389 | RDP |
When you scan, you're asking one question: which doors are open, and what's behind each one?
Port forwarding — how outside gets in
Incoming traffic from the WAN addressed to
203.0.113.5:443is forwarded to192.168.1.10.
- The rule exists before the packet — no dynamic entry can match unsolicited traffic; someone configured this by hand
- The port number is a label, not a promise — external 2222 can land on internal 22; this is why you run
-sVinstead of assuming
Analogy: A forwarding rule is like telling the office receptionist "if anyone calls extension 443, put them through to Bob's desk." Without that instruction, unsolicited calls just get dropped.
TCP vs. UDP — from the attacker's view
| Property | TCP: connection-oriented | UDP: connectionless |
|---|---|---|
| Connection | 3-way handshake first | Fire and forget, no setup |
| Reliability | Guaranteed, ordered | Best-effort, may be lost |
| Scannability | Predictable, clear states | Ambiguous — silence is not closed |
| Scan speed | Fast | Slow (retries + timeouts) |
| Key services | Web, SSH, databases | DNS, SNMP, NTP |
| Attacker note | Most of your attention | Overlooked, so misconfigured |
Why UDP matters: because everyone finds it annoying and skips it, UDP services are frequently misconfigured. A thorough attacker doesn't skip it.
How scanners read the network
Scanner sends probe →
SYN-ACK → OPEN (service is there, offering to connect)
RST → CLOSED (host reachable, nothing listening here)
no reply/ICMP → FILTERED (a firewall is silently dropping the probe)
The core logic: poke each port, watch the reply, infer the state. Open and closed give a definite answer; filtered gives silence, and that gap is where the subtlety lives.
🧠 Concept Checks (very likely exam material — these are the instructor's own reasoning drills)
Q: TCP SYN scan, no response at all — what does it mean?
Not "closed" (closed usually replies RST). Could be filtered (firewall silently drops) OR open but not responding — from one probe you cannot tell them apart. No response = uncertain, not closed. Worse with UDP, where silent drops are the norm, not the exception. Key takeaway: In scanning, no response is not a result — it is an ambiguity.
Q: You just compromised one public-facing web server — what's next?
Pivot. The internal network is a far larger attack surface with higher trust and more targets — the web server was just the door. (External recon can still matter for multi-tenant hosting/shared infra/supply chain.) Key takeaway: WAN recon finds doors; LAN recon finds impact.
Q: What most limits what a scanner can actually see?
Not "a better tool" — it's firewall/filtering/NAT/policy/routing — i.e., network architecture, not scanner capability. Key takeaway: Recon is constrained far more by where you are standing than by what you are holding.
Q: UDP scan on port 53 (DNS), no response — most correct conclusion?
Open UDP often gives no response at all. Closed UDP sometimes returns ICMP unreachable but that's often rate-limited/blocked. Filtered also gives no response. All three can look identical. Nmap's honest label:
open|filtered= unknown. Key takeaway: UDP scanning is inherently ambiguous — "unknown" is a legitimate, professional answer.
Networking commands — your orientation kit
| Windows | Linux/Kali | What it does |
|---|---|---|
ipconfig | ifconfig | Interface IP configuration |
netstat | netstat | Listening ports + their programs |
route | route | View/modify routing table |
ping | ping | ICMP: is the target reachable? |
tracert | traceroute | Trace the path, hop by hop |
arp | arp | MAC-to-IP cache on the segment |
nslookup | dig | DNS queries |
telnet/ftp | telnet/ftp | Raw interaction: plaintext, insecure |
2. Active Scanning — The Defining Trade-off of the Week
Active scanning = reaching out and probing targets directly. Confirmed, current intelligence — at the cost of every probe being a packet that arrives, gets logged, and can be seen.
| GAIN | COST |
|---|---|
| Confirmed, current data — not inference | Every probe is a packet that arrives at the target |
| Exact services & versions — raw material for real vulns | Logs & alerts fire — firewalls/IDS/IPS are tuned to spot scans |
| A live attack-surface map | You announce your presence — active recon is detectable by design |
Active vs. Passive — one more time
| Property | PASSIVE (Week 2) | ACTIVE (this week) |
|---|---|---|
| Contact | No contact with target | Direct probing of systems |
| Sources | Public records, OSINT, DNS | Live hosts, ports, services |
| Detectability | Essentially invisible | Noisy, logged & alertable |
| Information | Limited to what's public | Detailed, current, confirmed |
| When | First — build the picture | Second — confirm & deepen |
The professional switch: start passive to find where to look, go active to confirm what's there.
The attacker's shopping list (active recon delivers, top to bottom)
- Live hosts — which machines are up/reachable — no wasted effort
- Port states — open/closed/filtered — where the viable doors are
- Services & versions — outdated software = exactly where exploitable flaws live
- Attack-surface map — the whole environment, reveals lateral movement paths
- Misconfigurations — services exposed that shouldn't be, defaults left in place
Precision vs. coverage — a spectrum, not a right answer
BROAD SCANS ←————————————————→ TARGETED SCANS
| Broad scans | Targeted scans |
|---|---|
| Maximum visibility — map the whole range | Stealthy — minimal footprint |
| High noise — trips IDS/IPS quickly | Precise — only what you need |
| ⏱ Slow across large targets (can take hours) | Fast, but you must know where to look |
| 🔔 Aggressive scans can be actively blocked mid-scan |
On the other side of your scan (the defender's chain)
Your scan (probes arrive) → Logs (every probe recorded) → IDS/IPS (pattern recognized)
→ Correlation (intent revealed) → ALERT (defender responds)
A single odd packet means nothing. A correlated pattern is unmistakable. In many real breaches, the reconnaissance scan is the defender's very first indication something is wrong — before any exploitation. This is exactly why evasion exists.
Analogy: One person jiggling a doorknob means nothing. Someone systematically jiggling every doorknob on the street, in order, is what makes neighbors call the police.
⚖️ Legal/ethical discussion (Q&A — Starbucks WiFi scenario, likely a direct exam scenario)
| Question | Correct reasoning |
|---|---|
| Scanning the local WiFi range at a coffee shop — a crime? | Port scanning is not, by itself, specifically illegal in most jurisdictions — but that's a different question from whether it's authorized. |
| What does the network record about your device? | At minimum your device's MAC address and assigned IP, usually with timestamps — often the domains/traffic you generated too. |
| Does a VPN make local scanning anonymous? | No — it encrypts traffic contents/destination from the local network, but the AP still sees your real MAC; a scan of the local subnet doesn't go through the tunnel the way you'd expect. |
| Scanning a public website with VPN on — what changes? | The target logs the VPN's exit IP instead of yours — but the scan is still recorded, the VPN provider can tie that IP back to you, and scanning a site you don't own can still be unauthorized regardless. |
Analogy: A VPN is like wearing a ski mask while walking down the street — passersby can't identify your face (traffic contents), but the doorman at the building you entered (local AP) still saw your height, build, and gait (MAC address) on the way in.
3. Nmap — The Attacker's Tool of Choice
Nmap is configured, not just run. Beginners type
nmap targetand accept whatever happens. Professionals choose scan type, timing, and depth for the goal.
| Why Nmap dominates |
|---|
| Automates active recon — packet-crafting and interpretation at speed |
| Flexible & configurable — you shape every scan |
| Works LAN and WAN — same tool, internal or external |
| Attacker & defender — learn it once, use it on both sides |
SYN scan — the default weapon
Full Connect Scan (-sT) — completes the full 3-way handshake:
Scanner → SYN → Target
Target → SYN-ACK → Scanner
Scanner → ACK → Target
Result: connection OPEN (logged by target)
SYN Scan (-sS) — half-open, Nmap's default for a privileged (sudo) user:
Scanner → SYN → Target
Target → SYN-ACK (port open) → Scanner
Scanner → RST (tear down) → Target
Result: never completes (stealthier, faster)
nmap -sS 192.168.1.0/24Fast & stealthy, but crafts raw packets — needs root, and can be blocked by firewalls watching for the SYN-without-completion pattern.
Analogy: A full connect scan is like walking into a store, browsing, and checking out at the register (fully logged). A SYN scan is like opening the door, peeking in, and walking away before the bell even finishes ringing.
Three ways to probe a port
| Flag | Type | How | Trade-off |
|---|---|---|---|
-sS | SYN scan (half-open) | SYN → read reply → RST, never completes | Fast & stealthy; needs root; default when privileged |
-sT | Connect scan (full) | Completes SYN/SYN-ACK/ACK | Easily logged; works unprivileged (fallback without root) |
-sU | UDP scan (connectionless) | Fires UDP, infers from silence | Slow & ambiguous; finds overlooked services (DNS/SNMP/NTP) |
Version detection — where recon becomes an exploit
A plain scan says "something's on port 80." Version detection says "Apache 2.4.49" — and a specific version is a specific, searchable list of known vulnerabilities.
$ nmap -sV -p 21,22,80 10.10.2.244
PORT STATE SERVICE VERSION
21/tcp open ftp vsftpd 3.0.3
22/tcp open ssh OpenSSH 7.2p2
80/tcp open http Apache 2.4.49That one line, weaponised (the chain to know cold):
Apache 2.4.49— the version string from the scan- Search CVE / Exploit-DB → "Apache 2.4.49 vulnerability"
- → CVE-2021-41773 — path traversal, RCE when CGI enabled
- → A working, targeted exploit
Trade-off:
-sVhas a fuller conversation with each service, so it's noisier — but accurate versioning turns a vague hope into a targeted attack. Worth the visibility.
OS fingerprinting — a strong hint, not gospel
$ nmap -O 10.10.2.244
Running: Microsoft Windows 10|11
OS CPE: cpe:/o:microsoft:windows_10
Aggressive OS guesses:
Windows 10 (92%), Win11 (87%)How it works: reads TCP/IP stack quirks → times responses & inspects defaults/edge cases → matches a signature DB → narrows exploit choices.
Note the percentages — Nmap infers, doesn't confirm. Use it to focus effort; never bet everything on a fingerprint being exactly right.
Analogy: OS fingerprinting is like identifying a car's make from a blurry tire-tread photo — a confident guess (92% Toyota), not a VIN check.
NSE — the Nmap Scripting Engine
What turns Nmap from a port scanner into a reconnaissance framework: hundreds of scripts encoding known attack logic.
nmap --script vuln target # run vulnerability scripts
ls /usr/share/nmap/scripts/ # 600+ .nse scripts live here
ls /usr/share/nmap/scripts/*vuln* # narrow to vuln scripts
ls /usr/share/nmap/scripts | grep smb # search by service name| What NSE does |
|---|
| Encodes known attack logic — checks a researcher would run, packaged |
| Automates enumeration — hours of manual checks in one command |
| Reduces manual effort — hundreds of researchers' knowledge, reused |
| Scales your capability — sophisticated checks, invoked instantly |
NSE done right — Discover, THEN target (guaranteed exam concept)
You almost never run
--script vulnblindly against everything — it's slow, deafeningly noisy, and mostly wasted. The professional approach is two deliberate steps:
1. Identify services first:
nmap -sT -sV 10.10.2.2442. Target only what you found:
nmap -p445 --script smb-vuln* # found SMB on 445?
nmap -p80,443 --script http-vuln* # found HTTP on 80/443?Discover then target: blind scanning is loud and lazy; targeted scanning is surgical. Always work in these two steps.
Evasion — shaping the signal, not vanishing
Evasion alters timing and structure to blend in, because it's patterns that trigger detection, not individual packets.
| Flag | What it does |
|---|---|
-T2 (polite timing) | Deliberately slows the scan — rapid bursts are exactly what IDS is tuned to catch; spreading probes over time reduces the pattern's visibility |
-Pn (skip host discovery) | Skips the initial ping — useful when a host blocks pings, or to reduce footprint by assuming the host is up |
nmap -T2 -Pn targetA single probe is unremarkable. A thousand in quick succession is a screaming signature. Nmap produces information, not answers — the interpretation is always yours, and not every open port matters.
4. From Discovery to Exploitation
Where scanning fits — MITRE ATT&CK
The industry-standard catalogue of adversary tactics, read left→right as an intrusion's life story. Key point: scanning appears TWICE.
| Recon | Initial Access | Execution | Persistence | Priv. Esc. | Cred. Access | Discovery + Lateral | Collection | Exfil |
|---|---|---|---|---|---|---|---|---|
| OSINT | phishing | run code | autostart | exploit | Mimikatz | scanning | stage data | covert channel |
| scanning | public app | scripts | accounts | tokens | hashes | pivot | ||
| fingerprint | SMB |
Defence Evasion runs throughout — hiding from defenders at every stage. **Scanning appears twice:**external recon at the start, and internal Discovery & Lateral Movement after a foothold. Recon isn't a one-time step — it threads through the whole attack.
The discovery workflow (a cycle, not a one-time step)
Live hosts (who's reachable?) → Exposed services (what ports/apps?)
→ Weaknesses (versions, anomalies) → Prioritise paths (where to attack)
↳ repeat as access expands: discovery continues after every new foothold
Attacker mindset: attackers aren't impressed by what's expected — they hunt for what stands OUT. An unexpected service, outdated software, or a management interface in the wrong context signals a misconfiguration or forgotten system.
Discovery → exploitation chain
- Extract banners & versions (from
-sV/banner grabbing) - Map to known vulnerabilities (e.g. "Apache 2.4.49" → what's it known to be vulnerable to?)
- Search CVE & Exploit-DB
- Prefer reliable, low-effort paths — favour exploits likely to work without crashing the target
Exploitation follows prioritisation. You don't attack everything or in random order — prioritise by impact, reliability, and effort, then strike best-target-first.
Internal discovery — the real payoff (perimeter defense alone is never enough)
| From outside the perimeter | Once you're inside |
|---|---|
| A small, hard surface — only exposed, hardened public services | Far more exposed services — everything behind NAT is now reachable |
| Heavy filtering — firewall drops most of what you try | Fewer controls — the soft interior is often lightly monitored |
| Low trust — nothing internal trusts your connection | Trust breaks down — internal systems trust each other, and you inherit it |
| Lateral movement opens up — move host to host toward the real objective |
This is exactly why "assume breach" is the modern defensive mindset.
Interpreting banners, versions & fingerprints
A banner is what a service announces when you connect — often before authentication, and never intended as a security feature. Each one is a direct lead to an exploit.
$ nmap -sV -p 21,22,80 10.10.2.244
PORT STATE SERVICE VERSION
21/tcp open ftp vsftpd 3.0.3 -> search: vsftpd 3.0.3 CVE
22/tcp open ssh OpenSSH 7.2p2 Ubuntu -> dated build, check advisories
80/tcp open http Apache 2.4.49 -> CVE-2021-41773 path traversal!For defenders: reducing banner leakage is a real, concrete hardening step.
OpenVAS / GVM — automated scanning
Where Nmap is a precision instrument you drive by hand, OpenVAS (now GVM) is a comprehensive automated scanner, checking a target against a huge vulnerability database and producing a full report.
- "OpenVAS is now GVM" — the framework is GVM; "OpenVAS" is the scanner engine inside it. Package:
gvm - Record the admin password —
gvm-setupprints an auto-generated one that flies past quickly - Web UI on port 9392 —
https://localhost:9392(usernameadmin) - Be patient — setup downloads a massive vulnerability feed
Web workflow, end to end:
- Create a target — Configuration > Targets > New Target (point at your lab machine)
- Create a scan task — Scans > Tasks > New Task, name it, choose "Full and Fast" config, set target
- Run it — Scans > Tasks, click play. Probes the target against the entire vuln database
- Open the report — vulnerabilities listed, each rated by severity; click any for details/remediation
The payoff: the automated tool does, at scale, the same discover-then-assess workflow you learned by hand with Nmap.
Scanning services on the internet (legitimate authorized targets)
http://scanme.nmap.org/— Fyodor's officially authorized public Nmap test target- Bug bounties — check the conditions carefully
- VulnHub — download vulnerable VMs to scan locally
- Hack The Box, TryHackMe — VPN in; you're on the same LAN as the target, so scanning is in-scope
5. 🖥️ LAB SECTION — Week 3 Workshop: Active Reconnaissance with Nmap
Goal: Take a target from unknown → mapped → assessed — the core loop of active reconnaissance, using one tool (Nmap) from three angles: host discovery, service/version identification, and NSE-based deeper investigation.
The most important skill is not memorising flags — it's learning to ask the tool what it can do. Use
nmap -hfor a quick option summary,man nmapfor the full manual, and/insidemanto search (thenn/Nto step forward/backward through matches).
⚠️ Scope & authorization: Only scan machines in the isolated lab environment. Active scanning sends real traffic that arrives at the target, is logged, and is detectable. Scanning anything you don't own or lack explicit permission for — including the university network, cloud servers, or any public-internet address — is a serious matter: it can be illegal, disrupt the target, and breach the course's conduct expectations. If unsure whether something is in scope, it is not — ask first. Prefer the least aggressive scan that answers your question, even inside the lab.
Exercise 1 — Discover which hosts are alive
Goal: Produce a list of live hosts in the lab subnet — host discovery only, no port scanning yet.
What to find via help: the option for host-discovery-only (a "ping scan" / disables port scan) — under the HOST DISCOVERY section of nmap -h; how to express a CIDR range as target; optional verbosity flag to watch progress.
nmap -sn 10.10.96.0/20
-sndisables port scanning after host discovery — you get a list of "up" hosts without probing any ports.
Worked example (from an actual run):
- Swept all 4095 addresses in an authorised
/20lab block using an ARP ping scan - Several hosts responded as up; many others returned
[host down], confirming most of the block is unused address space - Why host discovery first? It focuses effort — no point running a detailed port/service scan against addresses that aren't even in use. A quick sweep narrows a whole subnet down to a short, concrete list of worthwhile targets.
Report checklist:
- Screenshot of command + output showing hosts discovered as up
- 2–3 sentences: how many live hosts found, which option kept it to host-discovery-only, and why finding live hosts before port scanning is sensible
Exercise 2 — Identify open ports and their services
Goal: Choose one live host; find open ports; identify service and version as precisely as possible. End with a small table: port | service | version.
What to find via help: the service/version-detection option (SERVICE/VERSION DETECTION section); the different TCP scan types (which needs root, which doesn't); optional port-restriction flag for quick re-scans.
# Plain scan: ports only, no detail
sudo nmap 10.10.96.19
# Service + version detection
sudo nmap -sV 10.10.96.19Run a plain scan first, then a
-sVscan, and compare — seeing the difference between the two outputs is the point of the exercise.
Worked example — actual results table:
| Port | Service | Version | Notes |
|---|---|---|---|
| 135/tcp | msrpc | — | Microsoft RPC endpoint mapper |
| 139/tcp | netbios-ssn | — | NetBIOS Session Service |
| 445/tcp | microsoft-ds | — | SMB over TCP |
| 5800/tcp | vnc-http | TightVNC | Banner leaked username master-3202 |
| 5900/tcp | vnc | VNC (protocol 3.8) |
Nmap also reported the target's MAC address, identifying it as an ASUSTek device — confirming the scan reaches a real NIC, not just a router/filter.
⚠️ Worked interpretation (exactly the kind of reasoning the instructor tests):
A plain scan on port 5800 only says "something's listening." The
-sVscan reveals it's specifically TightVNCand — critically — leaks a username (master-3202) directly in the connection banner. An attacker now has an immediate starting point: search known TightVNC vulnerabilities for that build, or attempt to brute-force/guess a password for the disclosed account — rather than blindly guessing what remote-access software is running. The open port says a door exists; the version and banner tell you what kind of lock is on it, and in this case, who might hold the key.
Report checklist:
- Screenshot: open ports + service/version info
- Port/service/version summary table
- A few sentences: pick one service+version, explain what an attacker would do next and why the _exact version_matters more than just "port is open"
Exercise 3 — Investigate a service with the Nmap Scripting Engine (NSE)
Goal: Use NSE to learn more about ONE service from Exercise 2. Explore the script library first, then run a small, relevant set — not everything.
What to find via help: the option that invokes scripts (accepts a script name or a whole category); explore /usr/share/nmap/scripts/ on disk and filter by service name; understand script categories (default, safe, vuln); combine with -p to target the single relevant port.
# Explore: filter the script library for your service
ls /usr/share/nmap/scripts/ | grep smb
# Run a small, targeted set of scripts against just the relevant port
sudo nmap -p445 --script smb-os-discovery,smb-protocols,smb-security-mode 10.10.96.19Worked example — why these specific scripts:
- SMB (port 445) chosen — most information-dense service found, and a classic high-value target for lateral movement in Windows environments
smb-os-discovery— reveals OS build & computer namesmb-protocols— lists supported SMB dialectssmb-security-mode— reveals whether SMB signing is required- All three are
safe+defaultcategory — they passively gather extra detail without testing for or exploiting any weakness, appropriate for an authorised lab target
⚠️ Worked troubleshooting example — a genuinely instructive failure:
On a re-run, Nmap's default ping probe reported the host as seemingly down ("blocking our ping probes") — resolved with
-Pnto skip host discovery and treat the host as up. But then port 445 came back **filtered**instead ofopen(as it was in Exercise 2). No scripts returned output against a filtered port. Most likely explanation: the target's state changed between exercises (firewall toggled, host reconfigured) — plausible since this was a shared lab host outside the author's control.This directly illustrates the lecture's core point: a filtered port produces no response, and no response is not evidence of "closed" — it's fundamentally ambiguous (could be firewall dropping the probe, or inconsistent service behavior; from one probe you can't tell). It's also a concrete demonstration that active recon results are a snapshot in time, not a permanent fact — host defences can change between one scan and the next. The professional response is to note the ambiguity honestly, not assume a definite state.
Report checklist:
- Screenshot of how you explored/listed available scripts for your service
- Screenshot of the script run + its output
- A few sentences: which script/category chosen and why relevant; what the output told you that a plain port+version scan didn't; one sentence on why a small, targeted script set beats running everything
What good work looks like (grading criteria — worth internalizing)
- Each exercise shows: the command run, the output, and a short explanation in your own words
- State which option you found/used for each task — show you worked it out from the tool's help, not memorized it
- Thoughtful interpretation — marks reward understanding and method, not sheer volume of results. A small, well-explained set of findings beats a huge, unexplained dump.
What to submit
- One PDF to Google Classroom, containing screenshots + short supporting text for all 3 exercises, in order
- Name + student ID at the top
- Nothing else — no exported scan files, no separate logs
Additional lab reference — SYN scan before/after defences (in-class demo)
- Lower target's defences (lab only) — turn OFF Windows Firewall (both locations) and disable real-time/virus protection
- Start a service to find:
python -m http.server 443 - Scan from Kali:
nmap -sS <target-ip>— port should show open - Re-enable firewall, re-scan:
nmap -sS <target-ip>— watch ports shift tofiltered. (Are some still open? Why?)
GVM/OpenVAS setup reference
sudo gvm-start
# opens browser at 127.0.0.1:9392/login — username: admin, password: newpass
sudo greenbone-feed-sync # update vulnerability feedTroubleshooting (if admin setting is lost — "Feed Import Owner" error):
sudo runuser -u postgres -- psql gvmd -c \
"SELECT value FROM settings WHERE uuid = '78eceaec-3385-11ea-b237-28d24461215b';"
# if it returns 0:
sudo runuser -u _gvm -- gvmd --get-users --verbose
# returns e.g.: admin b544a23b-7a32-42f0-a190-6d26cc46a0a3
sudo runuser -u _gvm -- gvmd --modify-setting 78eceaec-3385-11ea-b237-28d24461215b \
--value b544a23b-7a32-42f0-a190-6d26cc46a0a36. Rapid-Fire Recall Table (Last-Minute Review)
| Concept | One-liner |
|---|---|
| LAN vs WAN goal | WAN recon finds the door (entry); LAN recon (after pivot) finds the impact |
| Private IP ranges | 10.0.0.0/8, 172.16.0.0–172.31.255.255, 192.168.0.0/16 |
| NAT/PAT | Many hosts, one public IP — distinguished by port; external scans see only the router |
| Socket address | IP:port = which host : which service |
| TCP vs UDP scanning | TCP = predictable, clear states; UDP = ambiguous, silence ≠ closed |
| Scan result logic | SYN-ACK=open, RST=closed, no reply/ICMP=filtered (ambiguous) |
| No response means | Uncertain, not closed — could be filtered OR open-but-quiet |
| UDP silent port | Nmap's honest label: open|filtered = unknown |
| Active vs Passive | Active = direct contact, detectable, confirmed data; Passive = no contact, invisible, inference only |
-sS | SYN/half-open scan — fast, stealthy, needs root, default when privileged |
-sT | Full connect scan — logged, works unprivileged |
-sU | UDP scan — slow, ambiguous, finds overlooked services |
-sV | Service/version detection — turns "port open" into "exact exploitable software" |
-O | OS fingerprinting — probabilistic, a lead not a certainty |
-sn | Host discovery only, no port scan |
-Pn | Skip host discovery (evasion / bypass ping-blocking) |
-T2 | Polite/slow timing (evasion) |
--script | Invoke NSE scripts — by name or category |
| NSE best practice | Discover first (-sV), then target specific scripts to the specific port/service found |
| Script categories | default, safe, vuln — know the difference; vuln scripts actively test/exploit |
| MITRE ATT&CK + scanning | Scanning appears twice: initial Recon, and again in Discovery/Lateral Movement after a foothold |
| Port scanning legality | Not inherently illegal — but authorization is the separate, deciding question |
| VPN + local scanning | Encrypts content/destination, but local AP still sees your real MAC |
| GVM/OpenVAS | Automated vuln scanner; web UI on port 9392; "OpenVAS" = engine inside the GVM framework |