Created
December 8, 2018 12:57
-
-
Save theasder/e0ab686d7e1e9644df056029476b1314 to your computer and use it in GitHub Desktop.
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 | |
get_whois() { # directory, url as arguments | |
if [[ "$2" =~ ^https?:\/\/.*$ ]]; | |
then | |
domain=$(echo $2 | awk -F[/:] '{print $4}') | |
else | |
domain=$2 | |
fi | |
domain=${domain/www./ } | |
filename=${domain//./_} | |
wget --output-document="$1/${filename}.html" "https://www.whois.com/whois/${domain}" | |
} | |
if [ ! $# == 3 ]; then | |
echo "Incorrect input" | |
exit | |
if [ "$2" == "domain" ]; | |
then | |
get_whois "$1" "$3" | |
elif [ "$2" == "file" ]; | |
then | |
cat "$3" | while read line | |
do | |
get_whois "$1" "$line" | |
done | |
else | |
echo "Incorrect input" | |
exit | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment