Created
November 2, 2015 07:33
-
-
Save jubstuff/6b86998c98fc40ca86be to your computer and use it in GitHub Desktop.
Use this script to check which of the domains contained in file are pointing to the given domain
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 | |
# Use this script to check which of the domains contained in file are pointing to the | |
# given domain | |
# Credits: https://www.euperia.com/linux/howto-get-the-ip-address-of-a-domain-in-a-one-liner/385 | |
# and various Stackoverflow users ^_^ | |
if [ $# -eq 0 ]; then | |
echo "Usage ${0##*/} path/to/file domain" | |
exit 0 | |
fi | |
file="$1" | |
domain="$2" | |
while read line; do | |
if dig +short A ${line} | grep -q $2; then | |
echo $line | |
fi | |
done <$file |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment