Jump to content

Script to find authoritative servers for domain list


rev.dennis
 Share

Recommended Posts

Had to need to find authoritative servers for domains so I created the following script.

#!/bin/ksh
#
# find whos authoritative
#  author: Dennis Hosang
#  usage: ./djfindauth.ksh ph1hosang.txt | grep ns1.thezah.com
#  version: 201405011020
#
sub=ns*.thezah.com
for domain in `cat ${1}`
 do
    if [[ $domain == *.com ]]; then
        dig @192.41.162.30 $domain +noall +authority
# start a's
    elif [[ $domain == *.ar ]]; then
        dig @a.dns.ar $domain +noall +authority
    elif [[ $domain == *.at ]]; then
        dig @n.ns.at $domain +noall +authority
    elif [[ $domain == *.au ]]; then
        dig @z.au $domain +noall +authority
# start b's
    elif [[ $domain == *.bb ]]; then
        dig @ns1.barbadosdomain.net $domain +noall +authority
    elif [[ $domain == *.be ]]; then
        dig @d.ns.dns.be $domain +noall +authority
    elif [[ $domain == *.bg ]]; then
        dig @ns3.register.bg $domain +noall +authority
    elif [[ $domain == *.biz ]]; then
        dig @k.gtld.biz $domain +noall +authority
    elif [[ $domain == *.bo ]]; then
        dig @anycast.ns.nic.bo $domain +noall +authority
    elif [[ $domain == *.br ]]; then
        dig @200.189.41.10 $domain +noall +authority        
    elif [[ $domain == *.bs ]]; then
        dig @DNS.NIC.bs $domain +noall +authority
# start c's        
    elif [[ $domain == *.ca ]]; then
        dig @156.154.100.4 $domain +noall +authority
    elif [[ $domain == *.ch ]]; then
        dig @192.41.162.30 $domain +noall +authority
    elif [[ $domain == *.cl ]]; then
        dig @a.nic.cl $domain +noall +authority
    elif [[ $domain == *.co ]]; then
        dig @ns1.cctld.co $domain +noall +authority
    elif [[ $domain == *.cy ]]; then
        dig @cynic.dns.cy $domain +noall +authority
    elif [[ $domain == *.cz ]]; then
        dig @d.ns.nic.cz $domain +noall +authority
# start d's
    elif [[ $domain == *.de ]]; then
        dig @l.de.net $domain +noall +authority
    elif [[ $domain == *.dk ]]; then
        dig @a.nic.dk $domain +noall +authority
# start e's
    elif [[ $domain == *.ec ]]; then
        dig @n1.nic.ec $domain +noall +authority
    elif [[ $domain == *.eg ]]; then
        dig @FRCU.EUN.eg $domain +noall +authority
    elif [[ $domain == *.es ]]; then
        dig @a.nic.es $domain +noall +authority
    elif [[ $domain == *.eu ]]; then
        dig @nl.dns.eu $domain +noall +authority
# start f's
    elif [[ $domain == *.fi ]]; then
        dig @d.fi $domain +noall +authority
    elif [[ $domain == *.fr ]]; then
        dig @d.ext.nic.fr $domain +noall +authority
# start g's
    elif [[ $domain == *.gg ]]; then
        dig @e.ci-servers.gg $domain +noall +authority
    elif [[ $domain == *.gr ]]; then
        dig @gr-at.ics.forth.gr $domain +noall +authority
# start h's
    elif [[ $domain == *.hk ]]; then
        dig @A.HKIRC.NET.hk $domain +noall +authority
    elif [[ $domain == *.hr ]]; then
        dig @hr-ns-1.carnet.hr $domain +noall +authority
    elif [[ $domain == *.hu ]]; then
        dig @ns.nic.hu $domain +noall +authority
# start i's
    elif [[ $domain == *.id ]]; then
        dig @g.dns.id $domain +noall +authority
    elif [[ $domain == *.ie ]]; then
        dig @a.iedr.ie $domain +noall +authority
    elif [[ $domain == *.it ]]; then
        dig @a.dns.it $domain +noall +authority
    elif [[ $domain == *.in ]]; then
        dig @a.root-servers.net $domain +noall +authority
    elif [[ $domain == *.info ]]; then
        dig @a0.info.afilias-nst.info $domain +noall +authority
# start j's
    elif [[ $domain == *.je ]]; then
        dig @d.ci-servers.je $domain +noall +authority
    elif [[ $domain == *.jobs ]]; then
        dig @f5.nstld.com $domain +noall +authority
    elif [[ $domain == *.jp ]]; then
        dig @a.dns.jp $domain +noall +authority
# start k's
    elif [[ $domain == *.ke ]]; then
        dig @NS.ANYCAST.kenic.or.ke $domain +noall +authority
    elif [[ $domain == *.kr ]]; then
        dig @g.dns.kr $domain +noall +authority
# start l's
    elif [[ $domain == *.lb ]]; then
        dig @zeina.aub.edu.lb $domain +noall +authority
    elif [[ $domain == *.lt ]]; then
        dig @d.tld.lt $domain +noall +authority
    elif [[ $domain == *.lu ]]; then
        dig @p.dns.lu $domain +noall +authority
    elif [[ $domain == *.lv ]]; then
        dig @a.nic.lv $domain +noall +authority
# start m's
    elif [[ $domain == *.mobi ]]; then
        dig @b2.mobi.afilias-nst.org $domain +noall +authority
    elif [[ $domain == *.mx ]]; then
        dig @d.root-servers.net $domain +noall +authority
# start n's
    elif [[ $domain == *.net ]]; then
        dig @192.31.80.30 $domain +noall +authority
    elif [[ $domain == *.nl ]]; then
        dig @ns1.dns.nl $domain +noall +authority
    elif [[ $domain == *.no ]]; then
        dig @z.nic.no $domain +noall +authority
    elif [[ $domain == *.nu ]]; then
        dig @a.nic.nu $domain +noall +authority
    elif [[ $domain == *.nz ]]; then
        dig @ns1.dns.net.nz $domain +noall +authority
# start o's
    elif [[ $domain == *.org ]]; then
        dig @b0.org.afilias-nst.org $domain +noall +authority
# start p's
    elif [[ $domain == *.pa ]]; then
        dig @ns.pa $domain +noall +authority
    elif [[ $domain == *.pe ]]; then
        dig @PCH.RCP.pe $domain +noall +authority
    elif [[ $domain == *.ph ]]; then
        dig @sec4.apnic.net $domain +noall +authority
    elif [[ $domain == *.pk ]]; then
        dig @root-s.pknic.pk $domain +noall +authority
    elif [[ $domain == *.pl ]]; then
        dig @a-dns.pl $domain +noall +authority
    elif [[ $domain == *.pt ]]; then
        dig @ns2.dns.pt $domain +noall +authority
    elif [[ $domain == *.py ]]; then
        dig @ns.cnc.una.py $domain +noall +authority
# start q's
# start r's
    elif [[ $domain == *.ru ]]; then
        dig @d.dns.ripn.net $domain +noall +authority
# start s's
    elif [[ $domain == *.se ]]; then
        dig @d.ns.se $domain +noall +authority
    elif [[ $domain == *.sg ]]; then
        dig @DSANY.SGNIC.sg $domain +noall +authority
    elif [[ $domain == *.si ]]; then
        dig @d.dns.si $domain +noall +authority
# start t's
    elif [[ $domain == *.th ]]; then
        dig @dns1.thnic.co.th $domain +noall +authority
    elif [[ $domain == *.tr ]]; then
        dig @ns2.nic.tr $domain +noall +authority
# start u's
    elif [[ $domain == *.uk ]]; then
        dig @nsa.nic.uk $domain +noall +authority
    elif [[ $domain == *.us ]]; then
        dig @a.cctld.us $domain +noall +authority
    elif [[ $domain == *.uy ]]; then
        dig @seciu.edu.uy $domain +noall +authority
# start v's
    elif [[ $domain == *.ve ]]; then
        dig @ns1.nic.ve $domain +noall +authority
    elif [[ $domain == *.vi ]]; then
        dig @auth100.ns.uu.net $domain +noall +authority
# start w's
# start x's
# start y's
    elif [[ $domain == *.yu ]]; then
        dig @a.root-servers.net $domain +noall +authority
# start z's
    elif [[ $domain == *.za ]]; then
        dig @nsza.is.co.za $domain +noall +authority
# start arpa
    elif [[ $domain == *.in-addr.arpa ]]; then
        dig @z.arin.net $domain +noall +authority
    elif [[ $domain == *.12.in-addr.arpa ]]; then
        dig @cbru.br.ns.els-gms.att.net $domain +noall +authority
    elif [[ $domain == *.104.12.in-addr.arpa ]]; then
        dig @xbru.br.ns.els-gms.att.net $domain +noall +authority

    else echo "ERROR ERROR ERROR - it appears $domain has a TLD not included in this script"
    fi
done

 

Link to comment
Share on other sites

 Share

×
×
  • Create New...