Nmap

Network Mapper

The Art of Network Reconnaissance

Cybersecurity Seminar | 1st Year

2026

01

Agenda

๐ŸŒ

Networking Basics

IP, Ports, Protocols

๐Ÿ”„

TCP vs UDP

Transport Protocols

๐Ÿงญ

Introduction to Nmap

What & Why

๐Ÿ”

Scanning Techniques

Types & Methods

โšก

Advanced Features

Scripts & Evasion

๐ŸŽฏ

Live Demo

Practical Examples

02

What is a Network?

A network is a collection of computers and devices connected together to share resources and communicate.

๐Ÿ 

LAN

Local Area Network

Small area like home or office

๐Ÿ’ป โ”โ”โ” ๐Ÿ“ถ โ”โ”โ” ๐Ÿ–ฅ๏ธ

How LAN Works

Devices connect to a central router/switch within a small area (home/office). Data travels at high speed (100Mbps - 10Gbps) through Ethernet cables or WiFi.

Example: Your home WiFi network
๐ŸŒ

WAN

Wide Area Network

Large area - cities, countries

๐Ÿข ๐ŸŒ ๐Ÿข

How WAN Works

Connects multiple LANs across cities/countries using ISP infrastructure, fiber optics, and satellites. The Internet is the largest WAN!

Example: Internet, Corporate networks
๐Ÿ™๏ธ

MAN

Metropolitan Area Network

City-wide coverage

๐Ÿ›๏ธ ใ€ฐ๏ธใ€ฐ๏ธใ€ฐ๏ธ ๐Ÿฅ

How MAN Works

Spans a city using high-speed fiber optic connections. Used by universities, hospitals, and government buildings in a metropolitan area.

Example: City cable TV network
03

IP Address

An IP Address is a unique numerical label assigned to every device on a network.

IPv4

Most Common
192.168.1.1
  • 4 octets (0-255 each)
  • ~4.3 billion addresses
  • 32-bit address
VS

IPv6

Future
2001:0db8:85a3::7334
  • 8 groups of hexadecimal
  • 340 undecillion addresses
  • 128-bit address
๐Ÿ’ก

Analogy: IP address is like your home address - it tells where you live on the internet.

04

What is a Port?

Server (IP: 192.168.1.1)
๐Ÿšช Port 80 HTTP
๐Ÿšช Port 443 HTTPS
๐Ÿšช Port 22 SSH
๐Ÿšช Port 21 FTP

Port = Virtual Door

Ports identify which application should receive the incoming data.

0-1023 Well-Known
1024-49151 Registered
49152-65535 Dynamic
05

Important Ports to Know

20/21
FTP
File Transfer
๐Ÿ’ป๐Ÿ“„โžก๏ธ๐Ÿ–ฅ๏ธ

File Transfer Protocol

Port 20: Data transfer
Port 21: Control commands

Client connects โ†’ Authenticates โ†’ Uploads/Downloads files

โš ๏ธ Not encrypted! Use SFTP instead
22
SSH
Secure Shell
๐Ÿ‘ค๐Ÿ”โ”โ”โ”๐Ÿ–ฅ๏ธ

Secure Shell

Encrypted remote terminal access

All data is encrypted using public-key cryptography

โœ… Secure - Replaced Telnet
23
Telnet
Remote Login
๐Ÿ‘คโ”โ”โ”๐Ÿ–ฅ๏ธ

Teletype Network

Old protocol for remote login

Sends data in PLAIN TEXT - anyone can read!

โš ๏ธ INSECURE! Never use on internet
25
SMTP
Send Email
๐Ÿ“งโžก๏ธโžก๏ธโžก๏ธ๐Ÿ“ฌ

Simple Mail Transfer Protocol

Used to SEND emails between servers

Your email client โ†’ SMTP server โ†’ Recipient's server

Like postal service for email!
53
DNS
Domain Names
google.comโžก๏ธ142.250.x.x

Domain Name System

Translates domain names to IP addresses

Browser asks: "What's google.com's IP?" โ†’ DNS replies with IP

๐Ÿ“ž Phone book of the internet!
80
HTTP
Web Traffic
๐ŸŒGET /page๐Ÿ“„

HyperText Transfer Protocol

Standard web browsing protocol

Browser sends request โ†’ Server sends webpage

โš ๏ธ Not encrypted - use HTTPS
110
POP3
Receive Email
๐Ÿ“ฌโฌ‡๏ธ๐Ÿ’ป

Post Office Protocol v3

Downloads emails to your device

Connects โ†’ Downloads all emails โ†’ Deletes from server

