ptrstream

- Unnamed repository; edit this file 'description' to name the repository.
git clone git://git.acid.vegas/-c.git
Log | Files | Refs | Archive | README

madness (1176B)

      1 #!/bin/bash
      2 
      3 TIMEOUT=2
      4 
      5 genip() {
      6     num_octets=$((RANDOM % 4 + 1))
      7     ip=""
      8     for i in $(seq 1 $num_octets); do
      9         if [ $i -ne 1 ]; then
     10             ip+="."
     11         fi
     12         ip+=$((RANDOM % 256))
     13     done
     14     echo $ip
     15 }
     16 
     17 TEMP=$(mktemp -d)
     18 while true; do
     19     ip=$(genip)
     20     ns_records=$(dig +time=$TIMEOUT +short $ip.in-addr.arpa NS)
     21     for ns in $ns_records; do
     22         ns_ips=$(dig +time=$TIMEOUT +short $ns A $ns AAAA)
     23         for ns_ip in $ns_ips; do
     24             #echo -e "AXFR on \033[36m${ns%.}\033[0m \033[90m($ns_ip)\033[0m for \033[33m$ip.in-addr.arpa\033[0m"
     25             dig AXFR @$ns_ip $ip.in-addr.arpa > $TEMP/$ip.in-addr.arpa.txt
     26             if [ ! -s "$zone_file" ] || grep -qE "Transfer failed|connection reset|connection refused" "$zone_file"; then
     27                 echo -e "\033[31m[FAIL]\033[0m AXFR on \033[36m${ns%.}\033[0m \033[90m($ns_ip)\033[0m for \033[33m$ip.in-addr.arpa\033[0m"
     28                 rm -f "$zone_file"
     29             else
     30                 echo -e "\033[32m[SUCCESS]\033[0m AXFR on \033[36m${ns%.}\033[0m \033[90m($ns_ip)\033[0m for \033[33m$ip.in-addr.arpa\033[0m"
     31                 break
     32             fi
     33         done
     34     done
     35 done