diff options
| -rw-r--r-- | db/ip/01/03/03/cidr | 1 | ||||
| -rw-r--r-- | db/ip/01/03/03/ns/ns1.ucis.ano | 1 | ||||
| -rw-r--r-- | db/ip/01/03/03/owner | 1 | ||||
| -rwxr-xr-x | scripts/check_db_safety | 34 | ||||
| -rwxr-xr-x | scripts/hex2dec | 9 | ||||
| -rwxr-xr-x | scripts/nameserver_autogen/tinydns_tld_datafile | 17 | 
6 files changed, 63 insertions, 0 deletions
| diff --git a/db/ip/01/03/03/cidr b/db/ip/01/03/03/cidr new file mode 100644 index 0000000..07cc7d0 --- /dev/null +++ b/db/ip/01/03/03/cidr @@ -0,0 +1 @@ +1.3.3.0/24 diff --git a/db/ip/01/03/03/ns/ns1.ucis.ano b/db/ip/01/03/03/ns/ns1.ucis.ano new file mode 100644 index 0000000..4e697a7 --- /dev/null +++ b/db/ip/01/03/03/ns/ns1.ucis.ano @@ -0,0 +1 @@ +1.3.3.1 diff --git a/db/ip/01/03/03/owner b/db/ip/01/03/03/owner new file mode 100644 index 0000000..6273a20 --- /dev/null +++ b/db/ip/01/03/03/owner @@ -0,0 +1 @@ +UFO diff --git a/scripts/check_db_safety b/scripts/check_db_safety index f3f3236..7208ccb 100755 --- a/scripts/check_db_safety +++ b/scripts/check_db_safety @@ -27,3 +27,37 @@ for tld in db/dom/* ; do    done   done  done +if [ "$(ls db/ip/ | tr -d 'A-F0-9\n' | wc -c)" != 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 +  if [ "$(ls $first/ | tr -d 'A-F0-9\n' | wc -c)" != 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 +    if [ "$(ls $second/ | tr -d 'A-F0-9\n' | wc -c)" != 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 +     if [ "$(ls $third/ns/ | tr -d 'a-z0-9\n.-' | wc -c)" != 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 +     fi +     for ns in $third/ns/* ; do +      if [ "$(cat $ns | tr -d '0-9.\n' | wc -c)" != 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 +      fi +     done +    done +   done +  fi + done +fi diff --git a/scripts/hex2dec b/scripts/hex2dec new file mode 100755 index 0000000..7b66be9 --- /dev/null +++ b/scripts/hex2dec @@ -0,0 +1,9 @@ +#!/bin/sh +( + echo -n "ibase=16; " + if [ x"$1" = x ]; then +  cat + else +  echo "$1" + fi +) | bc -q diff --git a/scripts/nameserver_autogen/tinydns_tld_datafile b/scripts/nameserver_autogen/tinydns_tld_datafile index ff84576..0a1174f 100755 --- a/scripts/nameserver_autogen/tinydns_tld_datafile +++ b/scripts/nameserver_autogen/tinydns_tld_datafile @@ -4,6 +4,23 @@ if ! ./scripts/check_db_safety; then  fi  tldsrvrname="$(./scripts/conf_var tinydns__tldsrvrname uz5fvb7zdqyuz4q8ysjdfuf04kzd2lrt0l6fp4uyguxdg5tfut06ck.anons.somerandomnick.ano)"  tldsrvrip="$(./scripts/conf_var tinydns__tldsrvrip 1.0.27.37)" +for tld in db/ip/* ; do + first="$(basename $tld | ./scripts/hex2dec)" + tldname="$first.in-addr.arpa" + echo "+$tldsrvrname:$tldsrvrip:3600" + echo ".$tldname::$tldsrvrname" + for ip in $tld/*/* ; do +  third="$(basename $ip | ./scripts/hex2dec)" +  second="$(basename $(dirname $ip) | ./scripts/hex2dec)" +  first="$(basename $(dirname $(dirname $ip)) | ./scripts/hex2dec)" +  domain="$third.$second.$first.in-addr.arpa" +  for ns in $ip/ns/* ; do +   nsip="$(cat $ns)" +   nsname="$(basename $ns)" +   echo "&$domain:$nsip:$nsname" +  done + done +done  for tld in db/dom/* ; do   tldname="$(basename $tld)"   echo "+$tldsrvrname:$tldsrvrip:3600" | 
