Created
October 26, 2015 11:51
-
-
Save rquigley/8fbcfac487c0b4529cca to your computer and use it in GitHub Desktop.
Whois with lookup against registrar
This file contains hidden or 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 -e | |
set -o pipefail | |
BIN="/usr/bin/whois" | |
DOMAIN=$1 | |
echo "Fetching domain's whois server..." | |
RES=$($BIN $DOMAIN) | |
SERVER=$(echo "$RES" | grep -i whois\ server: | head -1 | awk '{print $NF'}) | |
if [[ $SERVER ]]; then | |
echo "Querying whois server '$SERVER'..." | |
# Avoid rate-limiting | |
sleep 1 | |
$BIN -h $SERVER $DOMAIN | |
else | |
echo "$RES" | |
fi | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment