Mercurial > hg > anonet-resdb
annotate scripts/check_db_safety @ 12:41b330b11a33 draft
coded a tinydns datafile generator
author | Nick <nick@somerandomnick.ano> |
---|---|
date | Mon, 19 Apr 2010 06:10:07 +0000 |
parents | |
children | 059b5f3d7808 |
rev | line source |
---|---|
12
41b330b11a33
coded a tinydns datafile generator
Nick <nick@somerandomnick.ano>
parents:
diff
changeset
|
1 #!/bin/sh |
41b330b11a33
coded a tinydns datafile generator
Nick <nick@somerandomnick.ano>
parents:
diff
changeset
|
2 if [ "$(ls db/dom/ | tr -d 'a-z0-9\n-' | wc -c)" != 0 ]; then |
41b330b11a33
coded a tinydns datafile generator
Nick <nick@somerandomnick.ano>
parents:
diff
changeset
|
3 echo "There's a bad TLD. You probably don't want to run any shell scripts." >&2 |
41b330b11a33
coded a tinydns datafile generator
Nick <nick@somerandomnick.ano>
parents:
diff
changeset
|
4 exit 1 |
41b330b11a33
coded a tinydns datafile generator
Nick <nick@somerandomnick.ano>
parents:
diff
changeset
|
5 fi |
41b330b11a33
coded a tinydns datafile generator
Nick <nick@somerandomnick.ano>
parents:
diff
changeset
|
6 for tld in db/dom/* ; do |
41b330b11a33
coded a tinydns datafile generator
Nick <nick@somerandomnick.ano>
parents:
diff
changeset
|
7 if [ "$(ls $tld/ | tr -d 'a-z0-9\n-' | wc -c)" != 0 ]; then |
41b330b11a33
coded a tinydns datafile generator
Nick <nick@somerandomnick.ano>
parents:
diff
changeset
|
8 tld="$(basename $tld)" |
41b330b11a33
coded a tinydns datafile generator
Nick <nick@somerandomnick.ano>
parents:
diff
changeset
|
9 echo "There's a bad domain under $tld." >&2 |
41b330b11a33
coded a tinydns datafile generator
Nick <nick@somerandomnick.ano>
parents:
diff
changeset
|
10 echo "You probably don't want to run any shell scripts." >&2 |
41b330b11a33
coded a tinydns datafile generator
Nick <nick@somerandomnick.ano>
parents:
diff
changeset
|
11 exit 1 |
41b330b11a33
coded a tinydns datafile generator
Nick <nick@somerandomnick.ano>
parents:
diff
changeset
|
12 fi |
41b330b11a33
coded a tinydns datafile generator
Nick <nick@somerandomnick.ano>
parents:
diff
changeset
|
13 for dom in $tld/* ; do |
41b330b11a33
coded a tinydns datafile generator
Nick <nick@somerandomnick.ano>
parents:
diff
changeset
|
14 if [ "$(ls $dom/ns/ | tr -d 'a-z0-9\n.-' | wc -c)" != 0 ]; then |
41b330b11a33
coded a tinydns datafile generator
Nick <nick@somerandomnick.ano>
parents:
diff
changeset
|
15 domain="$(basename $dom).$(basename $tld)" |
41b330b11a33
coded a tinydns datafile generator
Nick <nick@somerandomnick.ano>
parents:
diff
changeset
|
16 echo "There's a bad nameserver under $domain." >&2 |
41b330b11a33
coded a tinydns datafile generator
Nick <nick@somerandomnick.ano>
parents:
diff
changeset
|
17 echo "You probably don't want to run any shell scripts." >&2 |
41b330b11a33
coded a tinydns datafile generator
Nick <nick@somerandomnick.ano>
parents:
diff
changeset
|
18 fi |
41b330b11a33
coded a tinydns datafile generator
Nick <nick@somerandomnick.ano>
parents:
diff
changeset
|
19 for ns in $dom/ns/* ; do |
41b330b11a33
coded a tinydns datafile generator
Nick <nick@somerandomnick.ano>
parents:
diff
changeset
|
20 if [ "$(cat $ns | tr -d '0-9.\n' | wc -c)" != 0 ]; then |
41b330b11a33
coded a tinydns datafile generator
Nick <nick@somerandomnick.ano>
parents:
diff
changeset
|
21 domain="$(basename $dom).$(basename $tld)" |
41b330b11a33
coded a tinydns datafile generator
Nick <nick@somerandomnick.ano>
parents:
diff
changeset
|
22 nsname="$(basename $ns)" |
41b330b11a33
coded a tinydns datafile generator
Nick <nick@somerandomnick.ano>
parents:
diff
changeset
|
23 echo "There's a bad nameserver IP under $domain, for" >&2 |
41b330b11a33
coded a tinydns datafile generator
Nick <nick@somerandomnick.ano>
parents:
diff
changeset
|
24 echo " $nsname" >&2 |
41b330b11a33
coded a tinydns datafile generator
Nick <nick@somerandomnick.ano>
parents:
diff
changeset
|
25 echo "You probably don't want to run any shell scripts." >&2 |
41b330b11a33
coded a tinydns datafile generator
Nick <nick@somerandomnick.ano>
parents:
diff
changeset
|
26 fi |
41b330b11a33
coded a tinydns datafile generator
Nick <nick@somerandomnick.ano>
parents:
diff
changeset
|
27 done |
41b330b11a33
coded a tinydns datafile generator
Nick <nick@somerandomnick.ano>
parents:
diff
changeset
|
28 done |
41b330b11a33
coded a tinydns datafile generator
Nick <nick@somerandomnick.ano>
parents:
diff
changeset
|
29 done |