Mercurial > hg > anonet-resdb
view scripts/check_db_safety @ 1213:4204875410e0 draft
added ascii.ano for myself
author | epochqwert <epoch@hacking.allowed.org> |
---|---|
date | Sat, 21 Jul 2018 08:14:56 +0000 |
parents | 2dcb03d77b03 |
children |
line wrap: on
line source
#!/bin/sh if [ "$(ls db/dom/ 2>/dev/null | tr -d 'a-z0-9\n\-' | wc -c | tr -d ' \t')" != 0 ]; then echo "There's a bad TLD. You probably don't want to run any shell scripts." >&2 exit 1 fi for tld in db/dom/* ; do [ -e "$tld" ] || continue if [ "$(ls $tld/ 2>/dev/null| tr -d 'a-z0-9\n\-' | wc -c | tr -d ' \t')" != 0 ]; then tld="$(basename $tld)" echo "There's a bad domain under $tld." >&2 echo "You probably don't want to run any shell scripts." >&2 exit 1 fi for dom in $tld/* ; do [ -e "$dom" ] || continue if [ "$(ls $dom/ns/ 2>/dev/null | tr -d 'A-Fa-z0-9\n.:\-' | wc -c | tr -d ' \t')" != 0 ]; then domain="$(basename $dom).$(basename $tld)" echo "There's a bad nameserver under $domain." >&2 echo "You probably don't want to run any shell scripts." >&2 exit 1 fi for ns in $dom/ns/* ; do [ -e "$ns" ] || continue if [ "$(cat $ns | tr -d 'A-Fa-f0-9.:\r\n' | wc -c | tr -d ' \t')" != 0 ]; then domain="$(basename $dom).$(basename $tld)" nsname="$(basename $ns)" echo "There's a bad nameserver IP under $domain, for" >&2 echo " $nsname" >&2 echo "You probably don't want to run any shell scripts." >&2 exit 1 fi done done done if [ "$(ls db/ip/ 2>/dev/null | tr -d 'A-F0-9\n' | wc -c | tr -d ' \t')" != 0 ]; then echo "There's a bad first octet. You probably don't want to run any shell scripts." >&2 exit 1 for first in db/ip/* ; do [ -e "$first" ] || continue if [ "$(ls $first/ 2>/dev/null | tr -d 'A-F0-9\n' | wc -c | tr -d ' \t')" != 0 ]; then echo "There's a bad second octet under $first." >&2 echo "You probably don't want to run any shell scripts." >&2 exit 1 for second in $first/* ; do [ -e "$second" ] || continue if [ "$(ls $second/ 2>/dev/null | tr -d 'A-F0-9\n' | wc -c | tr -d ' \t')" != 0 ]; then echo "There's a bad third octet under $second." >&2 echo "You probably don't want to run any shell scripts." >&2 exit 1 fi for third in $second/* ; do [ -e "$third" ] || continue if [ "$(ls $third/ns/ 2>/dev/null | tr -d 'a-z0-9\n.\-' | wc -c | tr -d ' \t')" != 0 ]; then ip="$(basename $first).$(basename $second).$(basename $third).0/24" echo "There's a bad nameserver under $ip." >&2 echo "You probably don't want to run any shell scripts." >&2 exit 1 fi for ns in $third/ns/* ; do [ -e "$ns" ] || continue if [ "$(cat $ns | tr -d '0-9.\n' | wc -c | tr -d ' \t')" != 0 ]; then ip="$(basename $first).$(basename $second).$(basename $third).0/24" nsname="$(basename $ns)" echo "There's a bad nameserver IP under $ip, for" >&2 echo " $nsname" >&2 echo "You probably don't want to run any shell scripts." >&2 exit 1 fi done done done fi done fi