Created
November 24, 2016 20:06
-
-
Save tommelo/7ad5a26cbb56881695ca3631ff27c4e6 to your computer and use it in GitHub Desktop.
dns report
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 | |
echo "" | |
if [ $# -eq 0 ] | |
then | |
echo "[!] no arguments given" | |
echo "[!] usage: ./dnsreport.sh [host]" | |
echo "[!] eg.: ./dnsreport.sh grandbusiness.com.br" | |
exit 1 | |
fi | |
echo "[+] Trying to find the host owner..." | |
echo "" | |
whois $1 | grep "owner:" | |
echo "" | |
echo "[+] Trying to enumerate NS, MX, A, AAAA, HINFO, CNAME, PTR and SOA records..." | |
echo "" | |
records=("NS" "MX" "A" "AAAA" "HINFO" "CNAME" "PTR" "SOA") | |
for record in "${records[@]}" | |
do | |
echo "[+] $record records:" | |
host -t $record $1 | |
echo "" | |
done | |
echo "[+] Trying to perform a Reverse DNS Brute Force..." | |
echo "" | |
ip=$(host $1 | grep "has address" | head -n1 | awk -F " " '{print $4}') | |
base=$(echo $ip | cut -d "." -f1-3) | |
range=$(whois $ip | grep "NetRange:" | tail -n1 | awk -F " " '{print $2" - "$4}') | |
from=$(echo $range | awk -F " " '{print $1}' | awk -F "\\." '{print $NF}') | |
to=$(echo $range | awk -F " " '{print $3}' | awk -F "\\." '{print $NF}') | |
for index in $(seq $from $to) | |
do | |
host $base.$index | grep -v "not found" | |
done | |
echo "" | |
echo "[+] Trying to perform a DNS Zone Transfer" | |
echo "" | |
for ns in $(host -t ns $1 | awk -F " " '{print $4}') | |
do | |
host -l $1 $ns | grep "has address" | |
done | |
echo "" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment