Created
August 14, 2019 15:56
-
-
Save adamhancock/1bc95c21cb64a0f93d9f414ef5b3f93f 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
## 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