diff --git a/pythonwhois/parse.py b/pythonwhois/parse.py index 5f77991..8a894a5 100644 --- a/pythonwhois/parse.py +++ b/pythonwhois/parse.py @@ -98,7 +98,7 @@ grammar = { 'nserver:\s*(?P[^[\s]+)', 'Name Server[.]+ (?P[^[\s]+)', 'Hostname:\s*(?P[^\s]+)', - 'DNS[0-9]+:\s*(?P.+)', + 'DNS[0-9]*:\s*(?P.+)', 'ns[0-9]+:\s*(?P.+)', 'NS [0-9]+\s*:\s*(?P.+)', '\[Name Server\]\s*(?P.+)', @@ -544,6 +544,7 @@ def parse_registrants(data, never_query_handles=True, handle_server=""): "registrant-name:\s*(?P.+)\nregistrant-type:\s*(?P.+)\nregistrant-address:\s*(?P.+)\nregistrant-postcode:\s*(?P.+)\nregistrant-city:\s*(?P.+)\nregistrant-country:\s*(?P.+)\n(?:registrant-phone:\s*(?P.+)\n)?(?:registrant-email:\s*(?P.+)\n)?", # Hetzner "Registrant Contact Information :[ ]*\n[ ]+(?P.*)\n[ ]+(?P.*)\n[ ]+(?P.*)\n[ ]+(?P.*)\n[ ]+(?P.*)\n[ ]+(?P.*)\n[ ]+(?P.*)\n[ ]+(?P.*)\n[ ]+(?P.*)\n\n", # GAL Communication "Contact Information : For Customer # [0-9]+[ ]*\n[ ]+(?P.*)\n[ ]+(?P.*)\n[ ]+(?P.*)\n[ ]+(?P.*)\n[ ]+(?P.*)\n[ ]+(?P.*)\n[ ]+(?P.*)\n[ ]+(?P.*)\n[ ]+(?P.*)\n\n", # GAL Communication alternative (private WHOIS) format? + "Registrant:\n Name: (?P.+)\n City: (?P.+)\n State: (?P.+)\n Country: (?P.+)\n", # Akky (.com.mx) " Registrant:\n (?P.+)\n (?P.+)\n (?P.+) (?P\S+),[ ]+(?P.+)\n (?P.+)", # .am "Domain Holder: (?P.+)\n(?P.+?)(?:,+ (?P.+?)(?:,+ (?P.+?)(?:,+ (?P.+?)(?:,+ (?P.+?)(?:,+ (?P.+?)(?:,+ (?P.+?))?)?)?)?)?)?, (?P[^.,]+), (?P.+), (?P.+)\n(?P.+)\n(?P[A-Z]+)\n", # .co.th, format 1 "Domain Holder: (?P.+)\n(?P.+?)(?:,+ (?P.+?)(?:,+ (?P.+?)(?:,+ (?P.+?)(?:,+ (?P.+?)(?:,+ (?P.+?)(?:,+ (?P.+?))?)?)?)?)?)?, (?P.+)\n(?P.+)\n(?P[A-Z]+)\n", # .co.th, format 2 @@ -577,6 +578,7 @@ def parse_registrants(data, never_query_handles=True, handle_server=""): " Technical contact:\n (?P.+)\n (?P.*)\n (?P.+)\n (?P.+) (?P\S+),[ ]+(?P.+)\n (?P.+)\n (?P.+)\n (?P.*)\n (?P.*)", # .am "Technical:\n\s*Name:\s*(?P.*)\n\s*Organisation:\s*(?P.*)\n\s*Language:.*\n\s*Phone:\s*(?P.*)\n\s*Fax:\s*(?P.*)\n\s*Email:\s*(?P.*)\n", # EURid "\[Zone-C\]\nType: (?P.+)\nName: (?P.+)\n(Organisation: (?P.+)\n){0,1}(Address: (?P.+)\n){1}(Address: (?P.+)\n){0,1}(Address: (?P.+)\n){0,1}(Address: (?P.+)\n){0,1}PostalCode: (?P.+)\nCity: (?P.+)\nCountryCode: (?P[A-Za-z]{2})\nPhone: (?P.+)\nFax: (?P.+)\nEmail: (?P.+)\n(Remarks: (?P.+)\n){0,1}Changed: (?P.+)", # DeNIC + "Technical Contact:\n Name: (?P.+)\n City: (?P.+)\n State: (?P.+)\n Country: (?P.+)\n", # Akky (.com.mx) "Tech Contact: (?P.+)\n(?P.+)\n(?P.+?)(?:,+ (?P.+?)(?:,+ (?P.+?)(?:,+ (?P.+?)(?:,+ (?P.+?)(?:,+ (?P.+?)(?:,+ (?P.+?))?)?)?)?)?)?\n(?P.+),? (?P[A-Z]{2,3})(?: [A-Z0-9]+)?\n(?P.+)\n(?P[A-Z]+)\n", # .co.th, format 1 "Tech Contact: (?P.+)\n(?P.+)\n(?P.+?)(?:,+ (?P.+?)(?:,+ (?P.+?)(?:,+ (?P.+?)(?:,+ (?P.+?)(?:,+ (?P.+?)(?:,+ (?P.+?))?)?)?)?)?)?\n(?P.+), (?P.+)\n(?P.+)\n(?P[A-Z]+)\n", # .co.th, format 2 "Tech Contact: (?P.+)\n(?P.+)\n(?P.+?)(?:,+ (?P.+?)(?:,+ (?P.+?)(?:,+ (?P.+?)(?:,+ (?P.+?)(?:,+ (?P.+?)(?:,+ (?P.+?))?)?)?)?)?)?, (?P.+)\n(?P.+)\n(?P[A-Z]+)\n", # .co.th, format 3 @@ -604,6 +606,7 @@ def parse_registrants(data, never_query_handles=True, handle_server=""): "admin-c-name:\s*(?P.+)\nadmin-c-type:\s*(?P.+)\nadmin-c-address:\s*(?P.+)\nadmin-c-postcode:\s*(?P.+)\nadmin-c-city:\s*(?P.+)\nadmin-c-country:\s*(?P.+)\n(?:admin-c-phone:\s*(?P.+)\n)?(?:admin-c-email:\s*(?P.+)\n)?", # Hetzner "Tech Contact Information :[ ]*\n[ ]+(?P.*)\n[ ]+(?P.*)\n[ ]+(?P.*)\n[ ]+(?P.*)\n[ ]+(?P.*)\n[ ]+(?P.*)\n[ ]+(?P.*)\n[ ]+(?P.*)\n[ ]+(?P.*)\n\n", # GAL Communication " Administrative contact:\n (?P.+)\n (?P.*)\n (?P.+)\n (?P.+) (?P\S+),[ ]+(?P.+)\n (?P.+)\n (?P.+)\n (?P.*)\n (?P.*)", # .am + "Administrative Contact:\n Name: (?P.+)\n City: (?P.+)\n State: (?P.+)\n Country: (?P.+)\n", # Akky (.com.mx) "\[Tech-C\]\nType: (?P.+)\nName: (?P.+)\n(Organisation: (?P.+)\n){0,1}(Address: (?P.+)\n){1}(Address: (?P.+)\n){0,1}(Address: (?P.+)\n){0,1}(Address: (?P.+)\n){0,1}PostalCode: (?P.+)\nCity: (?P.+)\nCountryCode: (?P[A-Za-z]{2})\nPhone: (?P.+)\nFax: (?P.+)\nEmail: (?P.+)\n(Remarks: (?P.+)\n){0,1}Changed: (?P.+)", # DeNIC ] @@ -620,6 +623,7 @@ def parse_registrants(data, never_query_handles=True, handle_server=""): "Billing Contact ID:(?P.*)\nBilling Contact Name:(?P.*)\n(?:Billing Contact Organization:(?P.*)\n)?Billing Contact Address1:(?P.*)\n(?:Billing Contact Address2:(?P.*)\n)?(?:Billing Contact Address3:(?P.*)\n)?Billing Contact City:(?P.*)\n(?:Billing Contact State/Province:(?P.*)\n)?Billing Contact Postal Code:(?P.*)\nBilling Contact Country:(?P.*)\nBilling Contact Country Code:.*\nBilling Contact Phone Number:(?P.*)\n(?:Billing Contact Facsimile Number:(?P.*)\n)?Billing Contact Email:(?P.*)", # .US, .biz (NeuStar) "Billing contact:\n(?: (?P.+)\n)? (?P.+)\n (?P.+)\n (?P.+)\n (?P.+), (?P.+) (?P.+) (?P.+)\n Phone: (?P.*)\n Fax: (?P.*)\n", # Fabulous.com "Billing Contact Information :[ ]*\n[ ]+(?P.*)\n[ ]+(?P.*)\n[ ]+(?P.*)\n[ ]+(?P.*)\n[ ]+(?P.*)\n[ ]+(?P.*)\n[ ]+(?P.*)\n[ ]+(?P.*)\n[ ]+(?P.*)\n\n", # GAL Communication + "Billing Contact:\n Name: (?P.+)\n City: (?P.+)\n State: (?P.+)\n Country: (?P.+)\n", # Akky (.com.mx) ] # Some registries use NIC handle references instead of directly listing contacts... diff --git a/test/data/expopack.com.mx b/test/data/expopack.com.mx new file mode 100644 index 0000000..468c263 --- /dev/null +++ b/test/data/expopack.com.mx @@ -0,0 +1,91 @@ + +Domain Name: expopack.com.mx + +Created On: 1999-10-07 +Expiration Date: 2015-10-06 +Last Updated On: 2011-04-09 +Registrar: Akky (Una division de NIC Mexico) +URL: http://www.akky.mx +Whois TCP URI: whois.akky.mx +Whois Web URL: http://www.akky.mx/jsf/whois/whois.jsf + +Registrant: + Name: EXPO PAK S.A. DE C.V. + City: Mexico + State: Distrito Federal + Country: Mexico + +Administrative Contact: + Name: Alejandra Aguirre + City: Ciudad de Mexico + State: Distrito Federal + Country: Mexico + +Technical Contact: + Name: Alejandra Aguirre + City: Ciudad de Mexico + State: Distrito Federal + Country: Mexico + +Billing Contact: + Name: Alejandra Aguirre + City: Ciudad de Mexico + State: Distrito Federal + Country: Mexico + +Name Servers: + DNS: ns1.nuestrosite.com + DNS: ns2.nuestrosite.com + + +% NOTICE: The expiration date displayed in this record is the date the +% registrar's sponsorship of the domain name registration in the registry is +% currently set to expire. This date does not necessarily reflect the +% expiration date of the domain name registrant's agreement with the sponsoring +% registrar. Users may consult the sponsoring registrar's Whois database to +% view the registrar's reported date of expiration for this registration. + +% The requested information ("Information") is provided only for the delegation +% of domain names and the operation of the DNS administered by NIC Mexico. + +% It is absolutely prohibited to use the Information for other purposes, +% including sending not requested emails for advertising or promoting products +% and services purposes (SPAM) without the authorization of the owners of the +% Information and NIC Mexico. + +% The database generated from the delegation system is protected by the +% intellectual property laws and all international treaties on the matter. + +% If you need more information on the records displayed here, please contact us +% by email at ayuda@nic.mx . + +% If you want notify the receipt of SPAM or unauthorized access, please send a +% email to abuse@nic.mx . + +% NOTA: La fecha de expiracion mostrada en esta consulta es la fecha que el +% registrar tiene contratada para el nombre de dominio en el registry. Esta +% fecha no necesariamente refleja la fecha de expiracion del nombre de dominio +% que el registrante tiene contratada con el registrar. Puede consultar la base +% de datos de Whois del registrar para ver la fecha de expiracion reportada por +% el registrar para este nombre de dominio. + +% La informacion que ha solicitado se provee exclusivamente para fines +% relacionados con la delegacion de nombres de dominio y la operacion del DNS +% administrado por NIC Mexico. + +% Queda absolutamente prohibido su uso para otros propositos, incluyendo el +% envio de Correos Electronicos no solicitados con fines publicitarios o de +% promocion de productos y servicios (SPAM) sin mediar la autorizacion de los +% afectados y de NIC Mexico. + +% La base de datos generada a partir del sistema de delegacion, esta protegida +% por las leyes de Propiedad Intelectual y todos los tratados internacionales +% sobre la materia. + +% Si necesita mayor informacion sobre los registros aqui mostrados, favor de +% comunicarse a ayuda@nic.mx. + +% Si desea notificar sobre correo no solicitado o accesos no autorizados, favor +% de enviar su mensaje a abuse@nic.mx. + + diff --git a/test/target_default/expopack.com.mx b/test/target_default/expopack.com.mx new file mode 100644 index 0000000..103e556 --- /dev/null +++ b/test/target_default/expopack.com.mx @@ -0,0 +1 @@ +{"updated_date": ["2011-04-09T00:00:00"], "contacts": {"admin": {"city": "Ciudad de Mexico", "state": "Distrito Federal", "name": "Alejandra Aguirre", "country": "Mexico"}, "tech": {"city": "Ciudad de Mexico", "state": "Distrito Federal", "name": "Alejandra Aguirre", "country": "Mexico"}, "registrant": {"city": "Mexico", "state": "Distrito Federal", "name": "EXPO PAK S.A. DE C.V.", "country": "Mexico"}, "billing": {"city": "Ciudad de Mexico", "state": "Distrito Federal", "name": "Alejandra Aguirre", "country": "Mexico"}}, "nameservers": ["ns1.nuestrosite.com", "ns2.nuestrosite.com"], "expiration_date": ["2015-10-06T00:00:00"], "creation_date": ["1999-10-07T00:00:00", "1999-10-07T00:00:00"], "raw": ["\nDomain Name: expopack.com.mx\n\nCreated On: 1999-10-07\nExpiration Date: 2015-10-06\nLast Updated On: 2011-04-09\nRegistrar: Akky (Una division de NIC Mexico)\nURL: http://www.akky.mx\nWhois TCP URI: whois.akky.mx\nWhois Web URL: http://www.akky.mx/jsf/whois/whois.jsf\n\nRegistrant:\n Name: EXPO PAK S.A. DE C.V.\n City: Mexico\n State: Distrito Federal\n Country: Mexico\n\nAdministrative Contact:\n Name: Alejandra Aguirre\n City: Ciudad de Mexico\n State: Distrito Federal\n Country: Mexico\n\nTechnical Contact:\n Name: Alejandra Aguirre\n City: Ciudad de Mexico\n State: Distrito Federal\n Country: Mexico\n\nBilling Contact:\n Name: Alejandra Aguirre\n City: Ciudad de Mexico\n State: Distrito Federal\n Country: Mexico\n\nName Servers:\n DNS: ns1.nuestrosite.com \n DNS: ns2.nuestrosite.com \n\n\n% NOTICE: The expiration date displayed in this record is the date the\n% registrar's sponsorship of the domain name registration in the registry is\n% currently set to expire. This date does not necessarily reflect the\n% expiration date of the domain name registrant's agreement with the sponsoring\n% registrar. Users may consult the sponsoring registrar's Whois database to\n% view the registrar's reported date of expiration for this registration.\n\n% The requested information (\"Information\") is provided only for the delegation\n% of domain names and the operation of the DNS administered by NIC Mexico.\n\n% It is absolutely prohibited to use the Information for other purposes, \n% including sending not requested emails for advertising or promoting products\n% and services purposes (SPAM) without the authorization of the owners of the\n% Information and NIC Mexico.\n\n% The database generated from the delegation system is protected by the\n% intellectual property laws and all international treaties on the matter.\n\n% If you need more information on the records displayed here, please contact us\n% by email at ayuda@nic.mx .\n\n% If you want notify the receipt of SPAM or unauthorized access, please send a\n% email to abuse@nic.mx .\n\n% NOTA: La fecha de expiracion mostrada en esta consulta es la fecha que el\n% registrar tiene contratada para el nombre de dominio en el registry. Esta\n% fecha no necesariamente refleja la fecha de expiracion del nombre de dominio\n% que el registrante tiene contratada con el registrar. Puede consultar la base\n% de datos de Whois del registrar para ver la fecha de expiracion reportada por\n% el registrar para este nombre de dominio.\n\n% La informacion que ha solicitado se provee exclusivamente para fines\n% relacionados con la delegacion de nombres de dominio y la operacion del DNS\n% administrado por NIC Mexico.\n\n% Queda absolutamente prohibido su uso para otros propositos, incluyendo el\n% envio de Correos Electronicos no solicitados con fines publicitarios o de\n% promocion de productos y servicios (SPAM) sin mediar la autorizacion de los\n% afectados y de NIC Mexico.\n\n% La base de datos generada a partir del sistema de delegacion, esta protegida\n% por las leyes de Propiedad Intelectual y todos los tratados internacionales\n% sobre la materia.\n\n% Si necesita mayor informacion sobre los registros aqui mostrados, favor de\n% comunicarse a ayuda@nic.mx.\n\n% Si desea notificar sobre correo no solicitado o accesos no autorizados, favor\n% de enviar su mensaje a abuse@nic.mx.\n\n\n"], "registrar": ["Akky (Una division de NIC Mexico)"], "emails": ["ayuda@nic.mx", "abuse@nic.mx"]} \ No newline at end of file diff --git a/test/target_normalized/expopack.com.mx b/test/target_normalized/expopack.com.mx new file mode 100644 index 0000000..8395ae5 --- /dev/null +++ b/test/target_normalized/expopack.com.mx @@ -0,0 +1 @@ +{"updated_date": ["2011-04-09T00:00:00"], "contacts": {"admin": {"city": "Ciudad de Mexico", "state": "Distrito Federal", "name": "Alejandra Aguirre", "country": "Mexico"}, "tech": {"city": "Ciudad de Mexico", "state": "Distrito Federal", "name": "Alejandra Aguirre", "country": "Mexico"}, "registrant": {"city": "Mexico", "state": "Distrito Federal", "name": "Expo Pak S.A. DE C.V.", "country": "Mexico"}, "billing": {"city": "Ciudad de Mexico", "state": "Distrito Federal", "name": "Alejandra Aguirre", "country": "Mexico"}}, "nameservers": ["ns1.nuestrosite.com", "ns2.nuestrosite.com"], "expiration_date": ["2015-10-06T00:00:00"], "creation_date": ["1999-10-07T00:00:00", "1999-10-07T00:00:00"], "raw": ["\nDomain Name: expopack.com.mx\n\nCreated On: 1999-10-07\nExpiration Date: 2015-10-06\nLast Updated On: 2011-04-09\nRegistrar: Akky (Una division de NIC Mexico)\nURL: http://www.akky.mx\nWhois TCP URI: whois.akky.mx\nWhois Web URL: http://www.akky.mx/jsf/whois/whois.jsf\n\nRegistrant:\n Name: EXPO PAK S.A. DE C.V.\n City: Mexico\n State: Distrito Federal\n Country: Mexico\n\nAdministrative Contact:\n Name: Alejandra Aguirre\n City: Ciudad de Mexico\n State: Distrito Federal\n Country: Mexico\n\nTechnical Contact:\n Name: Alejandra Aguirre\n City: Ciudad de Mexico\n State: Distrito Federal\n Country: Mexico\n\nBilling Contact:\n Name: Alejandra Aguirre\n City: Ciudad de Mexico\n State: Distrito Federal\n Country: Mexico\n\nName Servers:\n DNS: ns1.nuestrosite.com \n DNS: ns2.nuestrosite.com \n\n\n% NOTICE: The expiration date displayed in this record is the date the\n% registrar's sponsorship of the domain name registration in the registry is\n% currently set to expire. This date does not necessarily reflect the\n% expiration date of the domain name registrant's agreement with the sponsoring\n% registrar. Users may consult the sponsoring registrar's Whois database to\n% view the registrar's reported date of expiration for this registration.\n\n% The requested information (\"Information\") is provided only for the delegation\n% of domain names and the operation of the DNS administered by NIC Mexico.\n\n% It is absolutely prohibited to use the Information for other purposes, \n% including sending not requested emails for advertising or promoting products\n% and services purposes (SPAM) without the authorization of the owners of the\n% Information and NIC Mexico.\n\n% The database generated from the delegation system is protected by the\n% intellectual property laws and all international treaties on the matter.\n\n% If you need more information on the records displayed here, please contact us\n% by email at ayuda@nic.mx .\n\n% If you want notify the receipt of SPAM or unauthorized access, please send a\n% email to abuse@nic.mx .\n\n% NOTA: La fecha de expiracion mostrada en esta consulta es la fecha que el\n% registrar tiene contratada para el nombre de dominio en el registry. Esta\n% fecha no necesariamente refleja la fecha de expiracion del nombre de dominio\n% que el registrante tiene contratada con el registrar. Puede consultar la base\n% de datos de Whois del registrar para ver la fecha de expiracion reportada por\n% el registrar para este nombre de dominio.\n\n% La informacion que ha solicitado se provee exclusivamente para fines\n% relacionados con la delegacion de nombres de dominio y la operacion del DNS\n% administrado por NIC Mexico.\n\n% Queda absolutamente prohibido su uso para otros propositos, incluyendo el\n% envio de Correos Electronicos no solicitados con fines publicitarios o de\n% promocion de productos y servicios (SPAM) sin mediar la autorizacion de los\n% afectados y de NIC Mexico.\n\n% La base de datos generada a partir del sistema de delegacion, esta protegida\n% por las leyes de Propiedad Intelectual y todos los tratados internacionales\n% sobre la materia.\n\n% Si necesita mayor informacion sobre los registros aqui mostrados, favor de\n% comunicarse a ayuda@nic.mx.\n\n% Si desea notificar sobre correo no solicitado o accesos no autorizados, favor\n% de enviar su mensaje a abuse@nic.mx.\n\n\n"], "registrar": ["Akky (Una division de NIC Mexico)"], "emails": ["ayuda@nic.mx", "abuse@nic.mx"]} \ No newline at end of file