Skip to content
This repository was archived by the owner on Feb 3, 2024. It is now read-only.

Commit 642daca

Browse files
committed
add tld's do, com.do, mo, com.mo, cx, dz, gd, mn, gay, tl, tt; add options to makeTestdataAll
1 parent 960b157 commit 642daca

File tree

6 files changed

+61
-21
lines changed

6 files changed

+61
-21
lines changed

DONE

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,3 +28,8 @@ DONE
2828
- allow maketestDataAll.sh -v -f -d com.sg to show the reduced input.out and the produced output of test2.py
2929
- add '[WHITESPACE AT END]' in input.out during input reduction test
3030

31+
- add tld do, com.do, mo, com.mo, cx, dz (never answeres), gd, mn, gay, tl, tt (responds with perl script)
32+
33+
- add -t <tld> and -d <dmian> to makeTastdataAll support a cusom domain and not meta, google default
34+
35+

makeTestdataAll.sh

Lines changed: 30 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,6 @@ getDnsSoaRecordAndLeaveEvidenceTldDomain()
133133
makeDirectoryForTld()
134134
{
135135
local tld="$1"
136-
local domain="$2"
137136
local d="$TMPDIR/$tld"
138137

139138
mkdir -p "$d" || {
@@ -167,23 +166,31 @@ makeTestDataOriginalOneTldDomain()
167166

168167
domainsToTry()
169168
{
170-
cat <<! |
169+
local domain="$1"
170+
171+
[ "$domain" = "__DEFAULT__" ] && {
172+
cat <<! |
171173
meta
172174
google
173175
!
174-
awk '
175-
/^[ \t]*$/ { next }
176-
/^[ \t]*;/ { next }
177-
/^[ \t]*#/ { next }
178-
{ print $1 }
179-
'
176+
awk '
177+
/^[ \t]*$/ { next }
178+
/^[ \t]*;/ { next }
179+
/^[ \t]*#/ { next }
180+
{ print $1 }
181+
'
182+
return
183+
}
184+
185+
echo "$domain"
180186
}
181187

182188
makeTestDataTldFromDomains()
183189
{
184190
local tld="$1"
191+
local domain="$2"
185192

186-
domainsToTry |
193+
domainsToTry "$domain" |
187194
while read domain
188195
do
189196
[ "$VERBOSE" = "1" ] && echo "try: $domain.$tld"
@@ -220,12 +227,13 @@ makeRulesFromTldIfExist()
220227
makeTestDataOriginalOneTld()
221228
{
222229
local tld="$1"
230+
local domain="$2"
223231

224232
[ "$VERBOSE" = "1" ] && echo "try: $tld"
225233

226-
makeDirectoryForTld "$tld" "$domain" || exit 101
234+
makeDirectoryForTld "$tld" || exit 101
227235
makeRulesFromTldIfExist "$tld"
228-
makeTestDataTldFromDomains "$tld"
236+
makeTestDataTldFromDomains "$tld" "$domain"
229237
}
230238

231239
makeTestDataOriginalAllTldSupported()
@@ -245,7 +253,8 @@ $0 usage:
245253
-h show the help text
246254
-v switch on verbose (will show progress)
247255
-f switch on force (will re analyze all)
248-
-d <domain> specify a domain to analize if domain == ALL andlize all tld;s
256+
-t <domain> specify a tld to analize
257+
-a analyze all tld currently supported
249258
!
250259
exit 0;
251260
}
@@ -258,7 +267,9 @@ main()
258267
FORCE=0
259268
ALL=0
260269

261-
while getopts "havfd:" arg;
270+
local domain="__DEFAULT__"
271+
272+
while getopts "havft:d:" arg;
262273
do
263274
case $arg in
264275

@@ -271,7 +282,11 @@ main()
271282
a) ALL=1
272283
;;
273284

274-
d) domain=${OPTARG}
285+
t) tld="${OPTARG}"
286+
;;
287+
288+
d) domain="${OPTARG}"
289+
# instead of the default meta and google use this domain and combine it with the tld for processing
275290
;;
276291

277292
h | *) usage
@@ -286,7 +301,7 @@ main()
286301
return
287302
}
288303

289-
makeTestDataOriginalOneTld "$domain"
304+
makeTestDataOriginalOneTld "$tld" "$domain"
290305
}
291306

292307
main $* 2>&1 |

test2.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ def printMe(self):
155155
if len(self.rDict[k]):
156156
n = 0
157157
for lines in self.rDict[k]:
158-
ws = " [WHITESPACE AT END] " if re.search(r'[ \t]+\r?\n', lines) else ""
158+
ws = " [WHITESPACE AT END] " if re.search(r"[ \t]+\r?\n", lines) else ""
159159
tab = " [TAB] " if "\t" in lines else "" # tabs are present in this section
160160
cr = " [CR] " if "\r" in lines else "" # \r is present in this section
161161
print(f"# --- {k} Section: {n} {cr}{tab}{ws}")

whois/_2_parse.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,9 @@ def cleanupWhoisResponse(
8787
if "REDACTED FOR PRIVACY" in line: # these lines contibute nothing so ignore
8888
continue
8989

90-
if "Please query the RDDS service of the Registrar of Record" in line: # these lines contibute nothing so ignore
90+
if (
91+
"Please query the RDDS service of the Registrar of Record" in line
92+
): # these lines contibute nothing so ignore
9193
continue
9294

9395
# regular responses may at the end have meta info starting with a line >>> some texte <<<

whois/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,8 @@
6969
#
7070
".com.au": "com_au",
7171
".com.sg": "com_sg",
72+
".com.do": "com_do",
73+
".com.mo": "com_mo",
7274
#
7375
# TÜRKİYE (formerly Turkey)
7476
".com.tr": "com_tr",

whois/tld_regexpr.py

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -136,9 +136,8 @@
136136
"updated_date": r"modified\.+:\s?(\S+)",
137137
"name_servers": r"nserver\.+:\s*(\S+)",
138138
"status": r"status\.+:\s*(\S+)",
139-
"registrant": r"Holder\s+name\.+:\s*(.+)\r?\n", # not always present see meta.ax and google.ax
140-
"registrant_country": r"country\.+:\s*(.+)\r?\n", # not always present see meta.ax and google.ax
141-
139+
"registrant": r"Holder\s+name\.+:\s*(.+)\r?\n", # not always present see meta.ax and google.ax
140+
"registrant_country": r"country\.+:\s*(.+)\r?\n", # not always present see meta.ax and google.ax
142141
}
143142

144143
aw = {
@@ -277,7 +276,7 @@
277276
"registrant": r"\*\* Registrant:\s+?(.+)",
278277
"registrant_country": None,
279278
"creation_date": r"Created on\.+:\s?(.+).",
280-
"expiration_date": r"Expires on\.+:\s?(.+).", # note the trailing . on both dates fields
279+
"expiration_date": r"Expires on\.+:\s?(.+).", # note the trailing . on both dates fields
281280
"updated_date": "",
282281
"name_servers": r"\*\* Domain Servers:\n(?:(\S+)\n)(?:(\S+)\n)?(?:(\S+)\n)?(?:(\S+)\n)?(?:(\S+)\n)?(?:(\S+)\n)\n?",
283282
"status": None,
@@ -1976,3 +1975,20 @@
19761975
"updated_date": None,
19771976
"registrant_country": None,
19781977
}
1978+
1979+
do = {"extend": "_privateReg"}
1980+
com_do = {"extend": "_privateReg"}
1981+
cx = {"extend": "com"}
1982+
dz = {"extend": "_privateReg"}
1983+
gd = {"extend": "com"}
1984+
mn = {"extend": "com"}
1985+
tl = {"extend": "com"}
1986+
gay = { "extend": "com", "_server": "whois.nic.gay" }
1987+
tt = {"extend": "_privateReg"}
1988+
mo = {
1989+
"extend": "com",
1990+
"creation_date": r"created on\s+(.+)",
1991+
"expiration_date": r"expires on\s+(.+)",
1992+
"name_servers": r"Domain name servers:\s*\-+(?:\s*(\S+)\n)(?:\s*(\S+)\n)?(?:\s*(\S+)\n)?(?:\s*(\S+)\n)?",
1993+
}
1994+
com_mo = { "extend": "mo"}

0 commit comments

Comments
 (0)