UnixDroid

Lesson 8 of 12 · 8 min

Web scraping for OSINT recon

Open-source intelligence lives on web pages. Here is how Python turns a human-readable page into structured data you can act on.

Open-source intelligence (OSINT) is the art of learning about a target from public information — and a huge amount of it lives on web pages. This lesson shows how Python turns a human-readable page into structured data you can act on.

Why scraping is a recon skill

A company's own website leaks useful detail: employee names, email formats, technologies, document links. Reading one page by hand is fine; reading a hundred isn't. Scraping automates the reading.

Fetch the page

import requests

r = requests.get('https://example.com')
html = r.text
print(len(html), 'characters downloaded')

Pull out the useful bits

BeautifulSoup parses messy HTML into something you can query.

from bs4 import BeautifulSoup

soup = BeautifulSoup(html, 'html.parser')

# every link on the page
for link in soup.find_all('a'):
    print(link.get('href'))

Harvesting all the links can reveal hidden pages, PDFs and login portals.

Finding emails with regex

import re

emails = re.findall(r'[\\w.+-]+@[\\w-]+\\.[\\w.-]+', html)
print(set(emails))   # unique ones

Spot the email pattern — first.last@company.com — and you can often guess every employee's address.

ToolTurns......into
requestsA URLRaw HTML text
BeautifulSoupRaw HTMLLinks, headings, tables
re (regex)TextEmails, phone numbers, keys

Tip: Respect robots.txt and a site's terms, add delays between requests, and never scrape login-protected or personal data you aren't authorised to collect. OSINT uses public information — the moment you bypass an access control, it stops being OSINT and becomes intrusion.

From data to insight

Scraping is only step one. The skill is turning a pile of links and emails into a picture of the target — its people, its tech, its weak spots — which is exactly what a real engagement's recon phase produces.

Try it yourself
  1. Scrape your own site (or example.com) and print every link.
  2. Count how many links point to another domain.
  3. Run the email regex over the page text and print the unique matches.
No Linux machine? Practise in the free online terminal

Quick check

What's the name for intelligence gathered entirely from public information sources?

Need a hint?

Open-Source INTelligence, as an acronym.

Finished this lesson?

Done lessons keep your daily streak going 🔥

0 day streak

0 lessons done

best 0 days

Log in to keep your streak on every device →