Skip to content

Commit

Permalink
Merge pull request #60 from pogzyb/Add-abuse-parsers
Browse files Browse the repository at this point in the history
Add additional Registrar fields
  • Loading branch information
pogzyb authored Jul 5, 2023
2 parents 96635ea + ae7f224 commit 4c91f14
Show file tree
Hide file tree
Showing 4 changed files with 64 additions and 56 deletions.
3 changes: 3 additions & 0 deletions asyncwhois/parse.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,9 @@ class TLDBaseKeys(str, Enum):

REGISTRAR = "registrar"
REGISTRAR_IANA_ID = "registrar_iana_id"
REGISTRAR_URL = "registrar_url"
REGISTRAR_ABUSE_EMAIL = "registrar_abuse_email"
REGISTRAR_ABUSE_PHONE = "registrar_abuse_phone"

REGISTRANT_NAME = "registrant_name"
REGISTRANT_ORGANIZATION = "registrant_organization"
Expand Down
102 changes: 47 additions & 55 deletions asyncwhois/parse_tld.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ class TLDParser(BaseParser):
TLDBaseKeys.EXPIRES: r"Expir\w+\sDate: *(.+)",
TLDBaseKeys.REGISTRAR: r"Registrar: *(.+)",
TLDBaseKeys.REGISTRAR_IANA_ID: r"Registrar IANA ID: *(.+)",
TLDBaseKeys.REGISTRAR_URL: r"Registrar URL: *(.+)",
TLDBaseKeys.REGISTRAR_ABUSE_EMAIL: r"Registrar Abuse Contact Email: *(.+)",
TLDBaseKeys.REGISTRAR_ABUSE_PHONE: r"Registrar Abuse Contact Phone: *(.+)",
TLDBaseKeys.REGISTRANT_NAME: r"Registrant Name: *(.+)",
TLDBaseKeys.REGISTRANT_ORGANIZATION: r"Registrant Organization: *(.+)",
TLDBaseKeys.REGISTRANT_ADDRESS: r"Registrant Street: *(.+)",
Expand Down Expand Up @@ -116,7 +119,6 @@ def _init_parser(tld: str) -> TLDParser:
"by": RegexBY(),
"cc": RegexCC(),
"ch": RegexCH(),
"ci": RegexCI(),
"cl": RegexCL(),
"cn": RegexCN(),
"cr": RegexCR(),
Expand Down Expand Up @@ -193,6 +195,7 @@ class RegexRU(TLDParser):
TLDBaseKeys.REGISTRANT_ORGANIZATION: r"org: *(.+)",
TLDBaseKeys.STATUS: r"state: *(.+)",
TLDBaseKeys.NAME_SERVERS: r"nserver: *(.+)",
TLDBaseKeys.ADMIN_EMAIL: r"admin-contact: *(.+)"
}

def __init__(self):
Expand Down Expand Up @@ -248,6 +251,7 @@ class RegexRO(TLDParser):
TLDBaseKeys.CREATED: r"Registered On: *(.+)",
TLDBaseKeys.EXPIRES: r"Expires On: *(.+)",
TLDBaseKeys.NAME_SERVERS: r"Nameserver: *(.+)",
TLDBaseKeys.REGISTRAR_URL: r"Referral URL: *(.+)"
}

