Last active
September 9, 2019 21:38
-
-
Save elijahscherz/daf49caa2932a9d54e2d6ca640ac0478 to your computer and use it in GitHub Desktop.
Simple domain information
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 | |
set -Eeuo pipefail | |
echo -e "\e[36m|------ STATUS ------|\e[0m" | |
curl -I -L $1 | |
echo -e "\n\e[36m|------ DIG A RECORD ------|\e[0m" | |
dig A $1 +short | |
ip=$(dig A $1 +short) | |
echo -e "\n\e[36m|------ NAMESERVERS ------|\e[0m" | |
dig NS $1 +short | |
echo -e "\n\e[36m|------ MX ------|\e[0m" | |
dig MX $1 +short | |
echo -e "\n\e[36m|------ REVERSE ------|\e[0m" | |
dig -x $ip +short | |
echo -e "\n\e[36m|------ SSL ------|\e[0m" | |
echo -e "\nFetching certificate information...\n" | |
cert=$(openssl s_client -showcerts -servername $1 -connect $1:443 2>/dev/null | openssl x509 -inform pem -noout -text) | |
# The sed command uses 's' for substitute, then searches for all whitespace at the beginning, and deletes it with // | |
grep "Issuer:" <<< $cert | sed -e 's/^[ \t]*//' | |
if grep -q "Validity" <<< $cert; then | |
grep "Not Before" <<< $cert | sed -e 's/^[ \t]*//' | |
grep "Not After" <<< $cert | sed -e 's/^[ \t]*//' | |
fi | |
echo -e "\n\e[36m|------ WHOIS INFO ------|\e[0m" | |
echo -e "\nFetching WHOIS information...\n" | |
whois $1 | grep "Registrar:" | sed -e 's/^[ \t]*//' | |
whois $1 | grep "Name Server:" | sed -e 's/^[ \t]*//' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment