Skip to content

Instantly share code, notes, and snippets.

@bcoles
Created March 8, 2018 11:07
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bcoles/5a3527b1496e760b30ab977086c170bf to your computer and use it in GitHub Desktop.
Save bcoles/5a3527b1496e760b30ab977086c170bf to your computer and use it in GitHub Desktop.
List sub-domains using crt.sh
#!/bin/bash
# List sub-domains using crt.sh
set -euo pipefail
IFS=$'\n\t'
error() {
echo "[ERROR] $*"
exit 1
}
command_exists () {
command -v "$1" >/dev/null 2&>/dev/null
}
if ! command_exists jq ; then
error 'jq is not installed'
fi
if ! command_exists curl ; then
error 'curl is not installed'
fi
DOMAIN=$*
if [ -z $DOMAIN ] ; then
error 'Usage: ./crt.sh <domain>'
fi
curl -sS "https://crt.sh?q=%.${DOMAIN}&output=json" | jq .name_value | sort -u
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment