|
1 | 1 | #! /usr/bin/bash |
2 | 2 |
|
3 | | -DOMAINS=( |
4 | | - example.net # has iana source |
5 | | - example.com # has iana source |
6 | | - example.org # has no iana source |
7 | | - meta.co.uk # has multiline for all relevant fields and 4 nameservers; should be fixed output has only 2 |
8 | | - xs4all.nl # has multiline nameserver and multiline registrar; outout has no nameservers should be 2 |
9 | | - meta.com.sg # has mail |
10 | | - meta.com # have emails |
11 | | - google.com # have emails |
12 | | - meta.jp # jp has [registrar] type keywords not registrar: |
13 | | - meta.co.jp # jp has [registrar] type keywords not registrar: |
14 | | - meta.kr # has both korean and english text |
15 | | -) |
16 | | - |
17 | | -for str in ${DOMAINS[@]} |
18 | | -do |
19 | | - echo "$str" |
| 3 | +getDomains() |
| 4 | +{ |
| 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 | + google.com # have emails |
| 14 | + meta.jp # jp has [registrar] type keywords not registrar: |
| 15 | + meta.co.jp # jp has [registrar] type keywords not registrar: |
| 16 | + meta.kr # has both korean and english text |
| 17 | + meta.com.tr # has utf 8 response text and different formatting style |
| 18 | + ) |
| 19 | +} |
| 20 | + |
| 21 | +makeDataForDomain() |
| 22 | +{ |
| 23 | + local str="$1" |
20 | 24 |
|
21 | 25 | # create one dir for each domain we will test |
22 | 26 | mkdir -p "$str" |
23 | 27 |
|
24 | 28 | # dump the raw whois data as in |
25 | | - whois "$str" | tee "./$str/input" |
| 29 | + whois "$str" | |
| 30 | + tee "./$str/input" |
26 | 31 |
|
27 | 32 | # dump the expected output as output |
28 | | - ../test2.py -d "$str" | tee "./$str/output" |
29 | | -done |
| 33 | + ../test2.py -d "$str" | |
| 34 | + tee "./$str/output" |
| 35 | +} |
| 36 | + |
| 37 | +makeDataIfNotExist() |
| 38 | +{ |
| 39 | + for str in ${DOMAINS[@]} |
| 40 | + do |
| 41 | + [ -d "$str" ] && continue |
| 42 | + makeDataForDomain "$str" |
| 43 | + done |
| 44 | +} |
| 45 | + |
| 46 | +main() |
| 47 | +{ |
| 48 | + getDomains |
| 49 | + makeDataIfNotExist |
| 50 | +} |
| 51 | + |
| 52 | +main |
0 commit comments