ptrstream/madness

36 lines
1.1 KiB
Plaintext
Raw Normal View History

2023-11-25 19:07:18 +00:00
#!/bin/bash
2023-11-26 07:25:01 +00:00
TIMEOUT=2
2023-11-24 10:05:19 +00:00
genip() {
num_octets=$((RANDOM % 4 + 1))
ip=""
for i in $(seq 1 $num_octets); do
if [ $i -ne 1 ]; then
ip+="."
fi
ip+=$((RANDOM % 256))
done
echo $ip
}
2023-11-26 07:25:01 +00:00
TEMP=$(mktemp -d)
2023-11-24 10:05:19 +00:00
while true; do
ip=$(genip)
2023-11-26 07:25:01 +00:00
ns_records=$(dig +time=$TIMEOUT +short $ip.in-addr.arpa NS)
for ns in $ns_records; do
ns_ips=$(dig +time=$TIMEOUT +short $ns A $ns AAAA)
for ns_ip in $ns_ips; do
#echo -e "AXFR on \033[36m${ns%.}\033[0m \033[90m($ns_ip)\033[0m for \033[33m$ip.in-addr.arpa\033[0m"
dig AXFR @$ns_ip $ip.in-addr.arpa > $TEMP/$ip.in-addr.arpa.txt
if [ ! -s "$zone_file" ] || grep -qE "Transfer failed|connection reset|connection refused" "$zone_file"; then
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"
rm -f "$zone_file"
else
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"
break
fi
done
done
2023-11-24 10:05:19 +00:00
done