11#! /usr/bin/bash
22
3+ WHERE=$( dirname $0 )
4+
35getDomains ()
46{
5- DOMAINS=(
6- example.net # has iana source
7- example.com # has iana source
8- example.org # has no iana source
9- meta.co.uk # has multiline for all relevant fields and 4 nameservers; should be fixed output has only 2
10- xs4all.nl # has multiline nameserver and multiline registrar; outout has no nameservers should be 2
11- meta.com.sg # has mail
12- meta.com # have emails
13- meta.jp # jp has [registrar] type keywords not registrar:
14- meta.co.jp # jp has [registrar] type keywords not registrar:
15- meta.kr # has both korean and english text
16- meta.com.tr # has utf 8 response text and different formatting style
17- hello.xyz # has sometimes IANA Source beginning on mac
18- )
7+ cat DOMAINS.txt |
8+ awk '
9+ /^[ \t]*;/ { next }
10+ /^[ \t]*#/ { next }
11+ /^[ \t]*$/ { next }
12+ { print $1 }
13+ '
1914}
2015
2116verifyNameservers ()
2217{
2318 local str=" $1 "
2419
25- grep name_servers " ./$str /output" | awk ' { $1 = $2 = ""; print }' | awk -F, ' {print NF}'
26- grep " name server" " ./$str /nameservers" | wc -l
20+ grep name_servers " ./$str /output" |
21+ awk ' { $1 = $2 = ""; print }' |
22+ awk -F, ' {print NF}'
2723
24+ grep " name server" " ./$str /nameservers" |
25+ wc -l
2826}
27+
2928makeDataForDomain ()
3029{
3130 local str=" $1 "
@@ -38,7 +37,7 @@ makeDataForDomain()
3837 tee " ./$str /input"
3938
4039 # dump the expected output as output
41- ../test2.py -d " $str " |
40+ ../bin/ test2.py -d " $str " |
4241 tee " ./$str /output"
4342
4443 # dump the nameservers via host
@@ -48,31 +47,23 @@ makeDataForDomain()
4847 # verifyNameservers "$str"
4948}
5049
51- makeDataIfNotExist ()
50+ main ()
5251{
53- for str in ${DOMAINS[@]}
54- do
55- [ -d " $str " ] && continue
56- makeDataForDomain " $str "
57- done
58- }
52+ local force=" $1 "
5953
60- makeDataIfExist ()
61- {
62- for str in ${DOMAINS[@]}
54+ cd " ${WHERE} "
55+ getDomains |
56+ while read str
6357 do
64- makeDataForDomain " $str "
65- done
66- }
58+ [ " $force " == " force" ] && {
59+ makeDataForDomain " $str "
60+ continue
61+ }
6762
68- main ()
69- {
70- local force=" $1 "
71- getDomains
72- makeDataIfNotExist
73- [ " $force " == " force" ] && {
74- makeDataIfExist
75- }
63+ [ ! -d " $str " ] && {
64+ makeDataForDomain " $str "
65+ }
66+ done
7667}
7768
7869main $*
0 commit comments