Projects STRLCPY pentest-tools Commits 513cc869
🤬
  • ■ ■ ■ ■ ■ ■
    mass_axfr2.sh
     1 +#!/bin/bash
     2 + 
     3 + 
     4 +function usage() {
     5 + echo "Usage: "$0" <domain_file>"
     6 + if [ -n "$1" ] ; then
     7 + echo "Error: "$1"!"
     8 + fi
     9 + exit
     10 +}
     11 + 
     12 +if [ ! $# -eq 1 ] ; then
     13 + usage
     14 +fi
     15 + 
     16 +file=$1
     17 + 
     18 +if [ ! -f $file ] ; then
     19 + usage "file not found"
     20 +fi
     21 + 
     22 +n=0
     23 +i=0
     24 +total=$(cat $file | wc -l | tr -d [:space:])
     25 +domains=$(cat $file)
     26 +echo "Trying $total zone transfer..."
     27 +echo
     28 + 
     29 +for d in $domains ; do
     30 + i=$[$i+1]
     31 + echo -ne " [$i/$total] "$d"\r"
     32 + 
     33 + host=$(host -t NS $d)
     34 + has_ns=$(echo $host | grep " name server ")
     35 + 
     36 + if [ -n "$has_ns" ] ; then
     37 + ns=$(echo $host | awk '{print $NF}' | sed "s/\.$//")
     38 + 
     39 + for nnss in $(echo $ns) ; do
     40 + axfr=`host -4 -W 1 -t axfr $d $nnss | grep ";; ANSWER SECTION:"`
     41 + if [ -n "$axfr" ] ; then
     42 + # echo -ne " [$i/$total] "$d"\r"
     43 + printf "\033[0;32m [$i/$total] $d successful\033[0m"
     44 + echo
     45 + n=$[$n+1]
     46 + fi
     47 + # axfr=`host -4 -W 1 -t axfr $d $nnss`
     48 + # failed=`echo "$axfr" | grep 'Transfer failed'`
     49 + # timeout=`echo "$axfr" | grep 'timed out'`
     50 + # error=`echo "$axfr" | grep 'communications error'`
     51 + 
     52 + # if [ ! -n "$timeout" ] ; then
     53 + # if [ ! -n "$error" ] ; then
     54 + # if [ ! -n "$failed" ] ; then
     55 + # _print "$d successful!" GREEN
     56 + # echo
     57 + # n=$[$n+1]
     58 + # fi
     59 + # fi
     60 + # fi
     61 + done
     62 + fi
     63 + 
     64 + echo -ne " \r"
     65 +done
     66 + 
     67 +echo
     68 +echo $n" zone transfer successful."
     69 +echo
     70 + 
     71 +exit
     72 + 
Please wait...
Page is in error, reload to recover