Subdomain enumeration was the last big item on the roadmap for my OSINT recon tool, and the one I’d put off longest. The usual approach is a wordlist: take a few thousand likely names, prepend each one to the target domain, and see what resolves. It works, and it’s also loud. Every guess is a DNS query that ends up in somebody’s logs, thousands of them in a burst. I want this tool to stay passive by design, something I can point at anything I’m authorized to look at without generating that kind of noise. So v0.4.0 finds subdomains without guessing, apart from ten names short enough to pass as ordinary traffic.

Certificate transparency does the heavy lifting

Every publicly trusted TLS certificate gets recorded in Certificate Transparency logs. That’s a requirement browsers enforce, and the logs are public. Request a certificate for vpn.example.com and that hostname is now permanently searchable. crt.sh is a free search front end for those logs, and querying it for %.example.com returns every certificate ever issued for a name under that domain. The request goes to crt.sh. Nothing touches the target.

The raw results need real cleanup. Each certificate’s name_value field holds one or more hostnames separated by newlines, in whatever case the issuer used, sometimes with trailing dots, and occasionally with an email address mixed in from the certificate subject. Scoping needs care too. The % wildcard in the query matches on string patterns, so lookalike domains show up. The check that a name belongs to the target uses endswith("." + domain), with the leading dot. Without it, notexample.com passes as a subdomain of example.com. A plain “contains” check is worse still, since it would also accept example.com.evil.net.

Expired certificates stay in the logs, and I decided that’s a feature. A legacy-vpn certificate from 2021 tells you that host existed, even if it’s long gone. The tool reads each certificate’s expiry date and labels every name as current, if at least one unexpired certificate covers it, or historical if it only appears on expired ones. Wildcard certificates like *.example.com get reported separately, since they confirm a wildcard cert exists without naming any actual host.

The wildcard DNS trap

On top of the CT results, the tool checks ten predictable names: www, mail, autodiscover, vpn and a few others. Ten lookups is nothing. But it opens a trap I nearly walked into.

Some domains run wildcard DNS, meaning a *.example.com record answers for any name at all. Under wildcard DNS, every guessed name resolves. Without accounting for that, the tool would happily report ten subdomains that don’t exist. The fix is to resolve a random nonsense label first, something like wildcard-check-9f3a1c.example.com. No real host has that name. If it resolves anyway, wildcard DNS is on, and the tool now knows exactly which address the wildcard answers with. Guessed names that resolve only to that address get thrown out, and CT names that resolve only to it get flagged as unreliable instead of reported as live.

I tested that path with a simulated wildcard domain. Eight of the ten common names “resolved,” all to the wildcard address, and all eight were suppressed. The two that came back with distinct addresses were the two that actually existed.

Discovered names then get resolved to IPv4, ten lookups at a time in parallel and capped at 100 names per scan. Large organizations can have thousands of names in CT logs, and the cap keeps a scan from turning into an afternoon. Names past the cap still get listed, marked as not resolved.

Failing honestly

One distinction ended up mattering more than I expected. If crt.sh is unreachable, the fetch returns None. If crt.sh answers with no certificates, it returns an empty list. Collapsing those two into an empty list would have been easier, and it would have been wrong. A crt.sh outage would then print as “no subdomains found,” a false negative dressed up as a finding. Instead the tool says plainly that the CT lookup failed and carries on with the common-name checks, and the written report says the same thing.

That paid off immediately. The first live run against my own domain got an HTTP 502 from crt.sh, which is overloaded a lot. The tool reported the failure and fell back exactly as designed. It also meant the CT parser still hadn’t seen a real response, so I held off on tagging the release. The second run went through: one unique name in the CT logs, www, from the certificate GitHub Pages issues for the site. The apex domain was excluded, correctly, since it’s the target and not a subdomain of itself. autodiscover came back from the common-name list, which matches the CNAME I set up for Exchange Online. And www showed up tagged from both sources and was counted once.

The 502 became a feature

A CT feature that loses its whole data source on a single 502 isn’t finished, so before tagging I added one automatic retry after a five-second pause. The interesting part was deciding what deserves a retry. Timeouts, dropped connections, HTTP 429 and the 5xx range all mean busy or temporarily broken. A 404 or a malformed response means the request will fail the same way again, and retrying it just burns time against somebody else’s free service. Those fail immediately.

Adding the retry made the test suite jump from about 0.2 seconds to 20. Four existing failure tests were now retryable, and each one genuinely slept five seconds. The fix was a pytest fixture that swaps out time.sleep for every test in the file and records each pause instead, so tests can also assert the tool waited exactly once between two attempts and never after the last one.

Before trusting any of it, I broke the code on purpose: removed the dot from the scope check, let guessed names through under wildcard DNS, made every HTTP error retryable, made the tool sleep after its final attempt. Every one of those got caught by at least one failing test, which is how I know the 132 passing tests are actually testing something. Network-dependent code runs against fakes, canned crt.sh responses and simulated DNS answers, so the suite still needs no network access and runs in under a second.

The most useful test of this release was the run that returned a 502. It proved the failure path on live infrastructure before the success path ever worked, and it turned a retry I hadn’t planned into part of v0.4.0.

The code is on GitHub at github.com/Jorgy762/osint-domain-recon. Same rule as always: only run it against domains you own or have explicit written permission to test.