Mercurial > hg > anonet-resdb
annotate scripts/check_db_safety @ 1005:11ecd4905207 draft
welcome /spoofnet :-)
author | Nick <nick@somerandomnick.ano> |
---|---|
date | Sun, 02 Sep 2012 06:49:29 +0000 |
parents | 80b445c8c88a |
children | b19ced4435be |
rev | line source |
---|---|
12
41b330b11a33
coded a tinydns datafile generator
Nick <nick@somerandomnick.ano>
parents:
diff
changeset
|
1 #!/bin/sh |
77
6c1d4e261fdf
OpenBSD fix (bug found by Quintum)
Nick <nick@somerandomnick.ano>
parents:
13
diff
changeset
|
2 if [ "$(ls db/dom/ | tr -d 'a-z0-9\n-' | wc -c | tr -d ' \t')" != 0 ]; then |
12
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 |
78
f37d8fca5548
more OpenBSD fixes (again, thanks Quintum)
Nick <nick@somerandomnick.ano>
parents:
77
diff
changeset
|
7 if [ "$(ls $tld/ | tr -d 'a-z0-9\n-' | wc -c | tr -d ' \t')" != 0 ]; then |
12
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 |
78
f37d8fca5548
more OpenBSD fixes (again, thanks Quintum)
Nick <nick@somerandomnick.ano>
parents:
77
diff
changeset
|
14 if [ "$(ls $dom/ns/ | tr -d 'a-z0-9\n.-' | wc -c | tr -d ' \t')" != 0 ]; then |
12
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 |
532
c9a7817b5f1d
reverting IPv6 changes because too much new complexity and no real benefit
Nick <nick@somerandomnick.ano>
parents:
78
diff
changeset
|
18 exit 1 |
12
41b330b11a33
coded a tinydns datafile generator
Nick <nick@somerandomnick.ano>
parents:
diff
changeset
|
19 fi |
41b330b11a33
coded a tinydns datafile generator
Nick <nick@somerandomnick.ano>
parents:
diff
changeset
|
20 for ns in $dom/ns/* ; do |
896 | 21 if [ "$(cat $ns | tr -d '0-9.\r\n' | wc -c | tr -d ' \t')" != 0 ]; then |
12
41b330b11a33
coded a tinydns datafile generator
Nick <nick@somerandomnick.ano>
parents:
diff
changeset
|
22 domain="$(basename $dom).$(basename $tld)" |
41b330b11a33
coded a tinydns datafile generator
Nick <nick@somerandomnick.ano>
parents:
diff
changeset
|
23 nsname="$(basename $ns)" |
41b330b11a33
coded a tinydns datafile generator
Nick <nick@somerandomnick.ano>
parents:
diff
changeset
|
24 echo "There's a bad nameserver IP under $domain, for" >&2 |
41b330b11a33
coded a tinydns datafile generator
Nick <nick@somerandomnick.ano>
parents:
diff
changeset
|
25 echo " $nsname" >&2 |
41b330b11a33
coded a tinydns datafile generator
Nick <nick@somerandomnick.ano>
parents:
diff
changeset
|
26 echo "You probably don't want to run any shell scripts." >&2 |
532
c9a7817b5f1d
reverting IPv6 changes because too much new complexity and no real benefit
Nick <nick@somerandomnick.ano>
parents:
78
diff
changeset
|
27 exit 1 |
12
41b330b11a33
coded a tinydns datafile generator
Nick <nick@somerandomnick.ano>
parents:
diff
changeset
|
28 fi |
41b330b11a33
coded a tinydns datafile generator
Nick <nick@somerandomnick.ano>
parents:
diff
changeset
|
29 done |
41b330b11a33
coded a tinydns datafile generator
Nick <nick@somerandomnick.ano>
parents:
diff
changeset
|
30 done |
41b330b11a33
coded a tinydns datafile generator
Nick <nick@somerandomnick.ano>
parents:
diff
changeset
|
31 done |
78
f37d8fca5548
more OpenBSD fixes (again, thanks Quintum)
Nick <nick@somerandomnick.ano>
parents:
77
diff
changeset
|
32 if [ "$(ls db/ip/ | tr -d 'A-F0-9\n' | wc -c | tr -d ' \t')" != 0 ]; then |
13
059b5f3d7808
added rDNS to tinydns datafile generation
Nick <nick@somerandomnick.ano>
parents:
12
diff
changeset
|
33 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
|
34 exit 1 |
059b5f3d7808
added rDNS to tinydns datafile generation
Nick <nick@somerandomnick.ano>
parents:
12
diff
changeset
|
35 for first in db/ip/* ; do |
78
f37d8fca5548
more OpenBSD fixes (again, thanks Quintum)
Nick <nick@somerandomnick.ano>
parents:
77
diff
changeset
|
36 if [ "$(ls $first/ | tr -d 'A-F0-9\n' | wc -c | tr -d ' \t')" != 0 ]; then |
13
059b5f3d7808
added rDNS to tinydns datafile generation
Nick <nick@somerandomnick.ano>
parents:
12
diff
changeset
|
37 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
|
38 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
|
39 exit 1 |
059b5f3d7808
added rDNS to tinydns datafile generation
Nick <nick@somerandomnick.ano>
parents:
12
diff
changeset
|
40 for second in $first/* ; do |
78
f37d8fca5548
more OpenBSD fixes (again, thanks Quintum)
Nick <nick@somerandomnick.ano>
parents:
77
diff
changeset
|
41 if [ "$(ls $second/ | tr -d 'A-F0-9\n' | wc -c | tr -d ' \t')" != 0 ]; then |
13
059b5f3d7808
added rDNS to tinydns datafile generation
Nick <nick@somerandomnick.ano>
parents:
12
diff
changeset
|
42 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
|
43 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
|
44 exit 1 |
059b5f3d7808
added rDNS to tinydns datafile generation
Nick <nick@somerandomnick.ano>
parents:
12
diff
changeset
|
45 fi |
059b5f3d7808
added rDNS to tinydns datafile generation
Nick <nick@somerandomnick.ano>
parents:
12
diff
changeset
|
46 for third in $second/* ; do |
78
f37d8fca5548
more OpenBSD fixes (again, thanks Quintum)
Nick <nick@somerandomnick.ano>
parents:
77
diff
changeset
|
47 if [ "$(ls $third/ns/ | tr -d 'a-z0-9\n.-' | wc -c | tr -d ' \t')" != 0 ]; then |
13
059b5f3d7808
added rDNS to tinydns datafile generation
Nick <nick@somerandomnick.ano>
parents:
12
diff
changeset
|
48 ip="$(basename $first).$(basename $second).$(basename $third).0/24" |
059b5f3d7808
added rDNS to tinydns datafile generation
Nick <nick@somerandomnick.ano>
parents:
12
diff
changeset
|
49 echo "There's a bad nameserver under $ip." >&2 |
059b5f3d7808
added rDNS to tinydns datafile generation
Nick <nick@somerandomnick.ano>
parents:
12
diff
changeset
|
50 echo "You probably don't want to run any shell scripts." >&2 |
532
c9a7817b5f1d
reverting IPv6 changes because too much new complexity and no real benefit
Nick <nick@somerandomnick.ano>
parents:
78
diff
changeset
|
51 exit 1 |
13
059b5f3d7808
added rDNS to tinydns datafile generation
Nick <nick@somerandomnick.ano>
parents:
12
diff
changeset
|
52 fi |
059b5f3d7808
added rDNS to tinydns datafile generation
Nick <nick@somerandomnick.ano>
parents:
12
diff
changeset
|
53 for ns in $third/ns/* ; do |
78
f37d8fca5548
more OpenBSD fixes (again, thanks Quintum)
Nick <nick@somerandomnick.ano>
parents:
77
diff
changeset
|
54 if [ "$(cat $ns | tr -d '0-9.\n' | wc -c | tr -d ' \t')" != 0 ]; then |
13
059b5f3d7808
added rDNS to tinydns datafile generation
Nick <nick@somerandomnick.ano>
parents:
12
diff
changeset
|
55 ip="$(basename $first).$(basename $second).$(basename $third).0/24" |
059b5f3d7808
added rDNS to tinydns datafile generation
Nick <nick@somerandomnick.ano>
parents:
12
diff
changeset
|
56 nsname="$(basename $ns)" |
059b5f3d7808
added rDNS to tinydns datafile generation
Nick <nick@somerandomnick.ano>
parents:
12
diff
changeset
|
57 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
|
58 echo " $nsname" >&2 |
059b5f3d7808
added rDNS to tinydns datafile generation
Nick <nick@somerandomnick.ano>
parents:
12
diff
changeset
|
59 echo "You probably don't want to run any shell scripts." >&2 |
532
c9a7817b5f1d
reverting IPv6 changes because too much new complexity and no real benefit
Nick <nick@somerandomnick.ano>
parents:
78
diff
changeset
|
60 exit 1 |
13
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 done |
059b5f3d7808
added rDNS to tinydns datafile generation
Nick <nick@somerandomnick.ano>
parents:
12
diff
changeset
|
64 done |
059b5f3d7808
added rDNS to tinydns datafile generation
Nick <nick@somerandomnick.ano>
parents:
12
diff
changeset
|
65 fi |
059b5f3d7808
added rDNS to tinydns datafile generation
Nick <nick@somerandomnick.ano>
parents:
12
diff
changeset
|
66 done |
059b5f3d7808
added rDNS to tinydns datafile generation
Nick <nick@somerandomnick.ano>
parents:
12
diff
changeset
|
67 fi |