This is the capstone lesson of our course, where we bring together everything you have learned โ the OSI model, TCP/IP, port concepts, and packet analysis โ into one powerful, practical skill: network scanning with Nmap. Nmap (Network Mapper) is the most important tool in any penetration tester's toolkit. It is used for host discovery, port scanning, service detection, OS fingerprinting, and scripting. By the end of this lesson, you will be able to conduct a full network reconnaissance engagement.
Before you can scan ports, you need to know which hosts are alive. Nmap offers several host discovery techniques, each with different strengths and stealth characteristics.
Nmap supports multiple scan types, each exploiting different aspects of the TCP/IP stack. Choosing the right scan is a trade-off between speed, stealth, and reliability.
| Scan Type | Flag | Description | Stealth Level |
|---|---|---|---|
| SYN Scan | -sS | Half-open scan. Sends SYN, reads response, never completes handshake. Default for root. | High โ no full connection logged |
| TCP Connect | -sT | Completes full three-way handshake. Default for non-root users. | Low โ full connection logged by target |
| UDP Scan | -sU | Sends UDP probes. Slow but finds DNS, SNMP, TFTP, etc. | Medium โ UDP is stateless |
| FIN Scan | -sF | Sends FIN packet. Bypasses stateless firewalls that only block SYN. | High โ unusual traffic pattern |
| XMAS Scan | -sX | Sends FIN+PSH+URG flags (like a Christmas tree). Stealthy. | High โ easily detected by modern IDS |
| NULL Scan | -sN | Sends packet with no flags set. Stealthy bypass technique. | High โ easily detected by modern IDS |
| ACK Scan | -sA | Sends ACK to map firewall rulesets, not find open ports. | N/A โ used for firewall mapping |
| Idle Scan | -sI | Uses a zombie host to scan anonymously. Your IP never touches the target. | Very High โ truly anonymous |
Once you find open ports, you need to know what services are running and what operating system the target uses. Nmap's service version detection and OS fingerprinting are incredibly powerful.
๐ก The -p- flag scans all 65,535 ports. Without it, Nmap only scans the top 1,000 most common ports. Many services run on non-standard ports, so a full scan is essential for thorough reconnaissance.
Nmap's scripting engine is what transforms it from a scanner into a full reconnaissance and exploitation platform. NSE scripts can enumerate services, detect vulnerabilities, brute-force credentials, and even exploit weaknesses.
Modern networks have firewalls and intrusion detection systems. Nmap includes several options to evade these defenses:
โ ๏ธ Evasion techniques should only be used during authorized penetration tests with explicit permission. Using decoys (-D) against unauthorized targets can cause innocent parties to receive abuse complaints. Spoofing source addresses (-S) is illegal in many jurisdictions.
Here is a complete reconnaissance workflow that combines everything from this course into a professional engagement:
# Step 1: Host Discovery
nmap -sn -PS22,80,443 -PA80,443 -PE -oA host_discovery 10.10.10.0/24
# Step 2: Quick port scan on discovered hosts
nmap -sS --top-ports 1000 -T4 --open -oA quick_scan 10.10.10.5
# Step 3: Full port scan on interesting hosts
nmap -sS -p- -T4 --open -oA full_ports 10.10.10.5
# Step 4: Service version detection on open ports
nmap -sV -sC -p 22,80,443,3306 -oA service_scan 10.10.10.5
# Step 5: OS detection and traceroute
nmap -O --traceroute -p 22,80,443 -oA os_scan 10.10.10.5
# Step 6: Vulnerability scanning with NSE
nmap --script vuln -p 22,80,443,3306 -oA vuln_scan 10.10.10.5
# Step 7: Capture traffic during scanning for analysis
sudo tcpdump -i eth0 -w scan_traffic.pcap host 10.10.10.5Congratulations! You have completed Networking Fundamentals for Hackers. You now understand the OSI model, TCP/IP protocols, IP addressing, DNS, ARP, packet analysis with Wireshark, and network scanning with Nmap. These skills form the foundation for every advanced topic in offensive security โ from exploitation to post-exploitation to red teaming. Continue practicing in your lab, on CTF platforms, and through certification study (CEH, OSCP, PNPT) to build on this foundation.
Verify exercises to earn โ 200 XP and unlock next lab level.