MThe Ethical Hacker's
Command Handbook

CHAPTER 01 · RECONNAISSANCE

Nmap

Nmap helps you inventory hosts, ports, and services on systems you own or are explicitly authorised to assess.

What it does

Nmap is a network discovery and security-auditing tool. Its output is evidence to investigate—not automatic proof of a vulnerability.

Scope first. Scan only lab machines, your own assets, or targets covered by written permission.

A clear workflow

  1. Confirm target and scope.
  2. Discover live hosts.
  3. Identify open ports.
  4. Detect services.
  5. Save and review results.

Core commands

Host discovery

nmap -sn 192.168.1.0/24

Scan all TCP ports

nmap -p- 192.168.1.10

Identify services and versions

nmap -sV -p 22,80,443 192.168.1.10

Save a record

nmap -sV -oA inventory 192.168.1.10

Port states

Practice safely

Start light: host discovery → ports → service detection → relevant follow-up. Version strings can be hidden or patched, so validate findings responsibly.

Tip: Use -oA to save normal, XML, and grepable output for reporting.