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

Commit 99104e3

Browse files
committed
add amfam tld
1 parent 08ab1ad commit 99104e3

File tree

2 files changed

+25
-15
lines changed

2 files changed

+25
-15
lines changed

compare_known_tld.py

Lines changed: 21 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -38,40 +38,49 @@
3838
forceDownloadTld=forceDownloadTld,
3939
)
4040

41+
# ge python whois known tld's and second level domains
4142
known = sorted(whois.validTlds())
4243

44+
# get iana data
4345
URL = "https://data.iana.org/TLD/tlds-alpha-by-domain.txt"
4446
response = urllib.request.urlopen(URL)
4547
data = response.read().decode("utf-8").lower()
4648
dataList = sorted(data.splitlines())
4749

50+
# filter out known names and try to detect names not known by iana
4851
for name in known:
49-
# print(name)
5052
if name in dataList:
51-
del dataList[dataList.index(name)]
52-
53-
# Try to auto detect new domaisn via IANA and some known common regex lists like .com
54-
53+
continue
54+
if "." in name:
55+
continue
56+
if name not in dataList:
57+
print(f"{name} tld name from python_whois is not known in IANA list")
58+
continue
59+
60+
dataList2 = []
61+
for name in dataList:
62+
if name in known:
63+
continue
64+
dataList2.append(name)
65+
66+
# Try to auto detect new domains via IANA and some known common regex lists like .com
5567
found = {}
56-
for tld in dataList:
68+
for tld in dataList2:
5769
data, status = i.getInfoOnOneTld(tld)
58-
# print(data)
70+
# print(status, data)
5971

6072
if data and "whois" in data and data["whois"] and data["whois"] != "NULL":
6173
wh = data["whois"]
62-
# print(tld, wh, data, status)
6374
if wh.endswith(f".{tld}"):
6475
dd = wh.split(".")[-2:]
6576
else:
6677
dd = ["meta", tld]
6778

68-
# print(dd)
6979
zz = _do_whois_query(
7080
dd,
7181
ignore_returncode=False,
7282
server=wh,
7383
)
74-
# print(zz)
7584

7685
pp = {"_server": wh, "extend": "com"}
7786
aDictToTestOverride = {tld: pp}
@@ -87,8 +96,5 @@
8796
except Exception as e:
8897
print(e)
8998

90-
for tld in found:
91-
print(f"## ZZ['{tld}'] = {found[tld]} # auto-detected via IANA tld")
92-
93-
# TODO
94-
# also make a list of all tld (without dot in them) that no longer exists in iana, we can remove them
99+
else:
100+
print(f"no whois info for tld: {tld}\n", data)

whois/tld_regexpr.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1951,6 +1951,8 @@
19511951
# 3322_org = {"extend": "_privateReg"} # dynamic dns without any whois
19521952

19531953
# https://en.wikipedia.org/wiki/.onion, a "official" fake domain
1954+
# https://www.rfc-editor.org/rfc/rfc7686.html
1955+
# .onion names are used to provide access to end to end encrypted, secure, anonymized services;
19541956
ZZ["onion"] = {"extend": "_privateReg"}
19551957

19561958
# backend registry for domain names ending in GG, JE, and AS.
@@ -2648,3 +2650,5 @@
26482650
ZZ["yokohama"] = {"_server": "whois.nic.yokohama", "extend": "com"}
26492651
ZZ["you"] = {"_server": "whois.nic.you", "extend": "com"}
26502652
ZZ["zappos"] = {"_server": "whois.nic.zappos", "extend": "com"}
2653+
2654+
ZZ['amfam'] = {'_server': 'whois.nic.amfam', 'extend': 'com'}

0 commit comments

Comments
 (0)