def __init__(self):
Expand All @@ -259,6 +263,7 @@ class RegexPE(TLDParser):
_pe_expressions = {
TLDBaseKeys.REGISTRANT_NAME: r"Registrant name: *(.+)",
TLDBaseKeys.REGISTRAR: r"Sponsoring Registrar: *(.+)",
TLDBaseKeys.ADMIN_EMAIL: r"Admin Email: *(.+)",
TLDBaseKeys.DNSSEC: r"DNSSEC: *(.+)",
TLDBaseKeys.NAME_SERVERS: r"Name server: *(.+)",
TLDBaseKeys.STATUS: r"Domain Status: *(.+)",
Expand All @@ -276,7 +281,9 @@ class RegexEE(TLDParser):
TLDBaseKeys.CREATED: r"registered: *([^\n\r]+)",
TLDBaseKeys.UPDATED: r"changed: *([^\n\r]+)",
TLDBaseKeys.EXPIRES: r"expire: *([^\n\r]+)",
TLDBaseKeys.REGISTRAR: r"Registrar: *[\n\r]+\s*name: *([^\n\r]+)",
TLDBaseKeys.REGISTRAR: r"(?<=Registrar)[\s\S]*?name: *(.+)",
TLDBaseKeys.REGISTRAR_URL: r"(?<=Registrar)[\s\S]*?url: *(.+)",
TLDBaseKeys.REGISTRAR_ABUSE_PHONE: r"(?<=Registrar)[\s\S]*?phone: *(.+)",
TLDBaseKeys.NAME_SERVERS: r"nserver: *(.*)",
TLDBaseKeys.REGISTRANT_COUNTRY: r"country: *(.+)",
}
Expand All @@ -293,6 +300,7 @@ class RegexFR(TLDParser):
TLDBaseKeys.UPDATED: r"last-update: (\d{4}-\d{2}-\d{2})",
TLDBaseKeys.EXPIRES: r"Expiry Date: (\d{4}-\d{2}-\d{2})",
TLDBaseKeys.NAME_SERVERS: r"nserver: *(.+)",
TLDBaseKeys.REGISTRAR: r"registrar: *(.+)"
}

def __init__(self):
Expand Down Expand Up @@ -321,6 +329,8 @@ class RegexKR(TLDParser):
TLDBaseKeys.UPDATED: r"Last Updated Date *: (\d{4}\.\s\d{2}\.\s\d{2}\.)",
TLDBaseKeys.EXPIRES: r"Expiration Date *: (\d{4}\.\s\d{2}\.\s\d{2}\.)",
TLDBaseKeys.REGISTRANT_NAME: r"Registrant *: (.+)",
TLDBaseKeys.ADMIN_EMAIL: r"Administrative Contact(AC) *: *(.+)",
TLDBaseKeys.ADMIN_NAME: r"AC E-Mail *: *(.+)",
TLDBaseKeys.DNSSEC: r"DNSSEC *: ([a-zA-Z]+)",
TLDBaseKeys.REGISTRANT_ZIPCODE: r"Registrant Zip Code: *: (.+)",
TLDBaseKeys.REGISTRANT_ADDRESS: r"Registrant Address *: (.+)",
Expand All @@ -340,6 +350,7 @@ class RegexEU(TLDParser):

_eu_expressions = {
TLDBaseKeys.REGISTRAR: r"Registrar:\n.*Name: (.+)",
TLDBaseKeys.REGISTRAR_URL: r"Registrar:\n.*Name:.+\n.*Website: *(.+)",
}

def __init__(self):
Expand Down Expand Up @@ -382,6 +393,7 @@ class RegexUK(TLDParser):
TLDBaseKeys.UPDATED: r"Last updated:\s*(\d{2}-\w{3}-\d{4})",
TLDBaseKeys.EXPIRES: r"Expiry date:\s*(\d{2}-\w{3}-\d{4})",
TLDBaseKeys.REGISTRAR: r"Registrar:\s*(.+)",
TLDBaseKeys.REGISTRAR_URL: r"(?<=Registrar)[\s\S]*?URL: *(.+)",
TLDBaseKeys.REGISTRANT_NAME: r"Registrant:\n *(.+)",
TLDBaseKeys.STATUS: r"Registration status:\n *(.+)",
}
Expand Down Expand Up @@ -464,13 +476,10 @@ class RegexAT(TLDParser):
_at_expressions = {
TLDBaseKeys.DOMAIN_NAME: r"domain: *(.+)",
TLDBaseKeys.REGISTRAR: r"registrar: *(.+)",
TLDBaseKeys.UPDATED: r"changed on: *(.+)",
TLDBaseKeys.UPDATED: r"changed: *(.+)",
TLDBaseKeys.NAME_SERVERS: r"nserver: *(.+)",
TLDBaseKeys.REGISTRANT_NAME: r"",
TLDBaseKeys.REGISTRANT_ADDRESS: r"",
TLDBaseKeys.REGISTRANT_ZIPCODE: r"",
TLDBaseKeys.REGISTRANT_CITY: r"",
TLDBaseKeys.REGISTRANT_COUNTRY: r"",
TLDBaseKeys.REGISTRANT_NAME: r"registrant: *(.+)",
TLDBaseKeys.TECH_NAME: r"tech-c: *(.+)",
}

_contact_fields = {
Expand Down Expand Up @@ -522,6 +531,7 @@ class RegexBE(TLDParser):
TLDBaseKeys.DOMAIN_NAME: r"Domain: *(.+)",
TLDBaseKeys.CREATED: r"Registered: *(.+)",
TLDBaseKeys.REGISTRAR: r"Registrar:\n.+Name: *(.+)",
TLDBaseKeys.REGISTRAR_URL: r"Registrar:\n.+Name:.+\n.+Website:*(.+)",
TLDBaseKeys.REGISTRANT_NAME: r"Registrant:\n *(.+)",
}

Expand Down Expand Up @@ -599,6 +609,9 @@ class RegexID(TLDParser):
TLDBaseKeys.UPDATED: r"Last Updated On:(.+)",
TLDBaseKeys.DNSSEC: r"DNSSEC:(.+)",
TLDBaseKeys.REGISTRAR: r"Sponsoring Registrar Organization:(.+)",
TLDBaseKeys.REGISTRAR_ABUSE_PHONE: r"Sponsoring Registrar Phone: *(.+)",
TLDBaseKeys.REGISTRAR_ABUSE_EMAIL: r"Sponsoring Registrar Email: *(.+)",
TLDBaseKeys.REGISTRAR_URL: r"Sponsoring Registrar URL: *(.+)",
TLDBaseKeys.STATUS: r"Status:(.+)",
TLDBaseKeys.REGISTRANT_NAME: r"Registrant Name:(.+)",
TLDBaseKeys.REGISTRANT_ADDRESS: r"Registrant Street1:(.+)",
Expand Down Expand Up @@ -635,7 +648,8 @@ class RegexIT(TLDParser):
TLDBaseKeys.STATUS: r"Status: *(.+)",
TLDBaseKeys.REGISTRANT_NAME: r"(?<=Registrant)[\s\S]*?Organization:(.*)",
TLDBaseKeys.REGISTRANT_ADDRESS: r"(?<=Registrant)[\s\S]*?Address:(.*)",
TLDBaseKeys.REGISTRAR: r"(?<=Registrar)[\s\S]*?Name:(.*)",
TLDBaseKeys.REGISTRAR: r"(?<=Registrar)[\s\S]*?Name: *(.*)",
TLDBaseKeys.REGISTRAR_URL: r"(?<=Registrar)[\s\S]*?Web: *(.*)",
}

def __init__(self):
Expand Down Expand Up @@ -664,6 +678,8 @@ class RegexSK(TLDParser):
TLDBaseKeys.REGISTRANT_NAME: r"Name:\s*(.+)",
TLDBaseKeys.REGISTRANT_ADDRESS: r"Street:\s*(.+)",
TLDBaseKeys.REGISTRAR: r"(?<=Registrar)[\s\S]*?Organization:(.*)",
TLDBaseKeys.REGISTRAR_ABUSE_EMAIL: r"(?<=Registrar)[\s\S]*?Email: *(.*)",
TLDBaseKeys.REGISTRAR_ABUSE_PHONE: r"(?<=Registrar)[\s\S]*?Phone: *(.*)",
TLDBaseKeys.REGISTRANT_CITY: r"(?<=^Contact)[\s\S]*?City:(.*)",
TLDBaseKeys.REGISTRANT_ZIPCODE: r"(?<=^Contact)[\s\S]*?Postal Code:(.*)",
TLDBaseKeys.REGISTRANT_COUNTRY: r"(?<=^Contact)[\s\S]*?Country Code:(.*)",
Expand All @@ -680,6 +696,7 @@ class RegexMX(TLDParser):
TLDBaseKeys.UPDATED: r"Last Updated On: *(.+)",
TLDBaseKeys.EXPIRES: r"Expiration Date: *(.+)",
TLDBaseKeys.REGISTRAR: r"Registrar:\s*(.+)",
TLDBaseKeys.REGISTRAR_URL: r"URL: *(.+)",
TLDBaseKeys.REGISTRANT_NAME: r"(?<=Registrant)[\s\S]*?Name:(.*)",
TLDBaseKeys.REGISTRANT_CITY: r"(?<=Registrant)[\s\S]*?City:(.*)",
TLDBaseKeys.REGISTRANT_STATE: r"(?<=Registrant)[\s\S]*?State:(.*)",
Expand All @@ -696,6 +713,7 @@ class RegexTW(TLDParser):
TLDBaseKeys.CREATED: r"Record created on (.+) ",
TLDBaseKeys.EXPIRES: r"Record expires on (.+) ",
TLDBaseKeys.REGISTRAR: r"Registration Service Provider: *(.+)",
TLDBaseKeys.REGISTRAR_URL: r"Registration Service URL: *(.+)",
TLDBaseKeys.REGISTRANT_NAME: r"(?<=Registrant:)\s+(.*)",
TLDBaseKeys.REGISTRANT_CITY: r"(?<=Registrant:)\s*(?:.*\n){5}\s+(.*),",
TLDBaseKeys.REGISTRANT_ADDRESS: r"(?<=Registrant:)\s*(?:.*\n){4}\s+(.*)",
Expand Down Expand Up @@ -889,6 +907,8 @@ class RegexLU(TLDParser):
TLDBaseKeys.NAME_SERVERS: r"nserver: *(.+)",
TLDBaseKeys.STATUS: r"domaintype: *(.+)",
TLDBaseKeys.REGISTRAR: r"registrar-name: *(.+)",
TLDBaseKeys.REGISTRAR_ABUSE_EMAIL: r"registrar-email: *(.+)",
TLDBaseKeys.REGISTRAR_URL: r"registrar-url: *(.+)",
TLDBaseKeys.REGISTRANT_ORGANIZATION: r"org-name: *(.+)",
TLDBaseKeys.REGISTRANT_ADDRESS: r"org-address: *(.+)",
TLDBaseKeys.REGISTRANT_ZIPCODE: r"org-zipcode:*(.+)",
Expand Down Expand Up @@ -962,6 +982,8 @@ class RegexHK(TLDParser):
TLDBaseKeys.STATUS: r"Domain Status: *(.+)",
TLDBaseKeys.DNSSEC: r"DNSSEC: *(.+)",
TLDBaseKeys.REGISTRAR: r"Registrar Name: *(.+)",
TLDBaseKeys.REGISTRAR_ABUSE_EMAIL: r"Registrar Contact Information: *(.+)",
TLDBaseKeys.REGISTRAR_ABUSE_PHONE: r"Registrar Contact Information: *(.+)",
TLDBaseKeys.REGISTRANT_NAME: r"Registrant Contact Information:\s*Company English Name.*:(.+)",
TLDBaseKeys.REGISTRANT_ADDRESS: r"(?<=Registrant Contact Information:)[\s\S]*?Address: (.*)",
TLDBaseKeys.REGISTRANT_COUNTRY: r"[Registrant Contact Information\w\W]+Country: ([\S\ ]+)",
Expand All @@ -982,6 +1004,9 @@ class RegexUA(TLDParser):
TLDBaseKeys.DOMAIN_NAME: r"domain: *(.+)",
TLDBaseKeys.STATUS: r"status: *(.+)",
TLDBaseKeys.REGISTRAR: r"(?:Registrar: |(?<=Registrar:)[\s\W\w]*?organization-loc: )(.*)",
TLDBaseKeys.REGISTRAR_URL: r"(?<=Registrar)[\s\S]*?url: *(.+)",
TLDBaseKeys.REGISTRAR_ABUSE_PHONE: r"(?<=Registrar)[\s\S]*?abuse-phone: *(.+)",
TLDBaseKeys.REGISTRAR_ABUSE_EMAIL: r"(?<=Registrar)[\s\S]*?abuse-email: *(.+)",
TLDBaseKeys.REGISTRANT_NAME: r"(?<=Registrant:)[\s\W\w]*?organization-loc:(.*)",
TLDBaseKeys.REGISTRANT_COUNTRY: r"(?<=Registrant:)[\s\W\w]*?country-loc:(.*)",
TLDBaseKeys.REGISTRANT_CITY: r"(?<=Registrant:)[\s\W\w]*?(?:address\-loc:\s+.*\n){2}address-loc:\s+(.*)\n",
Expand Down Expand Up @@ -1051,6 +1076,7 @@ class RegexCN(TLDParser):
TLDBaseKeys.CREATED: r"Registration Time: *(.+)",
TLDBaseKeys.EXPIRES: r"Expiration Time: *(.+)",
TLDBaseKeys.REGISTRANT_NAME: r"Registrant: *(.+)",
TLDBaseKeys.REGISTRANT_EMAIL: r"Registrant Contact Email: *(.+)",
}

def __init__(self):
Expand Down Expand Up @@ -1079,6 +1105,7 @@ class RegexBY(TLDParser):
TLDBaseKeys.DOMAIN_NAME: r"Domain Name: *(.+)",
TLDBaseKeys.REGISTRAR: r"Registrar: *(.+)",
TLDBaseKeys.REGISTRANT_NAME: r"Person: *(.+)",
TLDBaseKeys.REGISTRANT_EMAIL: r"Email: *(.+)",
TLDBaseKeys.REGISTRANT_ORGANIZATION: r"Org: *(.+)",
TLDBaseKeys.REGISTRANT_COUNTRY: r"Country: *(.+)",
TLDBaseKeys.REGISTRANT_ADDRESS: r"Address: *(.+)",
Expand Down Expand Up @@ -1137,7 +1164,11 @@ class RegexAE(TLDParser):
TLDBaseKeys.STATUS: r"Status: *(.+)",
TLDBaseKeys.REGISTRANT_NAME: r"Registrant Contact Name: *(.+)",
TLDBaseKeys.REGISTRANT_ORGANIZATION: r"Registrant Contact Organisation: *(.+)",
TLDBaseKeys.REGISTRANT_EMAIL: r"Registrant Contact Email: *(.+)",
TLDBaseKeys.REGISTRAR: r"Registrar Name: *(.+)",
TLDBaseKeys.TECH_NAME: r"Tech Contact Name: *(.+)",
TLDBaseKeys.TECH_EMAIL: r"Tech Contact Email: *(.+)",
TLDBaseKeys.TECH_ORGANIZATION: r"Tech Contact Organisation: *(.+)",
}

def __init__(self):
Expand All @@ -1148,6 +1179,7 @@ def __init__(self):
class RegexSI(TLDParser):
_si_expressions = {
TLDBaseKeys.REGISTRAR: r"registrar: *(.+)",
TLDBaseKeys.REGISTRAR_URL: r"registrar-url: *(.+)",
TLDBaseKeys.NAME_SERVERS: r"nameserver: *(.+)",
TLDBaseKeys.REGISTRANT_NAME: r"registrant: *(.+)",
TLDBaseKeys.CREATED: r"created: *(.+)",
Expand Down Expand Up @@ -1386,7 +1418,10 @@ def parse(self, blob: str) -> Dict[str, Any]:


class RegexNL(TLDParser):
_nl_expressions = {TLDBaseKeys.REGISTRAR: r"Registrar:\n(.+)"}
_nl_expressions = {
TLDBaseKeys.REGISTRAR: r"Registrar:\n(.+)",
TLDBaseKeys.REGISTRAR_ABUSE_EMAIL: r"Abuse Contact:\n(.+)"
}

def __init__(self):
super().__init__()
Expand Down Expand Up @@ -1457,6 +1492,7 @@ def parse(self, blob: str) -> Dict[str, Any]:
class RegexAW(TLDParser):
_aw_expressions = {
TLDBaseKeys.REGISTRAR: r"Registrar:\n*(.+)",
TLDBaseKeys.REGISTRAR_ABUSE_EMAIL: r"Abuse Contact:\n*(.+)"
}

def __init__(self):
Expand All @@ -1475,6 +1511,7 @@ class RegexAX(TLDParser):
_ax_expressions = {
TLDBaseKeys.DOMAIN_NAME: r"domain\.+: *(.+)",
TLDBaseKeys.REGISTRAR: r"registrar\.+: *(.+)",
TLDBaseKeys.REGISTRAR_URL: r"www\.+: *(.+)",
TLDBaseKeys.REGISTRANT_NAME: r"name\.+: *(.+)",
TLDBaseKeys.REGISTRANT_COUNTRY: r"country\.+: *(.+)",
TLDBaseKeys.CREATED: r"created\.+: *(.+)",
Expand Down Expand Up @@ -1661,48 +1698,3 @@ def parse(self, blob: str) -> Dict[str, Any]:
output[TLDBaseKeys.EXPIRES] = self._parse_date_mdY(expires)

return output


class RegexCI(TLDParser):

_ci_expressions = {
TLDBaseKeys.REGISTRANT_NAME: r"RegistrantName: *(.+)",
TLDBaseKeys.REGISTRANT_ORGANIZATION: r"RegistrantOrganization: *(.+)",
TLDBaseKeys.REGISTRANT_ADDRESS: r"RegistrantStreet: *(.+)",
TLDBaseKeys.REGISTRANT_CITY: r"RegistrantCity: *(.+)",
TLDBaseKeys.REGISTRANT_ZIPCODE: r"RegistrantPostal Code: *(.+)",
TLDBaseKeys.REGISTRANT_COUNTRY: r"RegistrantCountry: *(.+)",
TLDBaseKeys.REGISTRANT_EMAIL: r"RegistrantEmail: *(.+)",
TLDBaseKeys.STATUS: r"Domain status: *(.+)",
TLDBaseKeys.ADMIN_NAME: r"AdminName: (.+)",
TLDBaseKeys.ADMIN_ORGANIZATION: r"AdminOrganization: (.+)",
TLDBaseKeys.ADMIN_CITY: r"AdminCity: (.*)",
TLDBaseKeys.ADMIN_ADDRESS: r"AdminStreet: (.*)",
TLDBaseKeys.ADMIN_ZIPCODE: r"AdminPostal Code: (.*)",
TLDBaseKeys.ADMIN_COUNTRY: r"AdminCountry: (.+)",
TLDBaseKeys.ADMIN_PHONE: r"AdminPhone: (.+)",
TLDBaseKeys.ADMIN_FAX: r"AdminFax: (.+)",
TLDBaseKeys.ADMIN_EMAIL: r"AdminEmail: (.+)",
TLDBaseKeys.BILLING_NAME: r"BillingName: (.+)",
TLDBaseKeys.BILLING_ORGANIZATION: r"BillingOrganization: (.+)",
TLDBaseKeys.BILLING_CITY: r"BillingCity: (.*)",
TLDBaseKeys.BILLING_ADDRESS: r"BillingStreet: (.*)",
TLDBaseKeys.BILLING_ZIPCODE: r"BillingPostal Code: (.*)",
TLDBaseKeys.BILLING_COUNTRY: r"BillingCountry: (.+)",
TLDBaseKeys.BILLING_PHONE: r"BillingPhone: (.+)",
TLDBaseKeys.BILLING_FAX: r"BillingFax: (.+)",
TLDBaseKeys.BILLING_EMAIL: r"BillingEmail: (.+)",
TLDBaseKeys.TECH_NAME: r"TechName: (.+)",
TLDBaseKeys.TECH_ORGANIZATION: r"TechOrganization: (.+)",
TLDBaseKeys.TECH_CITY: r"TechCity: (.*)",
TLDBaseKeys.TECH_ADDRESS: r"TechStreet: (.*)",
TLDBaseKeys.TECH_ZIPCODE: r"TechPostal Code: (.*)",
TLDBaseKeys.TECH_COUNTRY: r"TechCountry: (.+)",
TLDBaseKeys.TECH_PHONE: r"TechPhone: (.+)",
TLDBaseKeys.TECH_FAX: r"TechFax: (.+)",
TLDBaseKeys.TECH_EMAIL: r"TechEmail: (.+)",
}

def __init__(self):
super().__init__()
self.update_reg_expressions(self._ci_expressions)
10 changes: 9 additions & 1 deletion asyncwhois/pywhois.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,9 +128,13 @@ def rdap_domain(cls, domain: str, httpx_client: Any = None):
for a_key, b_key in [
(TLDBaseKeys.EXPIRES, "expires_date"),
(TLDBaseKeys.UPDATED, "updated_date"),
(TLDBaseKeys.CREATED, "created_date"),
(TLDBaseKeys.CREATED, "created_date")
]:
whois_dict[a_key] = whois_dict.pop(b_key)
# reconcile abuse keys, but don't remove existing key as to not cause issues
# with apps currently depending on them. todo: re-standardize keys in next major release
whois_dict[TLDBaseKeys.REGISTRAR_ABUSE_EMAIL] = whois_dict["abuse_email"]
whois_dict[TLDBaseKeys.REGISTRAR_ABUSE_PHONE] = whois_dict["abuse_phone"]
_self._parser = whois_dict
return _self

Expand Down Expand Up @@ -161,6 +165,10 @@ async def aio_rdap_domain(cls, domain: str, httpx_client: Any = None):
(TLDBaseKeys.CREATED, "created_date"),
]:
whois_dict[a_key] = whois_dict.pop(b_key)
# reconcile abuse keys, but don't remove existing key as to not cause issues
# with apps currently depending on them. todo: re-standardize keys in next major release
whois_dict[TLDBaseKeys.REGISTRAR_ABUSE_EMAIL] = whois_dict["abuse_email"]
whois_dict[TLDBaseKeys.REGISTRAR_ABUSE_PHONE] = whois_dict["abuse_phone"]
_self._parser = whois_dict
return _self

Expand Down
5 changes: 5 additions & 0 deletions tests/test_parser_output.py
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,8 @@ def test_parse_ua(self):
self.assertEqual(parser.parser_output.get("registrant_address"), "1600 Amphitheatre Parkway")
# registrar
self.assertEqual(parser.parser_output.get("registrar"), "MarkMonitor Inc.")
self.assertEqual(parser.parser_output.get("registrar_url"), "http://markmonitor.com")
self.assertEqual(parser.parser_output.get("registrar_abuse_email"), "abusecomplaints@markmonitor.com")
# registrant
self.assertEqual(parser.parser_output.get("registrant_organization"), None)
self.assertEqual(parser.parser_output.get("registrant_name"), "Google LLC")
Expand Down Expand Up @@ -522,6 +524,7 @@ def test_parser_ru(self):
self.assertEqual(expires_date.day, 4)
# registrant
self.assertEqual(parser.parser_output.get("registrant_organization"), "Google LLC")
self.assertEqual(parser.parser_output.get("admin_email"), "https://www.nic.ru/whois")

def test_parser_edu(self):
query_output = self.get_txt('edu')
Expand Down Expand Up @@ -991,6 +994,7 @@ def test_parser_nl(self):
self.assertEqual(updated_date.day, 30)
# registrar
self.assertEqual(parser.parser_output.get("registrar"), "MarkMonitor Inc.")
self.assertEqual(parser.parser_output.get("registrar"), "MarkMonitor Inc.")
self.assertEqual(len(parser.parser_output.get("name_servers")), 4)
self.assertEqual(len(parser.parser_output.get("status")), 1)

Expand Down Expand Up @@ -1188,6 +1192,7 @@ def test_tld_ax(self):
self.assertEqual(parser.parser_output.get("registrant_address"), "Kreuzstr.60, 40210, Duesseldorf")
# registrar
self.assertEqual(parser.parser_output.get("registrar"), "xTom")
self.assertEqual(parser.parser_output.get("registrar_url"), "https://xtom.com/")
# misc
self.assertEqual(len(parser.parser_output.get("name_servers")), 2)
self.assertEqual(len(parser.parser_output.get("status")), 1)
Expand Down

0 comments on commit 4c91f14

Please sign in to comment.