Skip to content

Commit a0e0225

Browse files
committed
cleanup tld db
1 parent 452d329 commit a0e0225

7 files changed

Lines changed: 308 additions & 375 deletions

File tree

analizer/Makefile

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,16 +35,21 @@ COMMON_VENV := rm -rf $(VENV); \
3535

3636
all: clean prep test
3737

38+
# ---------------------------
3839
clean: cleanupVenv
3940
rm -f *.1 *.2 *.log *.tmp 1 2
4041
rm -rf .mypy_cache
4142
# rm -f IanaDb.sqlite # dont remove during testing
4243
rm -rf .iana_cache/ .psl_cache/
4344

45+
realclean: clean
46+
rm -f *.sqlite
47+
4448
# cleanup the virtual env
4549
cleanupVenv:
4650
rm -rf $(VENV)
4751

52+
# ---------------------------
4853
prep: format check
4954

5055
format:
@@ -53,10 +58,12 @@ format:
5358
check:
5459
ruff check --fix $(PY_FILES)
5560

61+
# ---------------------------
5662
test: IanaDb.sqlite
5763
$(COMMON_VENV) \
5864
$(PIP_INSTALL) -r requirements.txt ;\
5965
./investigateTld.py 2>2 | tee 1
66+
cat 2
6067

6168
IanaDb.sqlite:
6269
$(COMMON_VENV) \

analizer/investigateTld.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,14 @@ def extract_server_hints(aDict: dict[str, Any]) -> dict[str, Any]:
2121
# key will be the whois server, data will be the list of tld's using this server
2222
servers: dict[str, Any] = {}
2323
k = "_server"
24+
2425
for key, value in aDict.items():
2526
if k in value:
2627
server = value[k]
2728
if server not in servers:
2829
servers[server] = []
2930
servers[server].append(key)
30-
# print(servers)
31+
3132
return servers
3233

3334

@@ -53,8 +54,6 @@ def xMain() -> None:
5354
dbFileName = "IanaDb.sqlite"
5455
allTld: list[str] = []
5556

56-
# print(tld_regexpr.ZZ)
57-
# sys.exit(0)
5857
server_hints = extract_server_hints(tld_regexpr.ZZ)
5958

6059
iad = IanaDatabase(verbose=verbose)
@@ -68,9 +67,10 @@ def xMain() -> None:
6867
tld = ot.tld
6968
forest[tld] = ot
7069

71-
for tld, data in forest.items():
72-
if data.rdap_info != "NULL":
73-
print(tld, data.rdap_info)
70+
if 0:
71+
for tld, data in forest.items():
72+
if data.rdap_info != "NULL":
73+
print("RDAP", tld, data.rdap_info)
7474

7575
allTld = sorted(allTld)
7676
for tld in tld_regexpr.ZZ:

analizer/oneTld.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,14 +155,18 @@ def _doUtf8Preparations(self):
155155
return False
156156

157157
def _skipKnowTld(self):
158+
z = self.allKnownTldDict.get(self.tld, {}).get("_privateRegistry")
159+
if z is not None:
160+
return False
161+
158162
if self.tld2 == self.tld and self.tld in self.allKnownTldDict:
159163
return True
160164

161165
return self.tld2 in self.allKnownTldDict and self.tld in self.allKnownTldDict
162166

163167
def _doNoManagerTld(self):
164168
if self.manager == "NULL":
165-
print(f"no manager fir tld: {self.tld}")
169+
print(f"no manager for tld: {self.tld}")
166170
if self.tld not in self.allKnownTldDict:
167171
print(f'# ZZ["{self.tld}"] = ' + '{"_privateRegistry": True} # no manager')
168172

@@ -254,6 +258,12 @@ def processRow(
254258
if n():
255259
return
256260

261+
if "whois.identitydigital.services" in self.resolved_whois_servers:
262+
return
263+
264+
if "tucowsregistry.net" in self.resolved_whois_servers:
265+
return
266+
257267
print(
258268
"# MISSING",
259269
self.tld,

analizer/requirements.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
dnspython
22
beautifulsoup4
33
requests-cache
4+
tld
5+
whodap

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@
177177
"PLW0603", # Using the global statement to update `xxx` is discouraged
178178
"PLW0602", # Using global for `xxx` but no assignment is done
179179

180-
"RUF001", # String contains ambiguous urf8 char
180+
"RUF001", # String contains ambiguous utf8 char
181181
"RUF067", # `__init__` module should only contain docstrings and re-exports
182182

183183
"S101", # Use of `assert` detected

0 commit comments

Comments
 (0)