annotate scripts/check_db_safety @ 22:745d1e774738 draft

added link
author Nick <nick@somerandomnick.ano>
date Tue, 18 May 2010 01:19:20 +0000
parents 059b5f3d7808
children 6c1d4e261fdf
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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
13
059b5f3d7808 added rDNS to tinydns datafile generation
Nick <nick@somerandomnick.ano>
parents: 12
diff changeset
30 if [ "$(ls db/ip/ | tr -d 'A-F0-9\n' | wc -c)" != 0 ]; then
059b5f3d7808 added rDNS to tinydns datafile generation
Nick <nick@somerandomnick.ano>
parents: 12
diff changeset
31 echo "There's a bad first octet. You probably don't want to run any shell scripts." >&2
059b5f3d7808 added rDNS to tinydns datafile generation
Nick <nick@somerandomnick.ano>
parents: 12
diff changeset
32 exit 1
059b5f3d7808 added rDNS to tinydns datafile generation
Nick <nick@somerandomnick.ano>
parents: 12
diff changeset
33 for first in db/ip/* ; do
059b5f3d7808 added rDNS to tinydns datafile generation
Nick <nick@somerandomnick.ano>
parents: 12
diff changeset
34 if [ "$(ls $first/ | tr -d 'A-F0-9\n' | wc -c)" != 0 ]; then
059b5f3d7808 added rDNS to tinydns datafile generation
Nick <nick@somerandomnick.ano>
parents: 12
diff changeset
35 echo "There's a bad second octet under $first." >&2
059b5f3d7808 added rDNS to tinydns datafile generation
Nick <nick@somerandomnick.ano>
parents: 12
diff changeset
36 echo "You probably don't want to run any shell scripts." >&2
059b5f3d7808 added rDNS to tinydns datafile generation
Nick <nick@somerandomnick.ano>
parents: 12
diff changeset
37 exit 1
059b5f3d7808 added rDNS to tinydns datafile generation
Nick <nick@somerandomnick.ano>
parents: 12
diff changeset
38 for second in $first/* ; do
059b5f3d7808 added rDNS to tinydns datafile generation
Nick <nick@somerandomnick.ano>
parents: 12
diff changeset
39 if [ "$(ls $second/ | tr -d 'A-F0-9\n' | wc -c)" != 0 ]; then
059b5f3d7808 added rDNS to tinydns datafile generation
Nick <nick@somerandomnick.ano>
parents: 12
diff changeset
40 echo "There's a bad third octet under $second." >&2
059b5f3d7808 added rDNS to tinydns datafile generation
Nick <nick@somerandomnick.ano>
parents: 12
diff changeset
41 echo "You probably don't want to run any shell scripts." >&2
059b5f3d7808 added rDNS to tinydns datafile generation
Nick <nick@somerandomnick.ano>
parents: 12
diff changeset
42 exit 1
059b5f3d7808 added rDNS to tinydns datafile generation
Nick <nick@somerandomnick.ano>
parents: 12
diff changeset
43 fi
059b5f3d7808 added rDNS to tinydns datafile generation
Nick <nick@somerandomnick.ano>
parents: 12
diff changeset
44 for third in $second/* ; do
059b5f3d7808 added rDNS to tinydns datafile generation
Nick <nick@somerandomnick.ano>
parents: 12
diff changeset
45 if [ "$(ls $third/ns/ | tr -d 'a-z0-9\n.-' | wc -c)" != 0 ]; then
059b5f3d7808 added rDNS to tinydns datafile generation
Nick <nick@somerandomnick.ano>
parents: 12
diff changeset
46 ip="$(basename $first).$(basename $second).$(basename $third).0/24"
059b5f3d7808 added rDNS to tinydns datafile generation
Nick <nick@somerandomnick.ano>
parents: 12
diff changeset
47 echo "There's a bad nameserver under $ip." >&2
059b5f3d7808 added rDNS to tinydns datafile generation
Nick <nick@somerandomnick.ano>
parents: 12
diff changeset
48 echo "You probably don't want to run any shell scripts." >&2
059b5f3d7808 added rDNS to tinydns datafile generation
Nick <nick@somerandomnick.ano>
parents: 12
diff changeset
49 fi
059b5f3d7808 added rDNS to tinydns datafile generation
Nick <nick@somerandomnick.ano>
parents: 12
diff changeset
50 for ns in $third/ns/* ; do
059b5f3d7808 added rDNS to tinydns datafile generation
Nick <nick@somerandomnick.ano>
parents: 12
diff changeset
51 if [ "$(cat $ns | tr -d '0-9.\n' | wc -c)" != 0 ]; then
059b5f3d7808 added rDNS to tinydns datafile generation
Nick <nick@somerandomnick.ano>
parents: 12
diff changeset
52 ip="$(basename $first).$(basename $second).$(basename $third).0/24"
059b5f3d7808 added rDNS to tinydns datafile generation
Nick <nick@somerandomnick.ano>
parents: 12
diff changeset
53 nsname="$(basename $ns)"
059b5f3d7808 added rDNS to tinydns datafile generation
Nick <nick@somerandomnick.ano>
parents: 12
diff changeset
54 echo "There's a bad nameserver IP under $ip, for" >&2
059b5f3d7808 added rDNS to tinydns datafile generation
Nick <nick@somerandomnick.ano>
parents: 12
diff changeset
55 echo " $nsname" >&2
059b5f3d7808 added rDNS to tinydns datafile generation
Nick <nick@somerandomnick.ano>
parents: 12
diff changeset
56 echo "You probably don't want to run any shell scripts." >&2
059b5f3d7808 added rDNS to tinydns datafile generation
Nick <nick@somerandomnick.ano>
parents: 12
diff changeset
57 fi
059b5f3d7808 added rDNS to tinydns datafile generation
Nick <nick@somerandomnick.ano>
parents: 12
diff changeset
58 done
059b5f3d7808 added rDNS to tinydns datafile generation
Nick <nick@somerandomnick.ano>
parents: 12
diff changeset
59 done
059b5f3d7808 added rDNS to tinydns datafile generation
Nick <nick@somerandomnick.ano>
parents: 12
diff changeset
60 done
059b5f3d7808 added rDNS to tinydns datafile generation
Nick <nick@somerandomnick.ano>
parents: 12
diff changeset
61 fi
059b5f3d7808 added rDNS to tinydns datafile generation
Nick <nick@somerandomnick.ano>
parents: 12
diff changeset
62 done
059b5f3d7808 added rDNS to tinydns datafile generation
Nick <nick@somerandomnick.ano>
parents: 12
diff changeset
63 fi