Chapter 03 — The foundation of every successful penetration test.
“90% of hacking is recon.” — Unknown
Table of Contents
- Reconnaissance Fundamentals
- OSINT Techniques
- DNS Enumeration
- WHOIS and Domain Research
- Search Engine Dorking
- Nmap Mastery
- Network Discovery and Host Enumeration
- Port Scanning Techniques
- Service Version Detection
- OS Fingerprinting
- Shodan and Censys
- Subdomain Enumeration
- IP Intelligence Tools
- Social Media Reconnaissance
- Email Enumeration
- Directory and File Discovery
- Certificate Transparency Logs
- Passive Gathering with theHarvester and Maltego
- Information Gathering Workflow
- Cheat Sheet Summary
1. Reconnaissance Fundamentals
1.1 Passive vs Active Reconnaissance
| Aspect |
Passive Reconnaissance |
Active Reconnaissance |
| Definition |
Gathering info without direct contact with the target |
Directly interacting with the target systems |
| Visibility |
Target is unaware |
Target may detect activity |
| Risk |
Low — minimal detection risk |
High — may trigger IDS/IPS |
| Speed |
Slower, depends on data availability |
Faster, direct responses |
| Accuracy |
May be outdated |
Real-time, accurate |
| Examples |
WHOIS, Google dorking, Shodan |
Nmap scanning, port scanning |
| Tools |
theHarvester, Maltego, Google |
Nmap, Gobuster, Nikto |
| OSCP Phase |
Pre-engagement, initial |
Active exploitation prep |
1.2 Reconnaissance Decision Flow
flowchart TD
A[Start Recon] --> B{Passive Recon Possible?}
B -->|Yes| C[OSINT Gathering]
B -->|No| D[Proceed to Active]
C --> E[DNS Enumeration]
C --> F[WHOIS Lookup]
C --> G[Search Engine Dorking]
C --> H[Shodan / Censys]
E --> I{Enough Info?}
F --> I
G --> I
H --> I
I -->|No| D
I -->|Yes| J[Validate Findings]
D --> K[Nmap Network Discovery]
K --> L[Port Scanning]
L --> M[Service Detection]
M --> N[OS Fingerprinting]
N --> O[Directory Enumeration]
O --> P[Document All Findings]
J --> P
1.3 Key Concepts
- Footprinting: Building a complete profile of the target organization
- Reconnaissance: The process of collecting information about the target
- Enumeration: Extracting specific data (users, shares, services)
- OSINT: Open Source Intelligence — publicly available information
- Attack Surface: All entry points an attacker could exploit
2. OSINT Techniques
2.1 What is OSINT?
OSINT is intelligence gathered from publicly available sources. It forms the backbone of passive reconnaissance.
| Source Category |
Examples |
Tools |
| Search Engines |
Google, Bing, DuckDuckGo |
Google Dorks, DuckDuckGo |
| Social Media |
LinkedIn, Twitter, Facebook |
Sherlock, SpiderFoot |
| Public Records |
WHOIS, corporate registries |
whois, domain tools |
| DNS Records |
A, MX, NS, TXT records |
dig, nslookup |
| Code Repositories |
GitHub, GitLab |
GitLeaks, truffleHog |
| Forums/Blogs |
Reddit, StackOverflow, personal blogs |
Google, specialized scrapers |
| Job Postings |
Career pages, Indeed |
Manual research |
| News/Media |
Press releases, news articles |
Google News |
2.2 OSINT Workflow
flowchart LR
A[Target Domain] --> B[Search Engine Dorking]
A --> C[Social Media Search]
A --> D[DNS Records]
A --> E[Public Records]
A --> F[Code Repositories]
B --> G[Aggregate Findings]
C --> G
D --> G
E --> G
F --> G
G --> H[Correlate Data]
H --> I[Identify Entry Points]
2.3 Key OSINT Principles
- Start broad, then narrow down — Begin with the organization, drill to individuals
- Cross-reference sources — Verify findings across multiple sources
- Document everything — Keep detailed notes for reporting
- Respect legal boundaries — OSINT uses public data only
- Automate where possible — Use tools to scale research
3. DNS Enumeration
3.1 DNS Record Types
| Record Type |
Purpose |
Example |
Attack Relevance |
| A |
IPv4 address |
example.com -> 93.184.216.34 |
Find target IPs |
| AAAA |
IPv6 address |
example.com -> 2606:2800:220:1:248:1893:25c8:1946 |
IPv6 targets |
| CNAME |
Alias |
www.example.com -> example.com |
Discover subdomains |
| MX |
Mail server |
example.com -> mail.example.com |
Email infrastructure |
| NS |
Name server |
ns1.example.com |
Zone transfer targets |
| TXT |
Text records |
SPF, DKIM, verification |
Config leaks, SPF info |
| SOA |
Start of Authority |
Zone admin info |
Admin email, serial |
| SRV |
Service location |
_sip._tcp.example.com |
Internal service discovery |
| PTR |
Reverse DNS |
34.216.184.93.in-addr.arpa |
Hostname discovery |
| CAA |
Certificate Authority |
example.com -> letsencrypt.org |
Cert info |
3.2 dig — The DNS Swiss Army Knife
Purpose and Use Cases
- Query any DNS record type
- Perform reverse lookups
- Test zone transfers
- Enumerate DNS servers
- Debug DNS resolution issues
Key Commands
# Basic A record lookup
dig example.com A
# Query specific name server
dig @ns1.example.com example.com A
# MX records (mail servers)
dig example.com MX
# All records (broad enumeration)
dig example.com ANY
# Reverse DNS lookup
dig -x 93.184.216.34
# TXT records (SPF, DKIM, verification tokens)
dig example.com TXT
# NS records (name servers)
dig example.com NS
# SOA record (zone info)
dig example.com SOA
# Short output only
dig example.com A +short
# No comments, compact output
dig example.com A +noall +answer
# CNAME resolution
dig www.example.com CNAME
# SRV records (service discovery)
dig _sip._tcp.example.com SRV
# Trace DNS resolution path
dig example.com +trace
# Zone transfer attempt
dig axfr @ns1.example.com example.com
# Batch query from file
dig -f subdomains.txt
# Query multiple record types
dig example.com A MX NS TXT SOA
Output Interpretation
; <<>> DiG 9.16.1 <<>> example.com A
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 12345
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 2, ADDITIONAL: 3
;; QUESTION SECTION:
;example.com. IN A
;; ANSWER SECTION:
example.com. 3600 IN A 93.184.216.34
;; AUTHORITY SECTION:
example.com. 3600 IN NS a.iana-servers.net.
example.com. 3600 IN NS b.iana-servers.net.
;; Query time: 15 msec
;; SERVER: 8.8.8.8#53(8.8.8.8)
;; WHEN: Mon Aug 31 10:00:00 CST 2026
;; MSG SIZE rcvd: 120
| Section |
What to Look For |
| ANSWER |
IP addresses, mail servers, aliases |
| AUTHORITY |
Name servers — targets for zone transfer |
| ADDITIONAL |
Glue records, extra IPs |
| status |
NOERROR = success, NXDOMAIN = not found |
Attack Chain Position
- Phase: Passive → Active transition
- Value: Maps the target’s DNS infrastructure
- Leads to: IP discovery, subdomain enumeration, zone transfer exploitation
3.3 nslookup
Purpose and Use Cases
- Quick DNS queries
- Interactive mode for multiple lookups
- Server-specific queries
- Reverse lookups
Key Commands
# Basic lookup
nslookup example.com
# Query specific server
nslookup example.com 8.8.8.8
# MX records
nslookup -type=MX example.com
# All records
nslookup -type=ANY example.com
# Reverse lookup
nslookup 93.184.216.34
# Interactive mode
nslookup
> set type=MX
> example.com
> set type=A
> www.example.com
> exit
# Zone transfer attempt
ls -d example.com ns1.example.com
3.4 DNS Zone Transfer
What is a Zone Transfer?
A zone transfer (AXFR) copies the entire DNS zone from a primary to secondary name server. Misconfigured servers allow unauthorized transfers.
# Attempt zone transfer
dig axfr @ns1.example.com example.com
# Using nslookup
nslookup
> set type=axfr
> example.com ns1.example.com
# Using host command
host -l example.com ns1.example.com
Success Indicators
- Server returns
NOERROR with full zone data
- You receive all records (A, AAAA, MX, NS, TXT, CNAME, etc.)
- Internal hostnames and IPs are exposed
Attack Value
| Finding |
Exploitation Path |
| Internal subdomains |
Discover hidden services |
| Admin hostnames |
Target admin portals |
| Dev/staging servers |
Often less secured |
| Internal IPs |
Network mapping |
| Mail server names |
Email attacks |
4. WHOIS and Domain Research
4.1 WHOIS Lookup
Purpose and Use Cases
- Domain registration details
- Administrative contact information
- Name server identification
- Registration and expiration dates
- Registrar information
Key Commands
# Basic WHOIS lookup
whois example.com
# Query specific WHOIS server
whois -h whois.verisign-grs.com example.com
# IP WHOIS lookup
whois 93.184.216.34
# Extract specific fields
whois example.com | grep -i "registrant\|admin\|tech\|email\|name server"
# Registry WHOIS
whois -h whois.iana.net example.com
| Field |
Value |
Attack Relevance |
| Registrant Name |
Person/org who owns domain |
Social engineering targets |
| Admin Email |
Administrative contact |
Phishing targets |
| Name Servers |
DNS infrastructure |
Zone transfer targets |
| Creation Date |
When domain was registered |
Age assessment |
| Expiration Date |
When domain expires |
Domain hijacking risk |
| Registrar |
Registration company |
Abuse contact |
| DNSSEC |
Security extension status |
Security posture |
4.2 Domain Research Tools
| Tool |
Purpose |
Command |
| whois |
Domain registration info |
whois example.com |
| domainiq |
Domain relationship mapping |
Web-based |
| SecurityTrails |
Historical DNS data |
Web-based / API |
| crt.sh |
Certificate transparency |
https://crt.sh/?q=example.com |
| viewdns.info |
Multi-tool DNS research |
Web-based |
| dnsdumpster.com |
DNS recon and mapping |
Web-based |
5. Search Engine Dorking (Google Hacking)
5.1 What is Google Dorking?
Using advanced search operators to find exposed resources, sensitive files, and vulnerable configurations indexed by search engines.
5.2 Google Dork Operators
| Operator |
Syntax |
Purpose |
Example |
| site: |
site:example.com |
Limit to specific domain |
site:example.com |
| inurl: |
inurl:admin |
Search URL path |
inurl:admin site:example.com |
| intitle: |
intitle:index of |
Search page title |
intitle:"Index of /" site:example.com |
| intext: |
intext:password |
Search page content |
intext:"password" site:example.com |
| filetype: |
filetype:pdf |
Filter by file type |
filetype:pdf site:example.com |
| ext: |
ext:php |
File extension filter |
ext:php site:example.com |
| cache: |
cache:example.com |
Cached version |
cache:example.com |
| related: |
related:example.com |
Similar sites |
related:example.com |
| - |
-admin |
Exclude term |
site:example.com -admin |
| * |
hello * world |
Wildcard |
site:example.com "error * on line *" |
| .. |
1..100 |
Range |
site:pastebin.com 1..100 |
5.3 Critical Dorks for OSCP
Exposed Directories and Files
site:target.com intitle:"Index of /"
site:target.com filetype:php intext:"phpinfo"
site:target.com ext:sql
site:target.com ext:log
site:target.com ext:conf
site:target.com ext:env
site:target.com ext:bak
site:target.com ext:old
site:target.com ext:swp
site:target.com ext:tmp
Administrative Interfaces
site:target.com inurl:admin
site:target.com inurl:login
site:target.com inurl:dashboard
site:target.com inurl:manager
site:target.com inurl:console
site:target.com inurl:phpmyadmin
site:target.com inurl:wp-admin
site:target.com inurl:cpanel
site:target.com intext:"password"
site:target.com intext:"username"
site:target.com intext:"api_key"
site:target.com intext:"secret"
site:target.com intext:"token"
site:target.com intext:"database"
site:target.com intext:"connection string"
Error Messages and Debug Info
site:target.com intext:"Fatal error"
site:target.com intext:"Warning"
site:target.com intext:"Stack trace"
site:target.com intext:"Traceback"
site:target.com intext:"Server Error in '/' Application"
site:target.com intext:"You have an error in your SQL syntax"
Backup and Configuration Files
site:target.com ext:zip
site:target.com ext:rar
site:target.com ext:tar.gz
site:target.com ext:config
site:target.com ext:ini
site:target.com ext:xml
site:target.com ext:json
site:target.com ext:yml
site:target.com ext:properties
5.4 Google Hacking Database (GHDB)
- URL:
https://www.exploit-db.com/google-hacking-database
- Purpose: Community-maintained collection of dorks
- Usage: Search by category, vulnerability type, or application
- OSCP Value: Pre-built dorks for common targets
5.5 Attack Chain Position
- Phase: Passive reconnaissance
- Value: Discovers exposed resources without touching the target
- Leads to: Direct exploitation of found resources
6. Nmap Mastery
6.1 Nmap Overview
Nmap (Network Mapper) is the most essential tool for OSCP. It performs:
- Host discovery
- Port scanning
- Service detection
- OS fingerprinting
- Script-based vulnerability scanning
6.2 Nmap Scan Types
| Scan Type |
Flag |
Description |
Stealth |
Speed |
Reliability |
| TCP SYN |
-sS |
Half-open scan (default) |
Medium |
Fast |
High |
| TCP Connect |
-sT |
Full TCP handshake |
Low |
Medium |
Highest |
| UDP |
-sU |
UDP port scan |
Medium |
Slow |
Medium |
| TCP ACK |
-sA |
Map firewalls |
High |
Fast |
Low |
| NULL |
-sN |
No flags set |
High |
Fast |
Medium |
| FIN |
-sF |
FIN flag only |
High |
Fast |
Medium |
| XMAS |
-sX |
FIN+PSH+URG flags |
High |
Fast |
Medium |
| Service Version |
-sV |
Detect service versions |
Low |
Slow |
High |
| Aggressive |
-A |
OS + version + scripts + traceroute |
Low |
Slow |
High |
| Ping Scan |
-sn |
Host discovery only |
Medium |
Fast |
High |
| IP Protocol |
-sO |
IP protocol scan |
Medium |
Slow |
Low |
6.3 Nmap Timing Templates
| Template | Flag | Description | Use Case |
|–––––|———––|–––––|
| Paranoid | -T0 | Slowest, evasive | Heavily monitored targets |
| Sneaky | -T1 | Very slow | IDS/IPS present |
| Polite | -T2 | Slower, reduces load | Rate-limited targets |
| Normal | -T3 | Default speed | General purpose |
| Aggressive | -T4 | Faster | Most OSCP labs |
| Insane | -T5 | Fastest, unreliable | Quick checks only |
6.4 Essential Nmap Commands
Host Discovery
# Ping sweep (no port scan)
nmap -sn 10.10.10.0/24
# Disable DNS resolution (faster)
nmap -sn -n 10.10.10.0/24
# Multiple discovery techniques
nmap -sn -PS22,80 -PU53 -PE -PP 10.10.10.0/24
# ARP scan (local network)
nmap -sn --send-ip 10.10.10.0/24
Port Scanning
# Quick top 1000 ports
nmap -sS -T4 10.10.10.10
# All 65535 ports
nmap -sS -p- 10.10.10.10
# Specific ports
nmap -sS -p 22,80,443,3306,8080 10.10.10.10
# Port range
nmap -sS -p 1-1024 10.10.10.10
# UDP scan (top 100)
nmap -sU -T4 --top-ports 100 10.10.10.10
# UDP specific ports
nmap -sU -p 53,161,162,1900,5353 10.10.10.10
# SYN + UDP combined
nmap -sS -sU -p- 10.10.10.10
# Stealth scans (may bypass simple firewalls)
nmap -sF 10.10.10.10
nmap -sN 10.10.10.10
nmap -sX 10.10.10.10
Service and OS Detection
# Service version detection
nmap -sV 10.10.10.10
# Intensive service detection
nmap -sV --version-intensity 7 --version-all 10.10.10.10
# OS detection
nmap -O 10.10.10.10
# Aggressive scan (OS + version + scripts + traceroute)
nmap -A 10.10.10.10
# OS detection with guessing
nmap -O --osscan-guess 10.10.10.10
Script Scanning (NSE)
# Default scripts
nmap -sC 10.10.10.10
# Specific script
nmap --script http-enum 10.10.10.10
# Multiple scripts
nmap --script "http-enum,http-title,ssl-cert" 10.10.10.10
# Script category
nmap --script vuln 10.10.10.10
nmap --script safe 10.10.10.10
nmap --script discovery 10.10.10.10
nmap --script auth 10.10.10.10
nmap --script brute 10.10.10.10
nmap --script exploit 10.10.10.10
# Script with arguments
nmap --script http-enum --script-args http-enum.root="/webapp" 10.10.10.10
# Custom script directory
nmap --script /path/to/script.nse 10.10.10.10
# Normal output to file
nmap -oN scan.txt 10.10.10.10
# XML output (parseable)
nmap -oX scan.xml 10.10.10.10
# Grepable output
nmap -oG scan.gnmap 10.10.10.10
# All formats at once
nmap -oA scan_results 10.10.10.10
# Append to existing file
nmap -oA scan_results --append-output 10.10.10.10
Advanced Techniques
# Decoy scan (hide among fake sources)
nmap -D RND:10 10.10.10.10
# Fragment packets (bypass simple firewalls)
nmap -f 10.10.10.10
# MTU fragmentation
nmap -f --mtu 8 10.10.10.10
# Source port specification
nmap -g 53 10.10.10.10
# Randomize port order
nmap --randomize-hosts -iR 10000
# Skip host discovery (target may not respond to ping)
nmap -Pn 10.10.10.10
# Custom payload
nmap --data-length 25 10.10.10.10
# Reason for port state
nmap --reason 10.10.10.10
# Open ports only
nmap --open 10.10.10.10
6.5 Nmap Scripting Engine (NSE) — Essential Scripts
| Script |
Purpose |
Command |
| http-enum |
Enumerate web directories |
--script http-enum |
| http-title |
Get page titles |
--script http-title |
| http-headers |
Show HTTP headers |
--script http-headers |
| ssl-cert |
Extract SSL certificate info |
--script ssl-cert |
| ssl-enum-ciphers |
List SSL ciphers |
--script ssl-enum-ciphers |
| smb-enum-shares |
List SMB shares |
--script smb-enum-shares |
| smb-enum-users |
List SMB users |
--script smb-enum-users |
| ftp-anon |
Check anonymous FTP |
--script ftp-anon |
| snmp-info |
SNMP community strings |
--script snmp-info |
| snmp-enum |
SNMP enumeration |
--script snmp-enum |
| vuln |
Vulnerability detection |
--script vuln |
| default |
Default safe scripts |
-sC |
| safe |
Safe scripts only |
--script safe |
| auth |
Authentication scripts |
--script auth |
| brute |
Brute force scripts |
--script brute |
| discovery |
Discovery scripts |
--script discovery |
| exploit |
Exploitation scripts |
--script exploit |
| external |
External service scripts |
--script external |
6.6 Nmap Output Interpretation
Nmap scan report for 10.10.10.10
Host is up (0.0023s latency).
Not shown: 997 closed ports
PORT STATE SERVICE VERSION
22/tcp open ssh OpenSSH 8.2p1 Ubuntu 4ubuntu0.5
80/tcp open http Apache httpd 2.4.41
443/tcp open ssl/http Apache httpd 2.4.41
3306/tcp open mysql MySQL 8.0.26
Service detection performed.
OS details: Linux 5.4 - 5.8
| Column |
Meaning |
| PORT |
Port number and protocol |
| STATE |
open, closed, filtered, open|filtered, closed|filtered |
| SERVICE |
Default service name |
| VERSION |
Detected service version (with -sV) |
6.7 Nmap Port States
| State |
Meaning |
Implication |
| open |
Application accepts connections |
Target for exploitation |
| closed |
No application listening |
Port reachable, no service |
| filtered |
Firewall blocks response |
May need different approach |
| open|filtered |
Cannot determine (UDP/stealth) |
Needs further investigation |
| closed|filtered |
Cannot determine (stealth scans) |
Needs further investigation |
6.8 Recommended OSCP Nmap Workflow
# Step 1: Quick scan of top ports
nmap -sS -T4 -p- --open -oA nmap/initial 10.10.10.10
# Step 2: Service version detection on open ports
nmap -sV -sC -T4 -p 22,80,443,3306 -oA nmap/service 10.10.10.10
# Step 3: OS detection
nmap -O -sV -T4 -p 22,80,443,3306 -oA nmap/os 10.10.10.10
# Step 4: UDP scan (if time permits)
nmap -sU -T4 --top-ports 100 -oA nmap/udp 10.10.10.10
# Step 5: Aggressive scan (comprehensive)
nmap -A -T4 -p- -oA nmap/aggressive 10.10.10.10
7. Network Discovery and Host Enumeration
7.1 Network Discovery Techniques
| Technique |
Tool |
Command |
Description |
| ICMP Ping |
nmap |
nmap -sn 10.10.10.0/24 |
Standard ping sweep |
| ARP Scan |
arp-scan |
arp-scan --localnet |
Local network discovery |
| TCP SYN |
nmap |
nmap -PS22,80 10.10.10.0/24 |
SYN to common ports |
| TCP ACK |
nmap |
nmap -PA22,80 10.10.10.0/24 |
ACK probe |
| UDP |
nmap |
nmap -PU53 10.10.10.0/24 |
UDP probe |
| ICMP Timestamp |
nmap |
nmap -PE 10.10.10.0/24 |
ICMP type 13 |
| ICMP Netmask |
nmap |
nmap -PP 10.10.10.0/24 |
ICMP type 17 |
7.2 Host Discovery Workflow
flowchart TD
A[Target Network] --> B[ICMP Ping Sweep]
B --> C{Hosts Found?}
C -->|Yes| D[Record Live Hosts]
C -->|No| E[TCP SYN Probe]
E --> F{Hosts Found?}
F -->|Yes| D
F -->|No| G[UDP Probe]
G --> H{Hosts Found?}
H -->|Yes| D
H -->|No| I[ARP Scan Local]
I --> J[Record Live Hosts]
D --> K[Port Scan Each Host]
J --> K
7.3 Masscan — Fast Port Scanner
# Scan entire subnet for common ports
masscan 10.10.10.0/24 -p 22,80,443,3389 --rate 1000
# Scan all ports on single host
masscan 10.10.10.10 -p 1-65535 --rate 5000
# Output to file for nmap
masscan 10.10.10.0/24 -p 1-65535 --rate 10000 -oL masscan.txt
# Pipe masscan results to nmap
masscan 10.10.10.0/24 -p 1-65535 --rate 10000 -oL - | nmap -iL - -sV
# Ping entire subnet
fping -a -g 10.10.10.0/24
# Ping from file
fping -f hosts.txt -a
# Unlimited retries
fping -a -g 10.10.10.0/24 -r 0
8. Port Scanning Techniques
8.1 TCP Scan Types Deep Dive
TCP SYN Scan (Half-Open)
Client Server
| --- [SYN] ---------------> |
| <--- [SYN-ACK] ---------- | (Port is OPEN)
| --- [RST] ---------------> | (Connection NOT completed)
|
| --- [SYN] ---------------> |
| <--- [RST] -------------- | (Port is CLOSED)
- Flag:
-sS
- Stealth: Does not complete handshake
- Speed: Fast — no full connection
- Privileges: Requires root/admin
- Best for: Most OSCP scans
TCP Connect Scan
Client Server
| --- [SYN] ---------------> |
| <--- [SYN-ACK] ---------- |
| --- [ACK] ---------------> | (Full handshake)
| --- [Data] --------------> |
| --- [FIN] ---------------> |
| <--- [FIN-ACK] ---------- |
- Flag:
-sT
- Stealth: Low — full connection logged
- Speed: Slower than SYN
- Privileges: No special privileges needed
- Best for: When root is unavailable
TCP ACK Scan (Firewall Mapping)
Client Server
| --- [ACK] ---------------> |
| <--- [RST] -------------- | (Unfiltered)
| (No response) | (Filtered by firewall)
- Flag:
-sA
- Purpose: Determine firewall rules
- Cannot detect: Open ports — only filtered vs unfiltered
- Best for: Firewall rule mapping
Stealth Scans (NULL, FIN, XMAS)
| Scan |
Flags Sent |
Response if Closed |
Response if Open |
| NULL |
None |
RST |
No response |
| FIN |
FIN only |
RST |
No response |
| XMAS |
FIN+PSH+URG |
RST |
No response |
- Requirement: Root privileges
- Limitation: Does not work against Windows (RFC compliant)
- Best for: Bypassing simple stateless firewalls
8.2 UDP Scanning
# Top 100 UDP ports
nmap -sU --top-ports 100 10.10.10.10
# Specific UDP ports
nmap -sU -p 53,161,162,69,1900 10.10.10.10
# UDP with service detection
nmap -sU -sV -p 53,161 10.10.10.10
# Faster UDP with timing
nmap -sU -T4 -p 53,161,162 10.10.10.10
Common UDP Services to Check
| Port |
Service |
Why Check |
| 53 |
DNS |
DNS zone transfer, amplification |
| 67/68 |
DHCP |
Network config info |
| 69 |
TFTP |
Often unauthenticated |
| 123 |
NTP |
Time sync, amplification |
| 161/162 |
SNMP |
Community strings, device info |
| 500 |
IKE |
VPN detection |
| 514 |
Syslog |
Log data |
| 1900 |
UPnP |
Device discovery |
| 5353 |
mDNS |
Local network discovery |
8.3 Port Scanning Strategy for OSCP
flowchart TD
A[Start] --> B[Quick SYN Scan Top 1000]
B --> C[Full Port SYN Scan]
C --> D[Service Version Detection]
D --> E[Script Scan on Key Ports]
E --> F[UDP Scan Top 100]
F --> G[OS Detection]
G --> H[Document Findings]
9. Service Version Detection
9.1 Why Service Detection Matters
| Service Version |
Known Vulnerabilities |
Exploitation Path |
| OpenSSH 7.4 |
CVE-2016-0777 |
User enumeration |
| Apache 2.4.49 |
CVE-2021-41773 |
Path traversal RCE |
| MySQL 5.7 |
Default configs |
Weak auth, info leak |
| vsftpd 2.3.4 |
Backdoor |
Remote shell |
| ProFTPD 1.3.3c |
Backdoor |
Remote shell |
9.2 Nmap Version Detection
# Basic version detection
nmap -sV 10.10.10.10
# Intensive version detection
nmap -sV --version-intensity 7 10.10.10.10
# Try all probes
nmap -sV --version-all 10.10.10.10
# Version detection on specific ports
nmap -sV -p 22,80,443,8080 10.10.10.10
# Version + scripts
nmap -sV -sC -p 22,80,443 10.10.10.10
9.3 Version Detection Intensity Levels
| Level |
Description |
Time |
Accuracy |
| 0 |
Quick guess |
Fastest |
Lowest |
| 1-3 |
Standard probes |
Fast |
Medium |
| 4 |
Default intensity |
Medium |
Good |
| 5-6 |
Extended probes |
Slow |
Better |
| 7 |
All probes, all ports |
Slowest |
Best |
9.4 Manual Service Banner Grabbing
# HTTP banner
curl -I http://10.10.10.10:80
# SSH banner
echo | nc 10.10.10.10 22
# SMTP banner
echo | nc 10.10.10.10 25
# FTP banner
echo | nc 10.10.10.10 21
# SMB banner
echo | nc 10.10.10.10 445
# MySQL banner
echo | nc 10.10.10.10 3306
# Telnet for raw banner
telnet 10.10.10.10 80
9.5 Vulnerability Research Workflow
flowchart LR
A[Service Version] --> B[Search Exploit-DB]
A --> C[Search CVE Details]
A --> D[Search Google]
B --> E[Evaluate Exploit]
C --> E
D --> E
E --> F{Exploit Available?}
F -->|Yes| G[Test Exploit]
F -->|No| H[Continue Enumeration]
10. OS Fingerprinting
10.1 Active OS Fingerprinting (Nmap)
# Basic OS detection
nmap -O 10.10.10.10
# OS detection with guessing
nmap -O --osscan-guess 10.10.10.10
# OS detection on multiple hosts
nmap -O 10.10.10.10-20
# OS + service detection
nmap -O -sV 10.10.10.10
# Aggressive (includes OS)
nmap -A 10.10.10.10
Output Interpretation
OS detection performed. Please report any incorrect results at
https://nmap.org/submit/ .
OS details: Linux 5.4 - 5.8
Network Distance: 2 hops
Service Info: OS: Linux; CPE: cpe:/o:linux:linux_kernel
10.2 Passive OS Fingerprinting
| Technique |
What to Look For |
Tool |
| TCP/IP Stack |
TTL, window size, DF flag |
nmap, tcpdump |
| HTTP Headers |
Server header, X-Powered-By |
curl, browser |
| SMB Signatures |
Server string, LAN Manager |
enum4linux |
| SSH Banner |
Version string |
nc, ssh |
| SNMP |
System description |
snmpwalk |
| ICMP Responses |
TTL values |
ping, hping3 |
10.3 TTL-Based OS Detection
| TTL Value |
Likely OS |
Notes |
| 64 |
Linux, Unix |
Initial TTL = 64 |
| 128 |
Windows |
Initial TTL = 128 |
| 255 |
Cisco, some Unix |
Initial TTL = 255 |
# Check TTL via ping
ping -c 1 10.10.10.10
# Check TTL via nmap
nmap -sS --ttl 64 10.10.10.10
10.4 OS Fingerprinting Indicators
| Indicator |
Linux |
Windows |
macOS |
| TTL |
64 |
128 |
64 (usually) |
| Window Size |
65535, 29200 |
8192, 65535 |
16384 |
| DF Flag |
Set |
Set |
Set |
| SMB Server |
Samba |
Windows Server |
Samba |
| HTTP Server |
Apache/Nginx |
IIS |
Apache |
| SSH Banner |
OpenSSH |
Rare |
OpenSSH |
11. Shodan and Censys
11.1 Shodan
Purpose and Use Cases
- Search internet-connected devices
- Find exposed services
- Identify technology stacks
- Discover vulnerable services
- Monitor attack surface
Key Commands (CLI)
# Install shodan CLI
pip install shodan
# Configure API key
shodan init YOUR_API_KEY
# Search for services
shodan search "http.title:admin"
shodan search "ssh" --limit 20
shodan search "org:Target Company"
shodan search "port:22 country:US"
shodan search "product:Apache"
shodan search "ssl.cert.subject.cn:example.com"
# Get host details
shodan init YOUR_API_KEY
shodan info 10.10.10.10
# Get banners
shodan banners 10.10.10.10
# Download results
shodan download results.json "org:Target Company"
# Convert to CSV
shodan convert results.json results.csv
# Search for specific vulnerabilities
shodan search "CVE-2021-44228"
shodan search "http.component:log4j"
Shodan Search Filters
| Filter |
Syntax |
Example |
| Port |
port:NUMBER |
port:22 |
| Country |
country:CODE |
country:US |
| City |
city:NAME |
city:New York |
| Organization |
org:NAME |
org:Example Corp |
| Product |
product:NAME |
product:Apache |
| OS |
os:NAME |
os:Ubuntu |
| HTTP Title |
http.title:TEXT |
http.title:admin |
| SSL Cert |
ssl.cert.subject.cn:DOMAIN |
ssl.cert.subject.cn:example.com |
| Hashtag |
#TAG |
#iot |
| ASN |
asn:NUMBER |
asn:15169 |
11.2 Censys
Purpose and Use Cases
- Similar to Shodan but with different coverage
- Certificate transparency integration
- IPv6 coverage
- API-driven research
Key Commands (CLI)
# Install censys CLI
pip install censys
# Configure
censys cert search "names: example.com"
censys hosts search "services.port: 443"
censys hosts view 10.10.10.10
# Search by service
censys hosts search "services.service_name: SSH"
censys hosts search "services.port: 22"
# Search by certificate
censys cert search "names: *.example.com"
11.3 Attack Chain Position
| Tool |
Phase |
Value |
| Shodan |
Passive recon |
Exposed services, tech stack, vulnerabilities |
| Censys |
Passive recon |
Certificate data, IPv6, service details |
| Both |
Pre-engagement |
Attack surface mapping without touching target |
12. Subdomain Enumeration
12.1 Why Subdomain Enumeration Matters
| Subdomain Type |
Potential Value |
Example |
| www |
Main website |
www.example.com |
| mail |
Email server |
mail.example.com |
| dev/staging |
Development environments |
dev.example.com |
| admin |
Admin panels |
admin.example.com |
| api |
API endpoints |
api.example.com |
| vpn |
VPN access |
vpn.example.com |
| git/github |
Code repositories |
git.example.com |
| jenkins/ci |
CI/CD pipelines |
jenkins.example.com |
| test |
Test environments |
test.example.com |
| old/legacy |
Legacy systems |
old.example.com |
12.2 Subdomain Enumeration Techniques
Passive Techniques
| Tool |
Method |
Command |
| subfinder |
Passive sources |
subfinder -d example.com |
| amass |
Passive + active |
amass enum -passive -d example.com |
| assetfinder |
Passive sources |
assetfinder --subs-only example.com |
| sublist3r |
Multiple sources |
sublist3r -d example.com |
| Google |
Search engine |
site:example.com |
| Shodan |
Internet scan |
shodan search "ssl.cert.subject.cn:*.example.com" |
| crt.sh |
Cert transparency |
https://crt.sh/?q=%25.example.com |
| SecurityTrails |
Historical DNS |
API-based |
| virustotal |
VT data |
API-based |
Active Techniques
| Tool |
Method |
Command |
| ffuf |
Brute force |
ffuf -u https://FUZZ.example.com -w subdomains.txt |
| gobuster |
DNS mode |
gobuster dns -d example.com -w subdomains.txt |
| massdns |
DNS resolution |
cat subs.txt | massdns -r resolvers.txt |
| nmap |
DNS brute |
nmap -sn --script dns-brute 10.10.10.10 |
12.3 Essential Subdomain Tools
subfinder
# Basic enumeration
subfinder -d example.com
# With output file
subfinder -d example.com -o subdomains.txt
# Verbose mode
subfinder -d example.com -v
# All sources
subfinder -d example.com -all
# Rate limit
subfinder -d example.com -rate 10
amass
# Passive enumeration
amass enum -passive -d example.com -o passive.txt
# Active enumeration (use with caution)
amass enum -active -d example.com -o active.txt
# Both passive and active
amass enum -d example.com -o all_subs.txt
# With wordlist
amass enum -d example.com -w wordlists/subdomains.txt
# Depth control
amass enum -d example.com -max-dns 2000
# JSON output
amass enum -d example.com -json amass.json
gobuster DNS Mode
# Basic DNS brute force
gobuster dns -d example.com -w /usr/share/seclists/Discovery/DNS/subdomains-top1million-5000.txt
# Thread control
gobuster dns -d example.com -w subdomains.txt -t 50
# Output file
gobuster dns -d example.com -w subdomains.txt -o results.txt
# Show all responses
gobuster dns -d example.com -w subdomains.txt -c
ffuf for Subdomains
# Basic subdomain brute force
ffuf -u https://FUZZ.example.com -w subdomains.txt -mc 200,301,302
# With wordlist
ffuf -u https://FUZZ.example.com -w /usr/share/seclists/Discovery/DNS/subdomains-top1million-5000.txt
# Filter by response size
ffuf -u https://FUZZ.example.com -w subdomains.txt -fs 0
12.4 Subdomain Wordlists
| Wordlist |
Location |
Size |
| subdomains-top1million |
SecLists |
5000 / 11000 / 20000+ |
| discover_subdomains_names |
SecLists |
Medium |
| altdns |
Generated |
Custom |
| custom |
Your own |
Target-specific |
# SecLists subdomain wordlists
/usr/share/seclists/Discovery/DNS/subdomains-top1million-5000.txt
/usr/share/seclists/Discovery/DNS/subdomains-top1million-11000.txt
/usr/share/seclists/Discovery/DNS/subdomains-top1million-20000.txt
12.5 Subdomain Enumeration Workflow
flowchart TD
A[Target Domain] --> B[Passive Enumeration]
B --> C[subfinder]
B --> D[amass passive]
B --> E[crt.sh]
B --> F[Google Dorking]
C --> G[Merge Results]
D --> G
E --> G
F --> G
G --> H[Remove Duplicates]
H --> I[Validate with massdns]
I --> J[Live Subdomains]
J --> K[HTTP Status Check]
K --> L[Document Findings]
13.1 WHOIS for IP Addresses
# IP WHOIS lookup
whois 93.184.216.34
# Extract network info
whois 93.184.216.34 | grep -i "netrange\|descr\|country\|organization"
# Regional registry
whois -h whois.arin.net 93.184.216.34
whois -h whois.apnic.net 93.184.216.34
whois -h whois.ripe.net 93.184.216.34
13.2 NetBlocks
- URL:
https://netblocks.org/
- Purpose: IP address ownership and allocation data
- Features:
- IP to ASN mapping
- Network allocation details
- Historical allocation data
- Geolocation information
| Tool |
Purpose |
URL |
| AbuseIPDB |
IP abuse reports |
https://www.abuseipdb.com/ |
| VirusTotal |
IP reputation |
https://www.virustotal.com/ |
| GreyNoise |
Internet noise filtering |
https://www.greynoise.io/ |
| Shodan |
IP service info |
shodan ip 93.184.216.34 |
| IPinfo |
IP geolocation |
https://ipinfo.io/ |
| bgp.he.net |
BGP routing info |
https://bgp.he.net/ |
13.4 ASN Lookup
# Using whois
whois 93.184.216.34 | grep -i "asn\|route\|origin"
# Using bgp.he.net
# Visit https://bgp.he.net/ip/93.184.216.34
# Using Shodan
shodan ip 93.184.216.34
| Platform |
Information Type |
Tools |
Techniques |
| LinkedIn |
Employee info, org structure |
Manual, linkedin-recon |
Employee names, roles |
| Twitter/X |
Tech stack, opinions, leaks |
Twint, manual |
Employee tweets, tech info |
| GitHub |
Code, configs, credentials |
GitLeaks, truffleHog |
Source code analysis |
| Facebook |
Personal info, connections |
Manual |
Social engineering data |
| Instagram |
Photos, locations |
Manual |
Physical security info |
| YouTube |
Videos, presentations |
Manual |
Internal system screenshots |
| Reddit |
Discussions, complaints |
Manual |
Employee frustrations |
| Glassdoor |
Company reviews |
Manual |
Internal process info |
14.2 GitHub Reconnaissance
# Search for organization repos
# https://github.com/orgs/organization-name/repositories
# Search for leaked credentials
# https://github.com/search?q=organization+password&type=code
# Search for config files
# https://github.com/search?q=organization+filetype:env&type=code
# GitLeaks - scan local repos
gitleaks detect --source . --report-format json
# truffleHog - scan for secrets
trufflehog git https://github.com/org/repo
# Search specific patterns
# https://github.com/search?q=org:target+extension:env&type=code
# https://github.com/search?q=org:target+extension:yaml&type=code
14.3 Username Enumeration
# Sherlock - find usernames across platforms
sherlock username
# UserRecon
userrecon -u username -f names.txt
# WhatsMyName
whatsmyname -u username
14.4 Attack Chain Position
- Phase: Passive reconnaissance
- Value: Employee names, tech stack, internal tools
- Leads to: Social engineering, credential attacks, targeted exploits
15. Email Enumeration
15.1 Email Enumeration Techniques
| Technique |
Tool |
Command |
Description |
| Google Dorking |
Google |
site:target.com ext:vcf |
Find vCard files |
| theHarvester |
theHarvester |
See Section 18 |
Multi-source email gathering |
| EmailPermutator |
emperium |
Custom |
Generate email variations |
| SMTP VRFY |
nmap |
--script smtp-enum-users |
SMTP user enumeration |
| SMTP EXPN |
nmap |
--script smtp-enum-domains |
SMTP domain expansion |
| LinkedIn |
Manual |
Browser |
Employee email patterns |
| Hunter.io |
Web |
Browser |
Email pattern detection |
15.2 SMTP User Enumeration
# Nmap SMTP scripts
nmap --script smtp-enum-users -p 25 10.10.10.10
nmap --script smtp-enum-domains -p 25 10.10.10.10
nmap --script smtp-vrfy -p 25 10.10.10.10
# Manual VRFY
nc 10.10.10.10 25
EHLO test
VRFY admin
VRFY root
VRFY user
# Manual EXPN
nc 10.10.10.10 25
EHLO test
EXPN @domain
15.3 Email Pattern Discovery
16. Directory and File Discovery
16.1 Why Directory Enumeration Matters
| Directory |
Potential Value |
Example |
| /admin |
Admin panel |
Login, config |
| /backup |
Backup files |
Database dumps |
| /config |
Configuration |
Credentials, settings |
| /api |
API endpoints |
Data exposure |
| /uploads |
User uploads |
File upload vulns |
| /.git |
Git repository |
Source code, history |
| /.env |
Environment vars |
Database creds |
| /wp-admin |
WordPress admin |
CMS exploitation |
| /phpmyadmin |
Database admin |
SQL access |
| /console |
Management console |
Admin access |
16.2 gobuster
Purpose and Use Cases
- Directory and file brute forcing
- DNS subdomain enumeration
- Virtual host discovery
- Fast and reliable
Key Commands
# Directory brute forcing
gobuster dir -u http://10.10.10.10 -w /usr/share/seclists/Discovery/Web-Content/common.txt
# With thread control
gobuster dir -u http://10.10.10.10 -w common.txt -t 50
# Follow redirects
gobuster dir -u http://10.10.10.10 -w common.txt -r
# Show all status codes
gobuster dir -u http://10.10.10.10 -w common.txt -s "200,204,301,302,307,403"
# Exclude status codes
gobuster dir -u http://10.10.10.10 -w common.txt -b 404
# Add extensions
gobuster dir -u http://10.10.10.10 -w common.txt -x php,txt,html,backup,bak
# Recursive scanning
gobuster dir -u http://10.10.10.10 -w common.txt -r -k
# Output to file
gobuster dir -u http://10.10.10.10 -w common.txt -o results.txt
# DNS mode
gobuster dns -d example.com -w subdomains.txt
# Virtual host discovery
gobuster vhost -u http://10.10.10.10 -w vhosts.txt
# With proxy
gobuster dir -u http://10.10.10.10 -w common.txt -p http://127.0.0.1:8080
# Custom user agent
gobuster dir -u http://10.10.10.10 -w common.txt -a "Mozilla/5.0"
# Wordlist with extensions
gobuster dir -u http://10.10.10.10 -w common.txt -x php,html,txt,js,config,conf,env,log,bak,old,swp,zip,tar.gz
Output Interpretation
===============================================================
Gobuster v3.6
by OJ Reeves (@TheColonial) & Christian Mehlmauer (@firefart)
===============================================================
[+] Url: http://10.10.10.10
[+] Method: GET
[+] Threads: 10
[+] Wordlist: common.txt
[+] Negative Status codes: 404
[+] User Agent: gobuster/3.6
[+] Timeout: 10s
===============================================================
Starting gobuster in directory enumeration mode
===============================================================
/.env (Status: 200) [Size: 1234]
/admin (Status: 301) [Size: 234] [--> http://10.10.10.10/admin/]
/backup (Status: 200) [Size: 567]
/config (Status: 403) [Size: 198]
/index.html (Status: 200) [Size: 890]
/server-status (Status: 200) [Size: 2345]
===============================================================
Finished
| Status Code |
Meaning |
Action |
| 200 |
Found — accessible |
Investigate content |
| 301/302 |
Redirect |
Follow redirect |
| 403 |
Forbidden — exists but restricted |
Try auth bypass |
| 404 |
Not found |
Skip |
16.3 ffuf
Purpose and Use Cases
- Fast web fuzzer
- Directory/file discovery
- Parameter fuzzing
- Virtual host discovery
- Highly customizable
Key Commands
# Basic directory brute forcing
ffuf -u http://10.10.10.10/FUZZ -w /usr/share/seclists/Discovery/Web-Content/common.txt
# With extensions
ffuf -u http://10.10.10.10/FUZZ -w common.txt -e .php,.txt,.html,.bak
# Filter by status code
ffuf -u http://10.10.10.10/FUZZ -w common.txt -mc 200,301,302,403
# Filter by response size
ffuf -u http://10.10.10.10/FUZZ -w common.txt -fs 0
# Filter by word count
ffuf -u http://10.10.10.10/FUZZ -w common.txt -fc 0
# Recursion
ffuf -u http://10.10.10.10/FUZZ -w common.txt -recursion
# Multiple fuzzing positions
ffuf -u http://10.10.10.10/FUZZ1/FUZZ2 -w dirs.txt -w files.txt
# Subdomain enumeration
ffuf -u http://FUZZ.example.com -w subdomains.txt -mc 200,301,302
# Virtual host discovery
ffuf -u http://10.10.10.10 -H "Host: FUZZ.example.com" -w vhosts.txt
# POST data fuzzing
ffuf -u http://10.10.10.10/login -X POST -d "user=FUZZ&pass=test" -w users.txt
# Cookie fuzzing
ffuf -u http://10.10.10.10 -H "Cookie: session=FUZZ" -w sessions.txt
# JSON output
ffuf -u http://10.10.10.10/FUZZ -w common.txt -of json -o results.json
# Rate limiting
ffuf -u http://10.10.10.10/FUZZ -w common.txt -rate 10
# Thread control
ffuf -u http://10.10.10.10/FUZZ -w common.txt -t 50
# Follow redirects
ffuf -u http://10.10.10.10/FUZZ -w common.txt -r
# Custom headers
ffuf -u http://10.10.10.10/FUZZ -w common.txt -H "Authorization: Bearer token"
Output Interpretation
/'___\ /'___\ /'___\
/\ \__/ /\ \__/ __ __ /\ \__/
\ \ ,__\\ \ ,__\/\ \/\ \ \ \ ,__\
\ \ \_/ \ \ \_/\ \ \_\ \ \ \ \_/
\ \_\ \ \_\ \ \____/ \ \_\
\/_/ \/_/ \/___/ \/_/
___ ___ __ __ __ __ ___ __ __
/ _ ) / _)/ ) / ) / ) / / _)/ ) / )
( / ( / ( / ( / ( / ( / ( / ( / ( / (
\_) \_) \_) \_) \_) \_) \_) \_) \_) \_) \_)
Method: GET
URL: http://10.10.10.10/FUZZ
Wordlist: FUZZ: /usr/share/seclists/Discovery/Web-Content/common.txt
Engine: HTTP/1.1 (GO)
Filters: Response status: 200,301,302,403
[Status: 200, Size: 1234, Words: 567, Lines: 89]
/:
[Status: 301, Size: 234, Words: 12, Lines: 5]
/admin:
[Status: 200, Size: 567, Words: 234, Lines: 45]
/backup:
[Status: 403, Size: 198, Words: 12, Lines: 3]
/config:
16.4 dirb
Purpose and Use Cases
- Legacy directory brute forcer
- Simple and straightforward
- Built-in wordlists
Key Commands
# Basic scan
dirb http://10.10.10.10
# Custom wordlist
dirb http://10.10.10.10 /usr/share/seclists/Discovery/Web-Content/common.txt
# With extensions
dirb http://10.10.10.10 -X .php,.txt,.html,.bak
# Output to file
dirb http://10.10.10.10 -o results.txt
# Custom user agent
dirb http://10.10.10.10 -a "Mozilla/5.0"
# Recursive
dirb http://10.10.10.10 -r
# Skip output
dirb http://10.10.10.10 -S
16.5 Directory Enumeration Wordlists
| Wordlist |
Location |
Best For |
| common.txt |
SecLists |
Quick scan |
| dirb/big.txt |
dirb |
Comprehensive |
| raft-medium-directories |
Raft |
Medium coverage |
| custom |
Your own |
Target-specific |
| Discovery/Web-Content |
SecLists |
Various sizes |
16.6 Directory Enumeration Workflow
flowchart TD
A[Target URL] --> B[Quick Scan common.txt]
B --> C[Found Directories?]
C -->|Yes| D[Deep Scan big.txt]
C -->|No| E[Try Different Wordlist]
D --> F[Add Extensions]
F --> G[Recursive Scan]
G --> H[Check Each Finding]
H --> I[Document Results]
E --> B
17. Certificate Transparency Logs
17.1 What are Certificate Transparency Logs?
Publicly auditable logs of all SSL/TLS certificates issued by CAs. They reveal:
- Subdomains that have certificates
- Historical certificate data
- Internal domain names
- Development environments
17.2 crt.sh
Purpose and Use Cases
- Free certificate transparency search
- Subdomain discovery
- Historical certificate data
- No API key required
Key Commands
# Web interface
# https://crt.sh/?q=%25.example.com
# API queries
curl -s "https://crt.sh/?q=%25.example.com&output=json" | jq -r '.[].name_value' | sort -u
# Specific domain
curl -s "https://crt.sh/?q=example.com&output=json" | jq -r '.[].name_value'
# Count certificates
curl -s "https://crt.sh/?q=%25.example.com&output=json" | jq length
# Extract unique subdomains
curl -s "https://crt.sh/?q=%25.example.com&output=json" | jq -r '.[].name_value' | sed 's/\*\.//g' | sort -u
17.3 Other CT Log Sources
| Source |
URL |
Features |
| crt.sh |
https://crt.sh |
Free, no API key |
| Censys |
https://censys.io |
Comprehensive, API |
| Google CT |
https://transparencyreport.google.com/ |
Official logs |
| SecurityTrails |
https://securitytrails.com |
Historical data |
| CertSpotter |
https://certspotter.com |
Simple interface |
17.4 Attack Chain Position
- Phase: Passive reconnaissance
- Value: Hidden subdomains, internal hostnames
- Leads to: New attack surfaces, dev/staging targets
18. Passive Gathering with theHarvester and Maltego
18.1 theHarvester
Purpose and Use Cases
- Email addresses
- Subdomains
- IP addresses
- Virtual hosts
- Employee names
- Multi-source aggregation
Key Commands
# Basic harvest
theHarvester -d example.com -b all
# Specific sources
theHarvester -d example.com -b google,bing,linkedin
# Limit results
theHarvester -d example.com -b all -l 500
# Output to file
theHarvester -d example.com -b all -f harvest_results
# HTML output
theHarvester -d example.com -b all -h harvest_results.html
# JSON output
theHarvester -d example.com -b all -j harvest_results.json
# Specific source only
theHarvester -d example.com -b shodan
theHarvester -d example.com -b github
theHarvester -d example.com -b linkedin
theHarvester -d example.com -b twitter
# DNS resolution
theHarvester -d example.com -b all -n
# Takeover detection
theHarvester -d example.com -b all -t
Available Sources
| Source | Flag | Data Type |
|––––|——|
| all | all | All sources |
| google | google | Emails, hosts, IPs |
| bing | bing | Emails, hosts |
| linkedin | linkedin | Employee names |
| twitter | twitter | Usernames |
| github | github | Code, repos |
| shodan | shodan | IPs, services |
| virustotal | virustotal | Domains, IPs |
| dnsdumpster | dnsdumpster | DNS records |
| fullhunt | fullhunt | Assets, tech |
| hunter | hunter | Emails |
| netlas | netlas | Assets |
Output Interpretation
[*] Target: example.com
Hosts:
-----
1. www.example.com -> 93.184.216.34
2. mail.example.com -> 93.184.216.35
3. dev.example.com -> 93.184.216.36
IPs:
---
93.184.216.34
93.184.216.35
93.184.216.36
Emails:
------
admin@example.com
john.doe@example.com
jane.smith@example.com
Names:
------
John Doe
Jane Smith
[*] Task completed
18.2 Maltego
Purpose and Use Cases
- Visual relationship mapping
- Entity-based investigation
- Multi-source data correlation
- Graph-based analysis
- Domain research
- Person research
- Infrastructure mapping
| Entity |
Transformation |
Output |
| Domain |
DNS A Records |
IP addresses |
| Domain |
DNS MX Records |
Mail servers |
| Domain |
DNS NS Records |
Name servers |
| Domain |
DNS TXT Records |
SPF, DKIM |
| Domain |
WHOIS Details |
Registration info |
| Domain |
Subdomains |
Child domains |
| IP |
Reverse DNS |
Hostnames |
| IP |
WHOIS |
Network info |
| IP |
Shodan |
Services, banners |
| Person |
LinkedIn |
Professional info |
| Person |
Twitter |
Social media |
| Email |
Domain |
Parent domain |
| Email |
Person |
Owner info |
Maltego Workflow
flowchart TD
A[Root Domain Entity] --> B[Add DNS Transforms]
A --> C[Add WHOIS Transform]
A --> D[Add Shodan Transform]
B --> E[Expand IP Entities]
C --> F[Expand Person Entities]
D --> G[Expand Service Entities]
E --> H[Analyze Relationships]
F --> H
G --> H
H --> I[Export Graph]
I --> J[Document Findings]
Tips for OSCP
- Maltego is more useful for corporate pentests than OSCP labs
- Focus on free/community edition transforms
- Use for initial recon on real-world targets
- Export graphs for documentation
18.3 Comparison: theHarvester vs Maltego
| Feature |
theHarvester |
Maltego |
| Type |
CLI tool |
GUI application |
| Output |
Text/JSON/HTML |
Visual graph |
| Sources |
Many APIs |
Transforms |
| Learning Curve |
Low |
Medium-High |
| OSCP Value |
High |
Medium |
| Cost |
Free |
Free/Pro |
| Best For |
Quick data gathering |
Visual analysis |
| Automation |
Easy |
Manual |
19.1 Complete Reconnaissance Workflow
flowchart TD
A[Start Recon] --> B[Passive Phase]
B --> B1[WHOIS Lookup]
B --> B2[DNS Enumeration]
B --> B3[Google Dorking]
B --> B4[Shodan/Censys]
B --> B5[theHarvester]
B --> B6[CT Logs crt.sh]
B --> B7[Subdomain Enumeration]
B --> B8[Social Media Recon]
B1 --> C[Aggregate Passive Data]
B2 --> C
B3 --> C
B4 --> C
B5 --> C
B6 --> C
B7 --> C
B8 --> C
C --> D[Active Phase]
D --> D1[Nmap Host Discovery]
D1 --> D2[Nmap Port Scan]
D2 --> D3[Service Detection]
D3 --> D4[OS Fingerprinting]
D4 --> D5[Script Scanning]
D5 --> D6[Directory Enumeration]
D6 --> D7[Web Application Analysis]
D7 --> E[Document All Findings]
E --> F[Identify Attack Vectors]
F --> G[Proceed to Exploitation]
19.2 OSCP-Specific Recon Checklist
| Phase |
Task |
Tool |
Time Budget |
| Passive |
WHOIS lookup |
whois |
5 min |
| Passive |
DNS enumeration |
dig, nslookup |
10 min |
| Passive |
Google dorking |
Browser |
10 min |
| Passive |
Shodan search |
Shodan |
5 min |
| Passive |
Subdomain enum |
subfinder, amass |
15 min |
| Passive |
CT logs |
crt.sh |
5 min |
| Active |
Nmap quick scan |
nmap |
10 min |
| Active |
Nmap full scan |
nmap |
30 min |
| Active |
Service detection |
nmap -sV |
15 min |
| Active |
Script scanning |
nmap -sC |
15 min |
| Active |
Directory enum |
gobuster, ffuf |
20 min |
| Active |
Web analysis |
Browser, curl |
20 min |
| Active |
SMB/Share enum |
enum4linux, smbclient |
10 min |
| Active |
SNMP enum |
snmpwalk |
5 min |
| Active |
FTP enum |
ftp, nmap scripts |
5 min |
| Active |
SSH enum |
nmap scripts |
5 min |
| Active |
Database enum |
nmap scripts |
5 min |
| Total |
|
|
~2.5 hours |
19.3 Notes Taking Template
# Target: 10.10.10.10
## Passive Recon
- Domain: example.com
- WHOIS: Registrant, Name Servers
- DNS Records: A, MX, NS, TXT
- Subdomains: www, mail, dev, admin
- Shodan: Exposed services
- Google Dorks: Found resources
## Active Recon
### Nmap Results
- Open Ports: 22, 80, 443, 3306
- Services: SSH, HTTP, HTTPS, MySQL
- OS: Linux 5.4
### Directory Enumeration
- /admin (301)
- /backup (200)
- /.env (200)
- /config (403)
### Web Application
- Technology: Apache 2.4.41
- Framework: None detected
- Interesting pages: /admin, /backup
## Attack Vectors
1. SSH brute force (port 22)
2. Web app exploitation (port 80)
3. MySQL access (port 3306)
4. Exposed .env file
5. Backup files in /backup
20. Cheat Sheet Summary
20.1 Quick Reference — Essential Commands
# === PASSIVE RECON ===
# WHOIS
whois example.com
whois 93.184.216.34
# DNS
dig example.com A
dig example.com MX
dig example.com TXT
dig axfr @ns1.example.com example.com
dig example.com ANY +noall +answer
# Google Dorking
# site:target.com intitle:"Index of /"
# site:target.com filetype:php
# site:target.com inurl:admin
# Shodan
shodan search "org:Target Company"
shodan ip 93.184.216.34
# theHarvester
theHarvester -d example.com -b all -l 500
# Subdomains
subfinder -d example.com -o subs.txt
amass enum -passive -d example.com -o subs.txt
gobuster dns -d example.com -w subdomains.txt
# CT Logs
curl -s "https://crt.sh/?q=%25.example.com&output=json" | jq -r '.[].name_value' | sort -u
# === ACTIVE RECON ===
# Nmap — Host Discovery
nmap -sn 10.10.10.0/24
# Nmap — Quick Scan
nmap -sS -T4 -p- --open 10.10.10.10
# Nmap — Service Detection
nmap -sV -sC -T4 -p 22,80,443,3306 10.10.10.10
# Nmap — OS Detection
nmap -O -sV 10.10.10.10
# Nmap — Aggressive
nmap -A -T4 -p- 10.10.10.10
# Nmap — UDP
nmap -sU -T4 --top-ports 100 10.10.10.10
# Nmap — Scripts
nmap --script vuln 10.10.10.10
nmap --script smb-enum-shares 10.10.10.10
nmap --script http-enum -p 80 10.10.10.10
# Directory Enumeration
gobuster dir -u http://10.10.10.10 -w common.txt -x php,txt,html,bak -r
ffuf -u http://10.10.10.10/FUZZ -w common.txt -mc 200,301,302,403
# Banner Grabbing
curl -I http://10.10.10.10
echo | nc 10.10.10.10 22
echo | nc 10.10.10.10 80
# SMB Enumeration
enum4linux -a 10.10.10.10
smbclient -L \\\\10.10.10.10
# SNMP Enumeration
snmpwalk -v2c -c public 10.10.10.10
# FTP Enumeration
ftp 10.10.10.10
nmap --script ftp-anon -p 21 10.10.10.10
| Goal |
Primary Tool |
Alternative |
Notes |
| DNS lookup |
dig |
nslookup |
dig is more powerful |
| Port scanning |
nmap |
masscan |
nmap for detail, masscan for speed |
| Service detection |
nmap -sV |
Manual banner |
nmap is comprehensive |
| OS detection |
nmap -O |
TTL analysis |
nmap is most accurate |
| Dir enumeration |
gobuster |
ffuf, dirb |
gobuster is reliable |
| Subdomain enum |
subfinder |
amass, gobuster |
Combine multiple tools |
| Email harvest |
theHarvester |
Google dorking |
theHarvester is broader |
| Visual mapping |
Maltego |
Manual notes |
Maltego for complex targets |
| CT logs |
crt.sh |
Censys |
crt.sh is free and easy |
| Vuln scanning |
nmap scripts |
Nikto |
nmap scripts are built-in |
20.3 Common Pitfalls and Tips
| Pitfall |
Solution |
| Missing ports |
Always scan all 65535 ports (-p-) |
| Filtered ports |
Try -Pn to skip host discovery |
| Slow scans |
Use -T4 timing, limit ports first |
| False negatives |
Cross-reference with multiple tools |
| Missing subdomains |
Use passive + active + CT logs |
| Overlooking UDP |
Always check common UDP ports |
| Ignoring redirects |
Follow 301/302 responses |
| Not checking 403 |
403 means the resource exists |
| Skipping scripts |
Always run -sC default scripts |
| No notes |
Document everything as you go |
20.4 OSCP Exam Tips
- Always scan all ports —
-p- is mandatory
- Save all output — Use
-oA for all formats
- Check NSE scripts —
-sC finds hidden directories and services
- Don’t skip UDP — SNMP and DNS are common targets
- Enumerate directories — gobuster/ffuf on every web service
- Check for backups — Look for
.bak, .old, .zip, .tar.gz
- Read error messages — They often reveal paths and versions
- Document everything — Notes are required for the report
- Time management — Don’t spend too long on recon; move to exploitation
- Think laterally — One finding often leads to another
Appendix A: Nmap Script Categories
| Category |
Description |
Example Scripts |
| default |
Safe, commonly useful |
http-enum, ssl-cert |
| safe |
Non-intrusive |
All default scripts |
| discovery |
Network discovery |
dns-brute, smb-enum-shares |
| auth |
Authentication |
http-auth, ftp-anon |
| brute |
Brute force |
ftp-brute, ssh-brute |
| vuln |
Vulnerability detection |
ssl-heartbleed, smb-vuln-ms17-010 |
| exploit |
Exploitation |
http-shellshock |
| external |
External services |
http-google-search |
| intrusive |
May cause issues |
All brute/vuln scripts |
Appendix B: Common Port Reference
| Port |
Service |
Common Vulns |
| 21 |
FTP |
Anonymous access, weak auth |
| 22 |
SSH |
Weak keys, brute force |
| 23 |
Telnet |
Cleartext credentials |
| 25 |
SMTP |
Open relay, user enum |
| 53 |
DNS |
Zone transfer, amplification |
| 80 |
HTTP |
Web vulns, directory listing |
| 110 |
POP3 |
Cleartext credentials |
| 135 |
MSRPC |
Windows services |
| 139 |
NetBIOS |
SMB shares |
| 143 |
IMAP |
Cleartext credentials |
| 443 |
HTTPS |
SSL/TLS vulns |
| 445 |
SMB |
EternalBlue, shares |
| 993 |
IMAPS |
Encrypted IMAP |
| 995 |
POP3S |
Encrypted POP3 |
| 1433 |
MSSQL |
SQL injection, weak auth |
| 1521 |
Oracle DB |
Weak auth |
| 3306 |
MySQL |
Weak auth, default creds |
| 3389 |
RDP |
BlueKeep, brute force |
| 5432 |
PostgreSQL |
Weak auth |
| 5900 |
VNC |
Weak auth, cleartext |
| 6379 |
Redis |
No auth, RCE |
| 8080 |
HTTP-Alt |
Web apps, proxies |
| 8443 |
HTTPS-Alt |
Web apps |
| 27017 |
MongoDB |
No auth, data exposure |
Appendix C: SecLists Wordlist Locations
/usr/share/seclists/
├── Discovery/
│ ├── DNS/
│ │ ├── subdomains-top1million-5000.txt
│ │ ├── subdomains-top1million-11000.txt
│ │ └── subdomains-top1million-20000.txt
│ └── Web-Content/
│ ├── common.txt
│ ├── common-large.txt
│ └── directory-list-2.3-small.txt
├── Passwords/
│ ├── Common/
│ │ └── 10-million-password-list-top-1000000.txt
│ └── Named/
└── Usernames/
├── Names/
└── Custome-Usernames/
Remember: Information gathering is iterative. Each finding should lead to new questions and new searches. The more you know, the more you can find. Document everything — your future self (and your examiner) will thank you.
Last updated: August 2026
For OSCP preparation — always verify commands in your lab environment