Emails stored locally on device
443
HTTPS
Secure Web
๐ŸŒ๐Ÿ”’โ”โ”โ”๐Ÿ“„

HTTP + SSL/TLS Encryption

Encrypted web browsing

All data encrypted with TLS certificate

โœ… Look for ๐Ÿ”’ in browser URL!
3306
MySQL
Database
๐Ÿ–ฅ๏ธSQLโ†’๐Ÿ—„๏ธ

MySQL Database Server

Relational database management

App sends SQL query โ†’ MySQL returns data

โš ๏ธ Should NOT be exposed to internet!
3389
RDP
Remote Desktop
๐Ÿ’ป๐Ÿ–ผ๏ธโžก๏ธ๐Ÿ–ฅ๏ธ

Remote Desktop Protocol

Windows remote GUI access

See & control another computer's desktop remotely

โš ๏ธ Common attack target - use VPN!
06

What is a Protocol?

A protocol is a set of rules that define how data is transmitted and received over a network.

๐Ÿ“ž Like a Phone Call

Dial Number
โ†’
Ring
โ†’
Hello!
โ†’
Talk
โ†’
Bye
โ†’
Hang Up
HTTP/HTTPS Web Browsing
FTP/SFTP File Transfer
SMTP/POP3 Email
DNS Name Resolution
07

OSI Model - 7 Layers

7 Application HTTP, FTP, DNS
๐ŸŒ

Application Layer

What users interact with directly - web browsers, email clients, etc.

๐Ÿ“ง Email app, ๐ŸŒ Chrome browser, ๐Ÿ“ FTP client
6 Presentation SSL, Encryption
๐Ÿ”

Presentation Layer

Translates data format, encryption, compression. Makes data readable.

JPEGโ†’Image, MP3โ†’Audio, SSLโ†’Encryption
5 Session Authentication
๐Ÿค

Session Layer

Manages connections - opens, maintains, closes sessions between apps.

Login sessions, Video call connections
4 Transport TCP, UDP
๐Ÿšš

Transport Layer

Ensures reliable data delivery. TCP = reliable, UDP = fast.

TCP: Web, Email | UDP: Gaming, Streaming
3 Network IP, ICMP
๐Ÿ—บ๏ธ

Network Layer

Routes packets between networks using IP addresses. Finds best path.

Routers work here! IP addressing & routing
2 Data Link MAC, Ethernet
๐Ÿ”—

Data Link Layer

Transfers data between adjacent nodes using MAC addresses.

Switches, MAC addresses, Ethernet frames
1 Physical Cables, WiFi
๐Ÿ”Œ

Physical Layer

Actual hardware - cables, signals, bits (0s and 1s).

Ethernet cables, WiFi radio waves, Fiber optics

Remember: "All People Seem To Need Data Processing"

08

TCP - Transmission Control Protocol

Connection-Oriented | Reliable

๐Ÿค 3-Way Handshake

๐Ÿ’ป
Client
SYN "Can we connect?"
SYN-ACK "Yes, ready!"
ACK "Let's start!"
๐Ÿ–ฅ๏ธ
Server
โœ… Reliable - Guarantees delivery
โœ… Ordered - Data arrives in sequence
โœ… Error checking - Detects corruption
โŒ Slower - Due to overhead
09

UDP - User Datagram Protocol

Connectionless | Fast

โšก Fire and Forget

๐Ÿ’ป
Client
๐Ÿ“ฆ Data โ†’
๐Ÿ“ฆ Data โ†’
๐Ÿ“ฆ Data โ†’
No confirmation needed!
๐Ÿ–ฅ๏ธ
Server
โœ… Fast - No handshake
โœ… Low latency - Real-time
โŒ Unreliable - No guarantee
โŒ Unordered - May arrive shuffled
๐ŸŽฎ Gaming ๐Ÿ“น Video Streaming ๐Ÿ“ž VoIP Calls ๐Ÿ” DNS
10

TCP vs UDP

Feature
TCP
UDP
Connection
Connection-oriented
Connectionless
Reliability
Guaranteed โœ…
Best effort โš ๏ธ
Speed
Slower ๐Ÿข
Faster ๐Ÿš€
Order
Maintained
Not guaranteed
Header Size
20-60 bytes
8 bytes
Use Case
Web, Email, Files
Streaming, Gaming
๐Ÿ“ฌ

TCP = Registered Post

Confirmation required
๐Ÿ“จ

UDP = Regular Post

Just send and hope
11

What is Nmap?

๐Ÿงญ

Network Mapper

Free, open-source tool for network exploration and security auditing

๐Ÿ” Discover Live Hosts
๐Ÿšช Find Open Ports
๐Ÿ”ง Detect Services
๐Ÿ’ป Identify OS
๐Ÿ›ก๏ธ Find Vulnerabilities
๐Ÿ“œ Run Scripts

"The #1 tool used in the reconnaissance phase of penetration testing"

12

Understanding Nmap

๐Ÿข Think of a Server as a Building
๐Ÿšช Port 80 OPEN
๐Ÿšช Port 22 CLOSED
๐Ÿšช Port 443 FILTERED
๐Ÿ”

Nmap = Security Guard

Knocks on every door to check:

  • Is the door open? ๐Ÿšช
  • Who's inside? (Service) ๐Ÿ‘ค
  • What version? ๐Ÿ“‹
๐Ÿคซ SYN Scan Quiet Knock
๐Ÿ“ข Aggressive Scan Loud + Thorough
13

Installation

๐Ÿง

Linux

sudo apt install nmap -y Ubuntu/Debian ๐Ÿ“‹
sudo yum install nmap -y CentOS/RHEL ๐Ÿ“‹
๐ŸชŸ

Windows

๐ŸŽ

macOS

brew install nmap Homebrew ๐Ÿ“‹

Verify Installation:

nmap --version ๐Ÿ“‹
14

Basic Scanning

Scan a Domain
nmap example.com
Scans top 1000 common ports
Scan an IP
nmap 192.168.1.1
Direct IP scanning
Verbose Mode
nmap -v target
Show detailed progress
Multiple Targets
nmap 192.168.1.1-50
Scan IP range
Subnet Scan
nmap 192.168.1.0/24
Scan entire network
From File
nmap -iL targets.txt
Read targets from file
15

Scan Types

๐Ÿฅท

SYN Scan

nmap -sS target

Stealth scan - doesn't complete handshake

Default โ€ข Fast โ€ข Stealthy

๐Ÿฅท How SYN Scan Works

1 Send SYN packet
โ†“
2 Receive SYN-ACK (port open)
โ†“
3 Send RST (reset) - DON'T complete!

โœจ Why Stealth? Connection never fully established, so it's often not logged by target system!

๐Ÿ’ป SYNโ†’ โ†SYN-ACK RSTโ†’ ๐Ÿ–ฅ๏ธ
๐Ÿค

TCP Connect

nmap -sT target

Full TCP handshake - no root needed

Reliable โ€ข Detectable

๐Ÿค How TCP Connect Works

1 Send SYN packet
โ†“
2 Receive SYN-ACK
โ†“
3 Send ACK - Connection COMPLETE!

โš ๏ธ Downside: Full connection = gets logged! But works without root/admin privileges.

๐Ÿ’ป SYNโ†’ โ†SYN-ACK ACKโ†’ โœ… ๐Ÿ–ฅ๏ธ
๐Ÿ“ก

UDP Scan

nmap -sU target

Scan UDP ports - slower process

DNS โ€ข DHCP โ€ข SNMP

๐Ÿ“ก How UDP Scan Works

1 Send empty UDP packet
โ†“
2 No response = OPEN|FILTERED
โ†“
3 ICMP unreachable = CLOSED

๐Ÿข Why Slow? UDP has no acknowledgment, so Nmap must wait for timeout on each port!

๐Ÿ’ป UDPโ†’ โ†(silence?) ๐Ÿค” ๐Ÿ–ฅ๏ธ
๐Ÿ“

Ping Scan

nmap -sn target

Check if host is alive - no port scan

Fast โ€ข Discovery

๐Ÿ“ How Ping Scan Works

1 Send ICMP Echo Request
โ†“
2 + TCP SYN to port 443
โ†“
3 + TCP ACK to port 80

๐Ÿš€ Use Case: Quickly find all live hosts in a network before detailed scanning!

๐Ÿ’ป PINGโ†’ โ†PONG ๐ŸŸข Alive! ๐Ÿ–ฅ๏ธ
๐Ÿงฑ

ACK Scan

nmap -sA target

Detect firewall rules

Firewall Testing

๐Ÿงฑ How ACK Scan Works

1 Send ACK packet (no SYN first!)
โ†“
2 RST response = Unfiltered
โ†“
3 No response = Filtered by firewall

๐Ÿ” Purpose: NOT to find open ports, but to MAP firewall rules!

๐Ÿ’ป ACKโ†’ ๐Ÿงฑ Firewall? โ†RST ๐Ÿ–ฅ๏ธ
16

Port Scanning Options

