Check a suspicious link, e-mail, invoice, investment offer, listing, crypto request or call safely: urlscan.io, VirusTotal, Wayback, RDAP, SPF/DKIM/DMARC, company registers and block explorers, plus a read-only Django link-check command with mocked tests.
Sooner or later something arrives that feels wrong: an invoice with new bank details, a "verify your account" link, a listing that is too cheap, an investment offer with guaranteed returns, or a request to pay in crypto. This tutorial is a defender's toolkit for checking that artefact safely: for each tool, what to put in, what the result means, where it stops being reliable, and what it does with your data. We finish with a read-only Django command that collects signals about a suspicious link without ever visiting it, and a small parser for e-mail authentication headers, both with tests.
Everything here is about checking an artefact you received: a link, a message, an invoice, a payment request, a phone number that called you. It is not about investigating, profiling or locating the person behind it. If the trail leads to a person, stop and hand it to your bank, the police or the impersonated organisation.
Data protection applies to you too. Under the GDPR, pasting a customer's e-mail, a colleague's invoice or someone's phone number into a third-party website is processing of personal data, and often a transfer to a party you have no agreement with. Practise data minimisation: submit the smallest thing that answers your question (a domain instead of a full URL, a hash instead of a file, headers instead of the whole message), redact names and addresses that are not needed, and never paste data belonging to customers or colleagues into public tools. This tutorial is not legal advice; if a case involves real losses or personal data breaches, involve your data protection officer or a lawyer.
Versions used, all latest stable at the time of writing: Python 3.13, Django 5.2.20 (pinned Django>=5.2,<6.0 for the LTS line), requests 2.34.2, tldextract 5.4.0 and responses 0.26.3 for tests.
First read the link as text (copy link address) and find the registrable domain: the label just left of the public suffix. In https://login.example.com.example.net/verify the domain that matters is example.net; everything before it is decoration the owner of example.net chose. In https://example.com@example.net/pay the text before the @ is a username, not the host. Lookalike tricks such as swapped letters and Unicode homoglyphs are covered in depth in tutorial 04 of this series.
Input: a URL or a search query. Output: a sandboxed browser visit with a screenshot, the redirect chain, contacted domains and IP addresses, and any brand the page appears to imitate.
Scan visibility matters more than anything else on this site. A public scan is listed on the front page and in search results for everyone. An unlisted scan is hidden from the public but available to vetted security researchers and paying platform customers. A private scan is visible only to your account. Phishing links often carry tokens tied to your address; a public scan publishes them, and the scanner's visit tells the sender the link was opened.
So start by searching existing scans for the domain (for example page.domain:example.net). If you do scan, strip query strings and personal identifiers first, use private or unlisted visibility, and never scan URLs that belong to customers, internal systems or anything containing a token. Limits: phishing kits often show scanners a harmless page, so a clean screenshot proves little.
Input: a URL, domain, IP address or file hash. Output: verdicts from dozens of security vendors. Prefer existing reports: compute a SHA-256 of a suspicious attachment locally (sha256sum invoice.pdf or Get-FileHash invoice.pdf) and search the hash. Never upload confidential files. Submissions are shared with security partners and premium subscribers can download them, so a contract uploaded "just to check" may be read by strangers. Limits: "0 detections" on a URL created an hour ago means nobody has looked yet, and a single vendor flagging a domain can be a false positive.
Fake shops often claim a long history: "trusted since 2009". The Wayback Machine shows what the domain actually served and when. Input: the domain. Output: snapshot dates and archived pages. Fifteen claimed years with a first snapshot from last month deserves suspicion, and so does a domain that recently switched from a bakery to a crypto platform (an expired domain bought for its age). Limits: not every site is archived, owners can request exclusion, and absence of snapshots proves nothing on its own. Looking up a domain here is a low-risk query, but "Save Page Now" makes your submitted URL public.
RDAP (Registration Data Access Protocol) is the structured JSON successor to WHOIS, and since January 2025 it is the authoritative source for generic top-level domains. Query https://rdap.org/domain/example.net and the bootstrap service redirects you to the right registry. Look for the event with eventAction equal to registration. What it means: a domain registered nine days ago that claims to be an established bank is a strong signal. Limits: registrant details are usually redacted, country-code coverage varies, and old domains can be bought.
The display name and From address are chosen by the sender. Open the raw source ("Show original") and look at two header groups.
Each server that handles the message adds a Received header at the top; read them bottom up to follow the path. Only the topmost ones, added by your own provider, are trustworthy; anything below can be fabricated. A "bank" message that entered the internet through an unrelated mail host is worth noting, but header IP addresses are not a way to identify anyone.
Return-Path), not the visible From.header.d=) over the message headers and body.From domain.Your provider records the outcome in an Authentication-Results header. Trust only the topmost one, which your provider added; a sender can insert fake ones further down. A typical spoof: spf=pass and dkim=pass for example.net, but dmarc=fail because the From says example.com.
Pass does not mean honest. SPF, DKIM and DMARC prove which domain sent the message, not that the content is true. A lookalike domain passes all three in minutes, and a fail can come from a badly configured legitimate sender.
MXToolbox has an online header analyser; remove your own address and other personal details before pasting. Whether your address appears in breaches (Have I Been Pwned) is covered in tutorial 03.
Invoice fraud and fake investment firms borrow legitimacy: a company name, registration number, VAT number or licence claim. Verify each claim at the source, and check that the details match each other.
| Tool | Input | What a result means | Limits |
|---|---|---|---|
| KVK Handelsregister | Company name or 8-digit KVK number | The entity exists in the Dutch trade register, with legal form and registered address | Scammers copy real KVK numbers of real firms; check that the name, address and website on the invoice match the register |
| EU VIES | Country code and VAT number | The VAT number is valid for intra-EU trade; some member states also return name and address | Valid number is not proof the sender owns it |
| OpenCorporates | Company name or number | Aggregated registry records across many jurisdictions | Can lag behind the official register; confirm in the source registry |
| IOSCO I-SCAN | Firm or website name | Warnings published by securities regulators worldwide | Only covers firms a regulator has already flagged |
| AFM warning list and register, DNB register | Firm name or website | Whether a party is flagged for offering services without a licence, or holds a Dutch licence | Clone firms impersonate licensed firms; contact them only via details in the register |
A registered company can still commit fraud, and absence from a warning list is not approval: regulators publish warnings only after complaints arrive. For a changed bank account on an invoice, call the supplier on a number you already had, never one from the message.
Rental and marketplace scams reuse photos from genuine listings. TinEye reverse image search takes an image and returns other places it appears, sortable by date. An "apartment in Utrecht" photo found in a foreign listing years earlier is a strong signal. Limits: the oldest hit is only the oldest copy TinEye crawled, not necessarily the original. Use it on photos of objects and property, not on photos of people, and do not upload private documents.
Crypto requests come in two shapes: "pay this address" and "I already paid, here is proof". For an address, Chainabuse collects community scam reports. They are unverified both ways: a report may be mistaken or malicious, and an unreported address may simply be new.
For a claimed payment, look up the transaction hash yourself on a block explorer such as Etherscan (Ethereum) or Blockchair (many chains). Check that it exists and succeeded, the confirmations, the receiving address character for character, and the asset: a token named "USDT" from an unknown contract is not the real stablecoin. Beware address poisoning: tiny transfers from lookalike addresses, hoping you copy one from your history. Addresses are pseudonymous, and tracing them is work for investigators, not for you. Above all: crypto transactions are irreversible. There is no chargeback, and "recovery services" that promise to get your money back are a well-known second scam.
Tellows shows community comments and a score for a phone number that called you. Comments are unverified, and the number may be spoofed: caller ID is trivial to fake, and bank helpdesk fraud often shows the bank's real number. The only reliable check is to hang up and call back via a number you look up yourself, such as the one on your bank card.
The helper below takes a suspicious URL, normalises it, extracts the registrable domain, asks RDAP for the registration date, asks the Wayback availability API for the earliest snapshot, and, only if an API key is configured, fetches an existing VirusTotal URL report. It never requests the suspicious URL itself and never submits anything. It prints signals, not a score.
Create a venv, a project (django-admin startproject config .) and an app (python manage.py startapp linkcheck) with a management/commands package, then install:
# requirements.txt
Django>=5.2.20,<6.0
requests>=2.34.2,<3.0
tldextract>=5.4.0,<6.0
responses>=0.26.3,<1.0
In config/settings.py, add "linkcheck" to INSTALLED_APPS and two settings. The User-Agent names the tool and its purpose without personal details; the timeout tuple bounds both connecting and reading.
# Link check helper: read-only lookups, no personal details in the User-Agent.
LINKCHECK_USER_AGENT = "linkcheck-tutorial/1.0 (+defensive URL triage)"
LINKCHECK_TIMEOUT = (3.05, 10) # connect, read in seconds
The module has no Django imports, so it is reusable anywhere. Note that tldextract uses its bundled public suffix snapshot (suffix_list_urls=()), so it does not download anything at runtime; every request goes through one helper that turns network errors into a readable signal instead of a crash; and the VirusTotal URL ID is the URL encoded as base64url without padding, as API v3 expects for GET /urls/{id}.
# linkcheck/signals.py
"""Read-only signals for a suspicious URL. Never fetches the URL itself."""
import base64
import ipaddress
import os
from dataclasses import dataclass
from datetime import datetime, timezone
from urllib.parse import urlsplit
import requests
import tldextract
# Offline public suffix list snapshot: no download at runtime.
_extract = tldextract.TLDExtract(suffix_list_urls=())
RDAP_URL = "https://rdap.org/domain/{}"
WAYBACK_URL = "https://archive.org/wayback/available"
VT_URL = "https://www.virustotal.com/api/v3/urls/{}"
@dataclass
class Signal:
name: str
value: str
note: str = ""
def normalise(raw: str) -> str:
"""Refang common defanging and add a scheme so urlsplit works."""
url = raw.strip().replace("[.]", ".").replace("(.)", ".")
if url.lower().startswith(("hxxp://", "hxxps://")):
url = "http" + url[4:]
if "://" not in url:
url = "http://" + url
return url
def registrable_domain(url: str) -> str:
host = urlsplit(url).hostname or ""
return _extract(host).top_domain_under_public_suffix
def _get(session, url, **kwargs):
try:
resp = session.get(url, timeout=session.linkcheck_timeout, **kwargs)
except requests.RequestException as exc:
return None, f"network error: {exc.__class__.__name__}"
return resp, None
def rdap_registration(session, domain: str):
resp, err = _get(session, RDAP_URL.format(domain))
if err:
return None, err
if resp.status_code == 404:
return None, "no RDAP record (unregistered, or TLD without RDAP)"
if resp.status_code != 200:
return None, f"RDAP HTTP {resp.status_code}"
for event in resp.json().get("events", []):
if event.get("eventAction") == "registration":
return datetime.fromisoformat(event["eventDate"].replace("Z", "+00:00")), None
return None, "RDAP record has no registration date"
def wayback_first(session, url: str):
params = {"url": url, "timestamp": "19960101"}
resp, err = _get(session, WAYBACK_URL, params=params)
if err:
return None, err
if resp.status_code != 200:
return None, f"Wayback HTTP {resp.status_code}"
snap = resp.json().get("archived_snapshots", {}).get("closest")
if not snap:
return None, "no snapshot"
return datetime.strptime(snap["timestamp"], "%Y%m%d%H%M%S").replace(tzinfo=timezone.utc), None
def vt_url_id(url: str) -> str:
return base64.urlsafe_b64encode(url.encode()).decode().rstrip("=")
def vt_existing_report(session, url: str, api_key: str):
"""GET an existing report only. Never POST, never submit."""
resp, err = _get(session, VT_URL.format(vt_url_id(url)),
headers={"x-apikey": api_key})
if err:
return None, err
if resp.status_code == 404:
return None, "no existing report (not submitted by us)"
if resp.status_code != 200:
return None, f"VirusTotal HTTP {resp.status_code}"
return resp.json()["data"]["attributes"].get("last_analysis_stats", {}), None
def make_session(user_agent: str, timeout) -> requests.Session:
session = requests.Session()
session.headers["User-Agent"] = user_agent
session.headers["Accept"] = "application/json, application/rdap+json"
session.linkcheck_timeout = timeout
return session
def collect(raw: str, session, now=None) -> list[Signal]:
now = now or datetime.now(timezone.utc)
url = normalise(raw)
parts = urlsplit(url)
host = parts.hostname or ""
signals = [Signal("normalised URL", url)]
try:
ipaddress.ip_address(host)
signals.append(Signal("host", host, "raw IP address instead of a name"))
return signals
except ValueError:
pass
domain = registrable_domain(url)
signals.append(Signal("registrable domain", domain or "?",
"punycode: check for lookalike letters" if "xn--" in host else ""))
if parts.username:
signals.append(Signal("userinfo", parts.username,
"text before @ is not the real host"))
signals.append(Signal("scheme", parts.scheme,
"" if parts.scheme == "https" else "no TLS"))
registered, err = rdap_registration(session, domain) if domain else (None, "no domain")
if registered:
days = (now - registered).days
signals.append(Signal("domain age", f"{days} days ({registered:%Y-%m-%d})",
"very new" if days < 90 else ""))
else:
signals.append(Signal("domain age", "unknown", err))
first, err = wayback_first(session, domain or host)
signals.append(Signal("first archived", f"{first:%Y-%m-%d}" if first else "none",
err or ""))
api_key = os.environ.get("VT_API_KEY")
if not api_key:
signals.append(Signal("VirusTotal", "skipped", "set VT_API_KEY to look up"))
else:
stats, err = vt_existing_report(session, url, api_key)
value = ", ".join(f"{k}={v}" for k, v in stats.items()) if stats else "n/a"
signals.append(Signal("VirusTotal", value, err or "existing report only"))
return signals
# linkcheck/management/commands/check_link.py
from django.conf import settings
from django.core.management.base import BaseCommand
from linkcheck.signals import collect, make_session
class Command(BaseCommand):
help = "Read-only signals for a suspicious URL (never visits the URL itself)."
def add_arguments(self, parser):
parser.add_argument("url")
def handle(self, *args, url, **options):
session = make_session(settings.LINKCHECK_USER_AGENT, settings.LINKCHECK_TIMEOUT)
signals = collect(url, session)
width = max(len(s.name) for s in signals)
for s in signals:
note = f" [{s.note}]" if s.note else ""
self.stdout.write(f"{s.name:<{width}} {s.value}{note}")
self.stdout.write("\nSignals, not proof. Correlate with other checks before deciding.")
A real run against the reserved documentation domain, entered in defanged form as it would appear in a ticket. This made exactly two requests, one to RDAP and one to the Wayback API; no VirusTotal key was set.
python manage.py check_link "hxxps://example[.]com/login"
normalised URL https://example.com/login
registrable domain example.com
scheme https
domain age 11436 days (1995-08-14)
first archived 2002-01-20
VirusTotal skipped [set VT_API_KEY to look up]
Signals, not proof. Correlate with other checks before deciding.
A 31-year-old domain archived since 2002 is what a long-established name looks like; a nine-day-old domain with no snapshots claiming to be your bank is a reason to stop. The Wayback API returns the snapshot closest to the requested timestamp, which approximates the first capture but is not guaranteed to be it.
The second helper reads only the headers of a pasted .eml and takes results from the topmost Authentication-Results, ignoring any lower ones a sender could have planted.
# linkcheck/headers.py
"""Extract SPF/DKIM/DMARC results from a pasted .eml (headers only)."""
import re
from email import policy
from email.parser import BytesHeaderParser
from email.utils import parseaddr
RESULT = re.compile(r"\b(spf|dkim|dmarc)=(\w+)", re.IGNORECASE)
def auth_results(raw: bytes) -> dict:
msg = BytesHeaderParser(policy=policy.default).parsebytes(raw)
# The topmost Authentication-Results is added by YOUR receiving server.
# Lower ones may have been forged by the sender, so only trust the first.
headers = msg.get_all("Authentication-Results") or []
found = {}
if headers:
for key, value in RESULT.findall(str(headers[0])):
found.setdefault(key.lower(), value.lower())
from_domain = parseaddr(str(msg.get("From", "")))[1].rpartition("@")[2].lower()
return_path = parseaddr(str(msg.get("Return-Path", "")))[1].rpartition("@")[2].lower()
return {
"spf": found.get("spf", "none"),
"dkim": found.get("dkim", "none"),
"dmarc": found.get("dmarc", "none"),
"from_domain": from_domain,
"return_path_domain": return_path,
"received_hops": len(msg.get_all("Received") or []),
}
>>> from linkcheck.headers import auth_results
>>> from linkcheck.tests import SYNTHETIC
>>> auth_results(SYNTHETIC)
{'spf': 'pass', 'dkim': 'pass', 'dmarc': 'fail', 'from_domain': 'example.com', 'return_path_domain': 'example.net', 'received_hops': 2}
That is the classic pattern from earlier: SPF and DKIM pass for example.net, DMARC fails because the visible sender is example.com, and the forged "all pass" header below it was correctly ignored.
The responses library fails any unregistered request, so tests can never reach a real service. Note the assertion that the VirusTotal path only ever sends GET.
# linkcheck/tests.py
import os
from datetime import datetime, timezone
from io import StringIO
from unittest import mock
import requests
import responses
from django.core.management import call_command
from django.test import SimpleTestCase
from linkcheck import signals as s
from linkcheck.headers import auth_results
NOW = datetime(2026, 12, 5, tzinfo=timezone.utc)
RDAP = "https://rdap.org/domain/example.net"
def by_name(result):
return {sig.name: sig for sig in result}
class NormaliseTests(SimpleTestCase):
def test_refang_and_registrable_domain(self):
url = s.normalise(" hxxps://login.example.com.example[.]net/verify ")
self.assertEqual(url, "https://login.example.com.example.net/verify")
self.assertEqual(s.registrable_domain(url), "example.net")
def test_userinfo_trick(self):
url = s.normalise("https://example.com@example.net/pay")
self.assertEqual(s.registrable_domain(url), "example.net")
def test_vt_id_is_unpadded_base64url(self):
self.assertEqual(s.vt_url_id("http://example.com/"), "aHR0cDovL2V4YW1wbGUuY29tLw")
@mock.patch.dict(os.environ, {"VT_API_KEY": ""})
class CollectTests(SimpleTestCase):
def setUp(self):
self.session = s.make_session("test-agent", 1)
@responses.activate
def test_young_domain_no_snapshot_vt_skipped(self):
responses.get(RDAP, json={"events": [
{"eventAction": "registration", "eventDate": "2026-11-20T08:00:00Z"}]})
responses.get(s.WAYBACK_URL, json={"archived_snapshots": {}})
out = by_name(s.collect("https://example.com@example.net/pay", self.session, NOW))
self.assertIn("14 days", out["domain age"].value)
self.assertEqual(out["domain age"].note, "very new")
self.assertEqual(out["first archived"].value, "none")
self.assertEqual(out["VirusTotal"].value, "skipped")
self.assertIn("not the real host", out["userinfo"].note)
self.assertEqual(len(responses.calls), 2)
self.assertEqual(responses.calls[0].request.headers["User-Agent"], "test-agent")
@responses.activate
def test_network_errors_are_reported_not_raised(self):
responses.get(RDAP, body=requests.ConnectionError("down"))
responses.get(s.WAYBACK_URL, body=requests.Timeout("slow"))
out = by_name(s.collect("example.net", self.session, NOW))
self.assertEqual(out["domain age"].note, "network error: ConnectionError")
self.assertEqual(out["first archived"].note, "network error: Timeout")
@responses.activate
def test_ip_literal_stops_early(self):
out = by_name(s.collect("http://192.0.2.10/login", self.session, NOW))
self.assertIn("raw IP", out["host"].note)
self.assertEqual(len(responses.calls), 0)
@responses.activate
def test_virustotal_lookup_is_get_only(self):
url = "https://example.net/pay"
responses.get(RDAP, status=404)
responses.get(s.WAYBACK_URL, json={"archived_snapshots": {"closest": {
"timestamp": "20240102030405", "available": True}}})
responses.get(s.VT_URL.format(s.vt_url_id(url)), json={"data": {"attributes": {
"last_analysis_stats": {"malicious": 3, "harmless": 60}}}})
with mock.patch.dict(os.environ, {"VT_API_KEY": "dummy"}):
out = by_name(s.collect(url, self.session, NOW))
self.assertEqual(out["VirusTotal"].value, "malicious=3, harmless=60")
self.assertEqual(out["first archived"].value, "2024-01-02")
self.assertIn("no RDAP record", out["domain age"].note)
self.assertEqual({c.request.method for c in responses.calls}, {"GET"})
self.assertEqual(responses.calls[2].request.headers["x-apikey"], "dummy")
@responses.activate
def test_command_prints_table_and_disclaimer(self):
responses.get(RDAP, json={"events": [
{"eventAction": "registration", "eventDate": "2001-03-04T00:00:00Z"}]})
responses.get(s.WAYBACK_URL, json={"archived_snapshots": {}})
out = StringIO()
call_command("check_link", "example.net", stdout=out)
self.assertIn("registrable domain example.net", out.getvalue())
self.assertIn("Signals, not proof.", out.getvalue())
SYNTHETIC = b"""\
Authentication-Results: mx.example.org; spf=pass smtp.mailfrom=example.net;
dkim=pass header.d=example.net; dmarc=fail header.from=example.com
Authentication-Results: forged.example.net; spf=pass; dkim=pass; dmarc=pass
Received: from mail.example.net (mail.example.net [198.51.100.7]) by mx.example.org
Received: from [203.0.113.50] by mail.example.net
Return-Path: <bounce@example.net>
From: "Example Bank" <security@example.com>
Subject: Urgent: verify your account
body is ignored
"""
class HeaderTests(SimpleTestCase):
def test_trusts_only_topmost_results(self):
r = auth_results(SYNTHETIC)
self.assertEqual((r["spf"], r["dkim"], r["dmarc"]), ("pass", "pass", "fail"))
self.assertEqual(r["from_domain"], "example.com")
self.assertEqual(r["return_path_domain"], "example.net")
self.assertEqual(r["received_hops"], 2)
python manage.py test linkcheck
Found 9 test(s).
System check identified no issues (0 silenced).
.........
----------------------------------------------------------------------
Ran 9 tests in 0.034s
OK
report@phishing.gov.uk; internationally the APWG accepts reportphishing@apwg.org.Do not click, reply, pay or "hack back". Do not try to unmask, contact or shame the sender; that can expose you legally and can harm an innocent person whose identity was stolen.
Found a mistake in this tutorial? Let us know and we will fix it.