certgraph
Crawler de logs de certificate transparency et constructeur de graphe de domaines. Cartographie les relations entre certificats pour découvrir sous-domaines, domaines liés et connexions d'infrastructure. Certificate transparency log crawler and domain graph builder. Maps certificate relationships to discover subdomains, related domains, and infrastructure connections.
↗ https://github.com/lanrat/certgraphOverview
certgraph crawls certificate transparency logs to build a graph of domain relationships. Given a starting domain, it finds all certificates issued for it and related domains, then recursively discovers connected infrastructure — revealing subdomains, hosting relationships, and organizational connections that aren’t visible through DNS alone.
Installation
go install github.com/lanrat/certgraph@latest
Basic Usage
Build certificate graph for a domain
certgraph example.com
Recursive discovery (follow related domains)
certgraph -depth 2 example.com
Save as JSON
certgraph -json example.com > graph.json
Save as DOT (for Graphviz visualization)
certgraph -dot example.com > graph.dot
Output domain list only
certgraph -list example.com
Discovery Options
Include expired certificates
certgraph -expired example.com
Depth of recursive crawling
certgraph -depth 3 example.com
Use specific CT log API
certgraph -ct https://crt.sh example.com
Parallel queries
certgraph -parallel 5 example.com
Timeout per request
certgraph -timeout 30 example.com
Visualizing the Graph
Generate DOT file
certgraph -dot example.com > graph.dot
# Render with Graphviz
dot -Tpng graph.dot -o graph.png
dot -Tsvg graph.dot -o graph.svg
Or use the web viewer Run the built-in web server:
certgraph -web example.com
→ Open http://localhost:8080 to explore the interactive graph
What certgraph Reveals
For target.com, certgraph might find:
- api.target.com, dev.target.com (subdomains)
- target.io, target.net (related domains)
- cdn-target.example.net (CDN infrastructure)
- Internal certificates with internal hostnames
- Wildcard certs: *.target.com
- Certificates with SAN entries listing multiple domains
- Hosting provider certificates (shared hosting)
Querying crt.sh Directly
# crt.sh is the main CT log aggregator
# Direct API (no tool needed)
curl -s "https://crt.sh/?q=%.example.com&output=json" | \
python3 -c "
import json,sys
data = json.load(sys.stdin)
names = set()
for cert in data:
names.add(cert['name_value'])
for n in sorted(names):
print(n)
"
Clean up wildcards
curl -s "https://crt.sh/?q=%.example.com&output=json" | \
python3 -m json.tool | \
grep "name_value" | \
sort -u | \
sed 's/.*"\(.*\)".*/\1/' | \
grep -v "^\*"
Tips
- CT logs are public — every certificate issued is logged, including internal/staging ones
- Wildcard certs (
*.example.com) reveal the existence of subdomains even if they’re not in DNS - Old/expired certificates reveal past infrastructure that may still have live hosts
- SANs (Subject Alternative Names) often list multiple domains — great for expanding scope
Help / Man page
certgraph [options] <domain>
-depth N Recursion depth (default: 5)
-parallel N Parallel requests (default: 10)
-timeout N Timeout in seconds (default: 10)
-expired Include expired certificates
-json JSON output
-dot DOT format output (Graphviz)
-list Output domain list only
-web Start web viewer
-ct URL Certificate Transparency log URL
-save Save results to file
-v Verbose
Vue d’ensemble
certgraph parcourt les logs de certificate transparency pour construire un graphe des relations entre domaines. À partir d’un domaine de départ, il trouve tous les certificats émis pour lui et les domaines liés, puis découvre récursivement l’infrastructure connectée, révélant sous-domaines, relations d’hébergement et connexions organisationnelles qui ne sont pas visibles par le seul DNS.
Installation
go install github.com/lanrat/certgraph@latest
Utilisation de base
# Construire le graphe de certificats d'un domaine
certgraph example.com
# Découverte récursive (suivre les domaines liés)
certgraph -depth 2 example.com
# Sauvegarder en JSON
certgraph -json example.com > graph.json
# Sauvegarder en DOT (pour visualisation Graphviz)
certgraph -dot example.com > graph.dot
# Sortie de la liste de domaines uniquement
certgraph -list example.com
Options de découverte
# Inclure les certificats expirés
certgraph -expired example.com
# Profondeur du crawling récursif
certgraph -depth 3 example.com
# Utiliser une API de log CT spécifique
certgraph -ct https://crt.sh example.com
# Requêtes parallèles
certgraph -parallel 5 example.com
# Timeout par requête
certgraph -timeout 30 example.com
Visualiser le graphe
# Générer le fichier DOT
certgraph -dot example.com > graph.dot
# Rendre avec Graphviz
dot -Tpng graph.dot -o graph.png
dot -Tsvg graph.dot -o graph.svg
# Ou utiliser le visualiseur web : lancer le serveur web intégré
certgraph -web example.com
# → Ouvrir http://localhost:8080 pour explorer le graphe interactif
Ce que certgraph révèle
Pour target.com, certgraph peut trouver :
- api.target.com, dev.target.com (sous-domaines)
- target.io, target.net (domaines liés)
- cdn-target.example.net (infrastructure CDN)
- Des certificats internes avec des noms d'hôtes internes
- Des certs wildcard : *.target.com
- Des certificats dont les entrées SAN listent plusieurs domaines
- Des certificats de fournisseur d'hébergement (hébergement mutualisé)
Interroger crt.sh directement
# crt.sh est le principal agrégateur de logs CT
# API directe (aucun outil nécessaire)
curl -s "https://crt.sh/?q=%.example.com&output=json" | \
python3 -c "
import json,sys
data = json.load(sys.stdin)
names = set()
for cert in data:
names.add(cert['name_value'])
for n in sorted(names):
print(n)
"
# Nettoyer les wildcards
curl -s "https://crt.sh/?q=%.example.com&output=json" | \
python3 -m json.tool | \
grep "name_value" | \
sort -u | \
sed 's/.*"\(.*\)".*/\1/' | \
grep -v "^\*"
Conseils
- Les logs CT sont publics : chaque certificat émis y est journalisé, y compris ceux internes/de staging
- Les certs wildcard (
*.example.com) révèlent l’existence de sous-domaines même s’ils ne sont pas dans le DNS - Les certificats anciens/expirés révèlent une infrastructure passée dont certains hôtes peuvent être encore actifs
- Les SAN (Subject Alternative Names) listent souvent plusieurs domaines : parfait pour élargir le périmètre
Aide / Page de manuel
certgraph [options] <domain>
-depth N Recursion depth (default: 5)
-parallel N Parallel requests (default: 10)
-timeout N Timeout in seconds (default: 10)
-expired Include expired certificates
-json JSON output
-dot DOT format output (Graphviz)
-list Output domain list only
-web Start web viewer
-ct URL Certificate Transparency log URL
-save Save results to file
-v Verbose