Skip to content

Instantly share code, notes, and snippets.

@IonBazan
Last active June 9, 2025 08:12
Show Gist options
  • Save IonBazan/2a65b4886e105bc0d1d2586def53f6eb to your computer and use it in GitHub Desktop.
Save IonBazan/2a65b4886e105bc0d1d2586def53f6eb to your computer and use it in GitHub Desktop.
Enumerate subdomains using Certificate Transparency logs
#!/bin/bash
# Enumerate subdomains using HTTPS Certificate Transparency logs.
# In most cases it's faster and more reliable than brute-force attack, especially when targeting HTTP(S) services.
# Read more at https://certificate.transparency.dev/
#
# Usage: ./subdomains.sh x.com
#
# Prerequisites: curl, jq
if [ -z "$1" ]; then
echo "Usage: $0 <domain>"
exit 1
fi
DOMAIN=$1
curl -s "https://crt.sh/?q=%25.$DOMAIN&output=json" |
jq -r '.[].name_value' |
tr '\n' ',' |
tr ',' '\n' | # Flatten multiline name_values
sed 's/^\*\.\?//' | # Remove leading "*." if present
sort -u # Sort and deduplicate
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment