Skip to content

Commit

Permalink
.ga TLD support (freenom)
Browse files Browse the repository at this point in the history
  • Loading branch information
yaroslaff committed Feb 7, 2025
1 parent 96360e4 commit eef30c0
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
25 changes: 25 additions & 0 deletions whois/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -411,6 +411,8 @@ def load(domain: str, text: str):
return WhoisLv(domain, text)
elif domain.endswith(".co"):
return WhoisCo(domain, text)
elif domain.endswith(".ga"):
return WhoisGa(domain, text)
else:
return WhoisEntry(domain, text)

Expand Down Expand Up @@ -3462,6 +3464,28 @@ def __init__(self, domain: str, text: str):
else:
WhoisEntry.__init__(self, domain, text, self.regex)

class WhoisGa(WhoisEntry):
"""Whois parser for .ga domains"""

regex: dict[str, str] = {
"domain_name": r"Nom de domaine: *(.+)",
"registrant_name": r"\[HOLDER\]\r\nID Contact:.+\r\nType:.+\r\nNom:\s+(.*)",
"registrant_address": r"\[HOLDER\]\r\nID Contact:.+\r\nType:.+\r\nNom:\s+.*\r\nAdresse:\s+(.*)",
"tech_name": r"\[TECH_C\]\r\nID Contact:.+\r\nType:.+\r\nNom:\s+(.*)",
"tech_address": r"\[TECH_C\]\r\nID Contact:.+\r\nType:.+\r\nNom:\s+.*\r\nAdresse:\s+(.*)",
"registrar_name": r"Registrar: +(.+)",
"name_servers": r"Serveur de noms: +(.+)",
"creation_date": r"Date de création: +(.+)",
"updated_date": r"Dernière modification: +(.+)",
"expiration_date": r"Date d'expiration: +(.+)"
}

def __init__(self, domain: str, text: str):
if "%% NOT FOUND" in text:
raise WhoisDomainNotFoundError(text)
else:
WhoisEntry.__init__(self, domain, text, self.regex)


class WhoisCo(WhoisEntry):
"""Whois parser for .co domains"""
Expand All @@ -3471,3 +3495,4 @@ def __init__(self, domain, text):
raise WhoisDomainNotFoundError(text)
else:
WhoisEntry.__init__(self, domain, text, self.regex)

3 changes: 3 additions & 0 deletions whois/whois.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ class NICClient:
UKR_HOST = "whois.dotukr.com"
TN_HOST = "whois.ati.tn"
SBS_HOST = "whois.nic.sbs"
GA_HOST = "whois.nic.ga"

SITE_HOST = "whois.nic.site"
DESIGN_HOST = "whois.nic.design"
Expand Down Expand Up @@ -394,6 +395,8 @@ def choose_server(self, domain: str) -> Optional[str]:
return NICClient.SG_HOST
elif tld == "site":
return NICClient.SITE_HOST
elif tld == "ga":
return NICClient.GA_HOST
else:
return self.findwhois_iana(tld)
# server = tld + NICClient.QNICHOST_TAIL
Expand Down

0 comments on commit eef30c0

Please sign in to comment.