Created
March 8, 2018 11:07
-
-
Save bcoles/5a3527b1496e760b30ab977086c170bf to your computer and use it in GitHub Desktop.
List sub-domains using crt.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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