axfrs 891 Bytes
Newer Older
Nico Schottelius's avatar
Nico Schottelius committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25

# Date: 15. February 2002
# Author: Nico Schottelius <nico-linux@schottelius.(org|net)>
# Last Changed: same
# Version: 0.2
# Comment:
#
#  0.1: runs fine
#  0.2: uses awk, sed make some problems (with last NS expression)
#
#

if [ $# -lt 1  ]; then
   echo `basename $0`': domain(s)'
   echo 'Hey, what domain to get?'
   exit 1
fi   

DIG="dig"
EGREP="egrep"
GREP="grep"
SED="sed"
AWK="awk"
ECHO="echo"
   
26
for domain in "$@"; do
Nico Schottelius's avatar
Nico Schottelius committed
27 28 29 30 31 32 33 34 35 36 37 38

##   NS_SERVERS=`$DIG $domain ns|$EGREP -i 'in.*ns'|$GREP -v '^;' | $SED 's/.*IN.*NS\(.*\)/\1/g' | sed 's/\.$//g'`
   NS_SERVERS=`$DIG $domain ns|$EGREP -i 'in.*ns'|$GREP -v '^;' | $AWK '{ print $5} ' | sed 's/\.$//g'`
   $ECHO "Servers: $NS_SERVERS"

   for server in $NS_SERVERS; do
      $ECHO "Quering $server for $domain ..."
      $DIG @$server $domain axfr >> $domain-$server 2>&1
      $ECHO "Done. Saved output to $domain-$server"
   done   
done