Skip to content

Instantly share code, notes, and snippets.

@adamhancock
Created August 14, 2019 15:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save adamhancock/1bc95c21cb64a0f93d9f414ef5b3f93f to your computer and use it in GitHub Desktop.
Save adamhancock/1bc95c21cb64a0f93d9f414ef5b3f93f to your computer and use it in GitHub Desktop.
## Adam Hancock
rm -f output.csv
echo "Domain, IP, MX IP, Nameservers" >> output.csv
while read d; do
p=`echo $d | sed -e 's/www.//g'`
website=`dig @8.8.8.8 +short $p | head -n1`
mx=`dig @8.8.8.8 +short mx $p | cut -d " " -f 2 | head -n1`
nameservers=`dig ns $p +short`
nameserver1=`echo $nameservers | head -n1`
mx1=`dig +short $p mx | sort -n | awk '{print $2; exit}' | dig +short -f - | head -n1`
echo "$p, $website, $mx1, $nameserver1" >> output.csv
done <domains.txt
echo "CSV attached" | mutt -s "Domain check" name@domain.com -a output.csv
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment