What is Nmap?

Nmap (Network Mapper) is a free, open-source tool used for network discovery, port scanning, and vulnerability assessment. It is widely used by ethical hackers and system administrators to gather information about systems, services, and potential attack vectors.

πŸš€ Getting Started

Basic syntax of Nmap:

nmap [options] [target]

Example - Quick Scan

nmap scanme.nmap.org

This will perform a simple TCP connect scan on 1000 common ports.

πŸ” Common Scan Types

1. SYN Scan (Stealth Scan)

nmap -sS 192.168.1.1

Performs a fast and stealthy TCP SYN scan. This is the most popular scan type.

2. Service and Version Detection

nmap -sV 192.168.1.1

Identifies running services and attempts to determine their version numbers.

3. OS Detection

nmap -O 192.168.1.1

Tries to determine the operating system of the target machine.

4. Aggressive Scan

nmap -A 192.168.1.1

Combines OS detection, version detection, script scanning, and traceroute.

5. UDP Scan

nmap -sU 192.168.1.1

Scans UDP ports (slower and more resource-intensive than TCP).

🧠 Advanced Usage

Scan Multiple Targets

nmap 192.168.1.1 192.168.1.2 192.168.1.3

Scan a Subnet

nmap 192.168.1.0/24

Scan Specific Ports

nmap -p 22,80,443 192.168.1.1

Use a Custom Wordlist

nmap -p- --top-ports 100 --script vuln target.com

Save Results

nmap -oN output.txt 192.168.1.1

🌐 Real-World Example

Suppose you’re assessing a web server at webcorp.com. Here's how you'd start:

# Step 1: Basic discovery
nmap -sS -p 80,443 webcorp.com

# Step 2: Service and version detection
nmap -sV -p 80,443 webcorp.com

# Step 3: Full aggressive scan
nmap -A webcorp.com -oN webcorp-scan.txt

These steps help identify web servers, frameworks, and even misconfigured services.

πŸ’‘ Pro Tips

πŸ“š Recommended Resources