Created
May 30, 2020 07:50
-
-
Save genothomas/1daed8b226594a3c3e0adaac8aa6289e to your computer and use it in GitHub Desktop.
Generates a CSV of DNS lookups from a list of domains
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 | |
# Bulk DNS Lookup | |
# Generates a CSV of DNS lookups from a list of domains. | |
# | |
# File name/path of domain list: | |
domain_list='domains.txt' # One FQDN per line in file. | |
# | |
# IP address of the nameserver used for lookups: | |
ns1_ip='1.1.1.1' # Cloudflare | |
ns2_ip='9.9.9.9' # Quad9 | |
ns3_ip='1.1.1.2' # Cloudflare Malware | |
ns4_ip='103.247.36.36' # DNS Filter | |
ns5_ip='208.67.222.222' # OpenDNS / Cisco Umbrella | |
# | |
# Seconds to wait between lookups: | |
loop_wait='1' # Is set to 1 second. | |
echo "Domain name, $ns1_ip,$ns2_ip,$ns3_ip,$ns4_ip,$ns5_ip "; # Start CSV | |
for domain in `cat $domain_list` # Start looping through domains | |
do | |
ip1=`dig @$ns1_ip +short $domain |tail -n1`; # IP address lookup DNS Server1 | |
ip2=`dig @$ns2_ip +short $domain |tail -n1`; # IP address lookup DNS server2 | |
ip3=`dig @$ns3_ip +short $domain |tail -n1`; # IP address lookup DNS server3 | |
ip4=`dig @$ns4_ip +short $domain |tail -n1`; # IP address lookup DNS server4 | |
ip5=`dig @$ns5_ip +short $domain |tail -n1`; # IP address lookup DNS server5 | |
echo -en "$domain,$ip1,$ip2,$ip3,$ip4,$ip5\n"; | |
# sleep $loop_wait # Pause before the next lookup to avoid flooding NS | |
done; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment