Once you have a live host, enumerate what’s running on it. Port scanning tells you the services; service fingerprinting tells you the versions; version research tells you the vulnerabilities.
nmap Fundamentals
The workhorse scanner. Understand the common flags:
# TCP SYN scan — default, fast, requires root
nmap -sS target
# TCP connect scan — slower, works without root
nmap -sT target
# UDP scan — slow, misses lots of services without probes
nmap -sU target
# Service version detection
nmap -sV target
# OS fingerprinting
nmap -O target
# All of the above + default scripts
nmap -sC -sV -O target
# Aggressive — equivalent to -sC -sV -O --traceroute
nmap -A targetPort Selection
Default nmap scans the top 1000 ports. Often you want more.
# scan every port — slow but thorough
nmap -p- target
# specific ports
nmap -p 80,443,8080,8443 target
# port range
nmap -p 1-10000 target
# top ports by frequency
nmap --top-ports 100 target
nmap --top-ports 1000 targetA reasonable production scan:
nmap -p- -sS --min-rate=5000 target -oN all-ports.nmapThen follow up with service detection on just the found ports:
nmap -p 22,80,443,445 -sC -sV target -oN services.nmapFaster than running -sC -sV on all 65535 ports upfront.
Service Fingerprinting
Beyond nmap, probe specific services:
HTTP
curl -I http://target # headers
whatweb http://target # tech stack
nikto -h http://target # vulnerability scanSSH
nc target 22 # banner
ssh -vvv target # version via ssh-auditSMTP
nc target 25
# Then issue EHLO target.com and watch the responseSMB
smbclient -L //target -N # list shares
nmap --script smb-enum-shares target
crackmapexec smb target
enum4linux -a targetDNS
dig @target # does the server resolve for us?
nmap --script dns-brute targetOS Fingerprinting Without -O
nmap’s -O sends crafted packets and reads TCP/IP stack behavior. Alternatives when -O fails (filtered network, IDS):
- TTL in ping response:
- 64 → likely Linux/Unix
- 128 → likely Windows
- 255 → likely router/switch
- Common ports: 445 open → Windows or Samba; 3389 → Windows; 22 only → likely Linux
- Banner strings from service version detection
Enumerating a Specific Port
Once you find an interesting open port, don’t just note it — probe it:
# all nmap scripts for a service
nmap --script "ftp-*" -p 21 target
nmap --script "smb-*" -p 445 target
nmap --script "http-*" -p 80 target
# vulnerability scripts
nmap --script vuln targetFirewall / IDS Evasion
If scans are blocked or incomplete:
# slower scan to avoid rate limits
nmap -T2 target
# fragment packets
nmap -f target
# randomize source port
nmap --source-port 53 target
# decoys — ride other apparent sources
nmap -D RND:10 target
# idle scan via a zombie
nmap -sI zombie targetNmap Scripting Engine (NSE)
Nmap has ~600 scripts. Discover them:
ls /usr/share/nmap/scripts/ | grep -i smbRun by category:
nmap --script "default" target # common, non-intrusive
nmap --script "discovery" target # enumeration
nmap --script "vuln" target # vulnerability checks
nmap --script "auth" target # auth bypasses
nmap --script "brute" target # brute force (noisy)Staying Organized
Save every scan output:
nmap -A target -oA scan1 # outputs scan1.nmap, scan1.xml, scan1.gnmapThree formats:
.nmap— human-readable.xml— parseable.gnmap— grep-friendly
The .gnmap is great for quick extraction:
grep "open" scan1.gnmap | awk -F ":" '{print $2}'Methodology
- Quick scan to find anything responsive:
nmap -sS -T4 --top-ports 100 target - Full port scan:
nmap -p- --min-rate=5000 target - Service detection on open ports:
nmap -p <list> -sC -sV target - UDP top ports:
nmap -sU --top-ports 100 target - NSE scripts for interesting services
- Deep-dive each service with service-specific tools
- Record everything in a note-taking tool — port, service, version, response
