~/netref / Nmap
##

Nmap

The standard network scanner — discover hosts, find open ports, fingerprint services and OS. Most scans need root for raw packets.

// scan types
-sSSYN "half-open" scan — fast, stealthy (default, needs root)
-sTFull TCP connect — no root needed
-sUUDP scan — slow, finds DNS/SNMP/DHCP
-snPing sweep — host discovery, no port scan
-sVService / version detection
-OOS fingerprinting
-AAggressive: -sV -O + scripts + traceroute
// common flags
-p 22,80,443Specific ports (-p- = all 65535)
-FFast — top 100 ports
-PnSkip host discovery (assume up)
-T0…T5Timing — paranoid → insane
-oN / -oX / -oGOutput: normal / XML / greppable
--script <nse>Run NSE scripts (e.g. vuln, default)
-v / -vvVerbosity
// port states
openA service is accepting connections
closedReachable but nothing listening
filteredA firewall is dropping probes
unfilteredReachable but state unknown (ACK scan)
open|filteredNo response — cannot tell (common for UDP)
recipes · copy & run
# quick host discovery on a subnet
nmap -sn 192.168.1.0/24

# top ports + service/version + OS, save all formats
nmap -sS -sV -O -T4 -oA scan 10.0.0.5

# full TCP port range, no ping
nmap -p- -Pn 10.0.0.5

# UDP scan of common services
nmap -sU -p 53,123,161 10.0.0.5

# NSE: default + safe vuln checks
nmap -sV --script "default,vuln" 10.0.0.5
Only scan hosts you own or are authorized to test — port scanning third parties can be illegal.