nmap -p 22 target
Single port
nmap -p 22,80,443 target
Multiple specific ports
nmap -p 1-1000 target
Port range
nmap -p- target
All 65535 ports
nmap --top-ports 100 target
Top 100 most common
nmap -F target
Fast scan (top 100)
๐Ÿ’ก

Tip: Use -F for quick scans, -p- for thorough analysis

17

Service & OS Detection

๐Ÿ”ง

Service Detection

nmap -sV target

Detects:

  • Apache 2.4.41
  • OpenSSH 8.2
  • MySQL 5.7
๐Ÿ’ป

OS Detection

sudo nmap -O target

Detects:

  • Windows 10/11
  • Ubuntu 22.04
  • macOS Ventura
๐Ÿ”ฅ

Aggressive Scan

sudo nmap -A target

Includes:

  • OS Detection
  • Version Detection
  • Script Scanning
  • Traceroute
18

Nmap Scripting Engine (NSE)

NSE allows running powerful scripts for advanced scanning and vulnerability detection

nmap -sC target Default scripts
nmap --script=vuln target Vulnerability scan
nmap --script=http-title target Specific script

Script Categories

auth Authentication
brute Password cracking
vuln Vulnerabilities
exploit Exploitation
discovery Information
default Safe & useful
19

Firewall Evasion Techniques

๐Ÿ“ฆ

Fragment Packets

nmap -f target

Split packets to bypass filters

๐Ÿ“ฆ โ†’ ๐Ÿ“„๐Ÿ“„๐Ÿ“„

How Fragmentation Works

Splits packets into tiny 8-byte pieces. Simple firewalls can't reassemble them to inspect!

Big Packet โ†’ Tiny Pieces โ†’ Bypass Firewall
๐Ÿ‘ฅ

Decoy Scan

nmap -D RND:5 target

Hide among fake IPs

๐ŸŽฏ You ๐Ÿ‘ค๐Ÿ‘ค๐Ÿ‘ค๐Ÿ‘ค๐Ÿ‘ค

How Decoy Works

Sends scan packets from multiple fake IP addresses along with your real one!

5 Fake IPs + Your IP = Who's real? ๐Ÿคท
๐ŸŽญ

Spoof MAC

nmap --spoof-mac 0 target

Randomize MAC address

AA:BB:CC:DD:EE:FF โ†’ ??:??:??:??:??:??

How MAC Spoofing Works

Changes your hardware address to random or specific vendor (Apple, Cisco, etc.)

0 = Random | Apple = Apple MAC
โฑ๏ธ

Timing Control

nmap -T0 target

Slow down to avoid detection

๐Ÿš€ T5 ... ๐Ÿข T0

How Timing Works

T0 sends one packet every 5 minutes! IDS can't detect patterns in such slow scans.

Slower = More Stealthy = Takes Hours!

Timing Templates

T0
Paranoid
T1
Sneaky
T2
Polite
T3
Normal
T4
Aggressive
T5
Insane
๐Ÿข Slower ๐Ÿš€ Faster
20

Output Options

๐Ÿ“„

Normal Output

nmap target -oN scan.txt

Human-readable text file

๐Ÿ“Š

XML Output

nmap target -oX scan.xml

For tools & parsing

๐Ÿ”

Grepable

nmap target -oG scan.gnmap

Easy to grep/search

๐Ÿ“

All Formats

nmap target -oA results

Creates .nmap, .xml, .gnmap

21

Quick Reference Cheat Sheet

๐ŸŽฏ Target

nmap target Single
nmap 1.1.1.1-50 Range
nmap 1.1.1.0/24 Subnet
nmap -iL file.txt From file

๐Ÿ” Scan Type

-sS SYN (stealth)
-sT TCP connect
-sU UDP scan
-sn Ping scan

๐Ÿ”ข Ports

-p 22 Single
-p 1-1000 Range
-p- All ports
-F Fast (top 100)

๐Ÿ”ง Detection

-sV Service version
-O OS detection
-A Aggressive
-sC Default scripts
22

Practice Commands

๐ŸŽฏ Official Practice Target

scanme.nmap.org

Nmap's official test server - safe to scan!

๐ŸŸข Beginner nmap scanme.nmap.org
๐ŸŸก Intermediate nmap -sV -sC scanme.nmap.org
๐Ÿ”ด Advanced nmap -A -T4 scanme.nmap.org
24

Thank You!

Questions?

๐Ÿ“– nmap.org/book
๐ŸŽฏ scanme.nmap.org
๐Ÿ”ฌ tryhackme.com

"Knowledge is power. Use it responsibly."

25