From f063fe25291beb605d751e4d750a1687c2e9fe19 Mon Sep 17 00:00:00 2001 From: Sven Slootweg Date: Thu, 21 Nov 2013 09:19:03 +0100 Subject: [PATCH] Support for .pw domains --- pwhois | 1 + pythonwhois/parse.py | 8 +++-- test/data/nic.pw | 75 ++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 81 insertions(+), 3 deletions(-) create mode 100644 test/data/nic.pw diff --git a/pwhois b/pwhois index 768300d..282ffe6 100755 --- a/pwhois +++ b/pwhois @@ -22,6 +22,7 @@ else: data_map = OrderedDict({}) # This defines the fields shown in the output + data_map["id"] = ("Domain ID", 1) data_map["status"] = ("Status", 1) data_map["registrar"] = ("Registrar", 1) data_map["creation_date"] = ("Registration date", 1) diff --git a/pythonwhois/parse.py b/pythonwhois/parse.py index 41d70a3..f3832f8 100644 --- a/pythonwhois/parse.py +++ b/pythonwhois/parse.py @@ -2,6 +2,7 @@ import re, datetime grammar = { "_data": { + 'id': ['Domain ID:[ ]*(?P.+)'], 'status': ['\[Status\]\s*(?P.+)', 'Status\s*:\s?(?P.+)', 'state:\s*(?P.+)'], @@ -309,7 +310,7 @@ def parse_registrants(data): registrant_regexes = [ "Registrant:\n (?P.+)\n (?P.+)\n(?: (?P.*)\n)?(?: (?P.*)\n)? (?P.+), (?P.+)\n (?P.+)\n (?P.+)\n (?P.+)\n\n", # OVH - "Registrant ID:(?P.+)\nRegistrant Name:(?P.*)\nRegistrant Organization:(?P.*)\nRegistrant Street1:(?P.*)\nRegistrant Street2:(?P.*)\nRegistrant Street3:(?P.*)\nRegistrant City:(?P.*)\nRegistrant State/Province:(?P.*)\nRegistrant Postal Code:(?P.*)\nRegistrant Country:(?P.*)\nRegistrant Phone:(?P.*)\nRegistrant Phone Ext.:(?P.*)\nRegistrant FAX:(?P.*)\nRegistrant FAX Ext.:(?P.*)\nRegistrant Email:(?P.*)", # Public Interest Registry (.org) + "Registrant ID:(?P.+)\nRegistrant Name:(?P.*)\nRegistrant Organization:(?P.*)\nRegistrant Street1:(?P.*)\n(?:Registrant Street2:(?P.*)\n)?(?:Registrant Street3:(?P.*)\n)?Registrant City:(?P.*)\nRegistrant State/Province:(?P.*)\nRegistrant Postal Code:(?P.*)\nRegistrant Country:(?P.*)\nRegistrant Phone:(?P.*)\n(?:Registrant Phone Ext.:(?P.*)\n)?(?:Registrant FAX:(?P.*)\n)?(?:Registrant FAX Ext.:(?P.*)\n)?Registrant Email:(?P.*)", # Public Interest Registry (.org), nic.pw "Registrant ID:\s*(?P.+)\nRegistrant Name:\s*(?P.+)\nRegistrant Organization:\s*(?P.*)\nRegistrant Address1:\s*(?P.+)\nRegistrant Address2:\s*(?P.*)\nRegistrant City:\s*(?P.+)\nRegistrant State/Province:\s*(?P.+)\nRegistrant Postal Code:\s*(?P.+)\nRegistrant Country:\s*(?P.+)\nRegistrant Country Code:\s*(?P.+)\nRegistrant Phone Number:\s*(?P.+)\nRegistrant Email:\s*(?P.+)\n", # .CO Internet "Registrant Contact: (?P.+)\nRegistrant Organization: (?P.+)\nRegistrant Name: (?P.+)\nRegistrant Street: (?P.+)\nRegistrant City: (?P.+)\nRegistrant Postal Code: (?P.+)\nRegistrant State: (?P.+)\nRegistrant Country: (?P.+)\nRegistrant Phone: (?P.*)\nRegistrant Phone Ext: (?P.*)\nRegistrant Fax: (?P.*)\nRegistrant Fax Ext: (?P.*)\nRegistrant Email: (?P.*)\n", # Key-Systems GmbH "(?:Registrant ID:[ ]*(?P.*)\n)?Registrant Name:[ ]*(?P.*)\nRegistrant Organization:[ ]*(?P.*)\nRegistrant Street:[ ]*(?P.+)\n(?:Registrant Street:[ ]*(?P.+)\n)?Registrant City:[ ]*(?P.+)\nRegistrant State\/Province:[ ]*(?P.+)\nRegistrant Postal Code:[ ]*(?P.+)\nRegistrant Country:[ ]*(?P.+)\n(?:Registrant Phone:[ ]*(?P.*)\n)?(?:Registrant Phone Ext:[ ]*(?P.*)\n)?(?:Registrant Fax:[ ]*(?P.*)\n)?(?:Registrant Fax Ext:[ ]*(?P.*)\n)?(?:Registrant Email:[ ]*(?P.+)\n)?", # WildWestDomains, GoDaddy, Namecheap/eNom, Ascio, Musedoma (.museum) @@ -326,7 +327,7 @@ def parse_registrants(data): tech_contact_regexes = [ "Technical Contact:\n (?P.+)\n (?P.+)\n(?: (?P.*)\n)?(?: (?P.*)\n)? (?P.+), (?P.+)\n (?P.+)\n (?P.+)\n (?P.+)\n\n", # OVH - "Tech ID:(?P.+)\nTech Name:(?P.*)\nTech Organization:(?P.*)\nTech Street1:(?P.*)\nTech Street2:(?P.*)\nTech Street3:(?P.*)\nTech City:(?P.*)\nTech State/Province:(?P.*)\nTech Postal Code:(?P.*)\nTech Country:(?P.*)\nTech Phone:(?P.*)\nTech Phone Ext.:(?P.*)\nTech FAX:(?P.*)\nTech FAX Ext.:(?P.*)\nTech Email:(?P.*)", # Public Interest Registry (.org) + "Tech ID:(?P.+)\nTech Name:(?P.*)\nTech Organization:(?P.*)\nTech Street1:(?P.*)\n(?:Tech Street2:(?P.*)\n)?(?:Tech Street3:(?P.*)\n)?Tech City:(?P.*)\nTech State/Province:(?P.*)\nTech Postal Code:(?P.*)\nTech Country:(?P.*)\nTech Phone:(?P.*)\n(?:Tech Phone Ext.:(?P.*)\n)?(?:Tech FAX:(?P.*)\n)?(?:Tech FAX Ext.:(?P.*)\n)?Tech Email:(?P.*)", # Public Interest Registry (.org), nic.pw "Technical Contact ID:\s*(?P.+)\nTechnical Contact Name:\s*(?P.+)\nTechnical Contact Organization:\s*(?P.*)\nTechnical Contact Address1:\s*(?P.+)\nTechnical Contact Address2:\s*(?P.*)\nTechnical Contact City:\s*(?P.+)\nTechnical Contact State/Province:\s*(?P.+)\nTechnical Contact Postal Code:\s*(?P.+)\nTechnical Contact Country:\s*(?P.+)\nTechnical Contact Country Code:\s*(?P.+)\nTechnical Contact Phone Number:\s*(?P.+)\nTechnical Contact Email:\s*(?P.+)\n", # .CO Internet "Tech Contact: (?P.+)\nTech Organization: (?P.+)\nTech Name: (?P.+)\nTech Street: (?P.+)\nTech City: (?P.+)\nTech Postal Code: (?P.+)\nTech State: (?P.+)\nTech Country: (?P.+)\nTech Phone: (?P.*)\nTech Phone Ext: (?P.*)\nTech Fax: (?P.*)\nTech Fax Ext: (?P.*)\nTech Email: (?P.*)\n", # Key-Systems GmbH "(?:Tech ID:[ ]*(?P.*)\n)?Tech[ ]*Name:[ ]*(?P.*)\nTech[ ]*Organization:[ ]*(?P.*)\nTech[ ]*Street:[ ]*(?P.+)\n(?:Tech[ ]*Street:[ ]*(?P.+)\n)?Tech[ ]*City:[ ]*(?P.+)\nTech[ ]*State\/Province:[ ]*(?P.+)\nTech[ ]*Postal[ ]*Code:[ ]*(?P.+)\nTech[ ]*Country:[ ]*(?P.+)\n(?:Tech[ ]*Phone:[ ]*(?P.*)\n)?(?:Tech[ ]*Phone[ ]*Ext:[ ]*(?P.*)\n)?(?:Tech[ ]*Fax:[ ]*(?P.*)\n)?(?:Tech[ ]*Fax[ ]*Ext:\s*?(?P.*)\n)?(?:Tech[ ]*Email:[ ]*(?P.+)\n)?", # WildWestDomains, GoDaddy, Namecheap/eNom, Ascio, Musedoma (.museum) @@ -337,7 +338,7 @@ def parse_registrants(data): admin_contact_regexes = [ "Administrative Contact:\n (?P.+)\n (?P.+)\n(?: (?P.*)\n)?(?: (?P.*)\n)? (?P.+), (?P.+)\n (?P.+)\n (?P.+)\n (?P.+)\n\n", # OVH - "Admin ID:(?P.+)\nAdmin Name:(?P.*)\nAdmin Organization:(?P.*)\nAdmin Street1:(?P.*)\nAdmin Street2:(?P.*)\nAdmin Street3:(?P.*)\nAdmin City:(?P.*)\nAdmin State/Province:(?P.*)\nAdmin Postal Code:(?P.*)\nAdmin Country:(?P.*)\nAdmin Phone:(?P.*)\nAdmin Phone Ext.:(?P.*)\nAdmin FAX:(?P.*)\nAdmin FAX Ext.:(?P.*)\nAdmin Email:(?P.*)", # Public Interest Registry (.org) + "Admin ID:(?P.+)\nAdmin Name:(?P.*)\nAdmin Organization:(?P.*)\nAdmin Street1:(?P.*)\n(?:Admin Street2:(?P.*)\n)?(?:Admin Street3:(?P.*)\n)?Admin City:(?P.*)\nAdmin State/Province:(?P.*)\nAdmin Postal Code:(?P.*)\nAdmin Country:(?P.*)\nAdmin Phone:(?P.*)\n(?:Admin Phone Ext.:(?P.*)\n)?(?:Admin FAX:(?P.*)\n)?(?:Admin FAX Ext.:(?P.*)\n)?Admin Email:(?P.*)", # Public Interest Registry (.org), nic.pw "Administrative Contact ID:\s*(?P.+)\nAdministrative Contact Name:\s*(?P.+)\nAdministrative Contact Organization:\s*(?P.*)\nAdministrative Contact Address1:\s*(?P.+)\nAdministrative Contact Address2:\s*(?P.*)\nAdministrative Contact City:\s*(?P.+)\nAdministrative Contact State/Province:\s*(?P.+)\nAdministrative Contact Postal Code:\s*(?P.+)\nAdministrative Contact Country:\s*(?P.+)\nAdministrative Contact Country Code:\s*(?P.+)\nAdministrative Contact Phone Number:\s*(?P.+)\nAdministrative Contact Email:\s*(?P.+)\n", # .CO Internet "Admin Contact: (?P.+)\nAdmin Organization: (?P.+)\nAdmin Name: (?P.+)\nAdmin Street: (?P.+)\nAdmin City: (?P.+)\nAdmin State: (?P.+)\nAdmin Postal Code: (?P.+)\nAdmin Country: (?P.+)\nAdmin Phone: (?P.*)\nAdmin Phone Ext: (?P.*)\nAdmin Fax: (?P.*)\nAdmin Fax Ext: (?P.*)\nAdmin Email: (?P.*)\n", # Key-Systems GmbH "(?:Admin ID:[ ]*(?P.*)\n)?Admin[ ]*Name:[ ]*(?P.*)\nAdmin[ ]*Organization:[ ]*(?P.*)\nAdmin[ ]*Street:[ ]*(?P.+)\n(?:Admin[ ]*Street:[ ]*(?P.+)\n)?Admin[ ]*City:[ ]*(?P.+)\nAdmin[ ]*State\/Province:[ ]*(?P.+)\nAdmin[ ]*Postal[ ]*Code:[ ]*(?P.+)\nAdmin[ ]*Country:[ ]*(?P.+)\n(?:Admin[ ]*Phone:[ ]*(?P.*)\n)?(?:Admin[ ]*Phone[ ]*Ext:[ ]*(?P.*)\n)?(?:Admin[ ]*Fax:[ ]*(?P.*)\n)?(?:Admin[ ]*Fax[ ]*Ext:\s*?(?P.*)\n)?(?:Admin[ ]*Email:[ ]*(?P.+)\n)?", # WildWestDomains, GoDaddy, Namecheap/eNom, Ascio, Musedoma (.museum) @@ -345,6 +346,7 @@ def parse_registrants(data): ] billing_contact_regexes = [ + "Billing ID:(?P.+)\nBilling Name:(?P.*)\nBilling Organization:(?P.*)\nBilling Street1:(?P.*)\n(?:Billing Street2:(?P.*)\n)?(?:Billing Street3:(?P.*)\n)?Billing City:(?P.*)\nBilling State/Province:(?P.*)\nBilling Postal Code:(?P.*)\nBilling Country:(?P.*)\nBilling Phone:(?P.*)\n(?:Billing Phone Ext.:(?P.*)\n)?(?:Billing FAX:(?P.*)\n)?(?:Billing FAX Ext.:(?P.*)\n)?Billing Email:(?P.*)", # nic.pw "Billing Contact ID:\s*(?P.+)\nBilling Contact Name:\s*(?P.+)\nBilling Contact Organization:\s*(?P.*)\nBilling Contact Address1:\s*(?P.+)\nBilling Contact Address2:\s*(?P.*)\nBilling Contact City:\s*(?P.+)\nBilling Contact State/Province:\s*(?P.+)\nBilling Contact Postal Code:\s*(?P.+)\nBilling Contact Country:\s*(?P.+)\nBilling Contact Country Code:\s*(?P.+)\nBilling Contact Phone Number:\s*(?P.+)\nBilling Contact Email:\s*(?P.+)\n", # .CO Internet "Billing Contact: (?P.+)\nBilling Organization: (?P.+)\nBilling Name: (?P.+)\nBilling Street: (?P.+)\nBilling City: (?P.+)\nBilling Postal Code: (?P.+)\nBilling State: (?P.+)\nBilling Country: (?P.+)\nBilling Phone: (?P.*)\nBilling Phone Ext: (?P.*)\nBilling Fax: (?P.*)\nBilling Fax Ext: (?P.*)\nBilling Email: (?P.*)\n", # Key-Systems GmbH "(?:Billing ID:[ ]*(?P.*)\n)?Billing[ ]*Name:[ ]*(?P.*)\nBilling[ ]*Organization:[ ]*(?P.*)\nBilling[ ]*Street:[ ]*(?P.+)\n(?:Billing[ ]*Street:[ ]*(?P.+)\n)?Billing[ ]*City:[ ]*(?P.+)\nBilling[ ]*State\/Province:[ ]*(?P.+)\nBilling[ ]*Postal[ ]*Code:[ ]*(?P.+)\nBilling[ ]*Country:[ ]*(?P.+)\n(?:Billing[ ]*Phone:[ ]*(?P.*)\n)?(?:Billing[ ]*Phone[ ]*Ext:[ ]*(?P.*)\n)?(?:Billing[ ]*Fax:[ ]*(?P.*)\n)?(?:Billing[ ]*Fax[ ]*Ext:\s*?(?P.*)\n)?(?:Billing[ ]*Email:[ ]*(?P.+)\n)?", # Musedoma (.museum) diff --git a/test/data/nic.pw b/test/data/nic.pw new file mode 100644 index 0000000..de87b2f --- /dev/null +++ b/test/data/nic.pw @@ -0,0 +1,75 @@ +This whois service is provided by CentralNic Ltd and only contains +information pertaining to Internet domain names we have registered for +our customers. By using this service you are agreeing (1) not to use any +information presented here for any purpose other than determining +ownership of domain names, (2) not to store or reproduce this data in +any way, (3) not to use any high-volume, automated, electronic processes +to obtain data from this service. Abuse of this service is monitored and +actions in contravention of these terms will result in being permanently +blacklisted. All data is (c) CentralNic Ltd https://www.centralnic.com/ + +Domain ID:CNIC-DO949898 +Domain Name:NIC.PW +Created On:2012-10-12T10:19:46.0Z +Last Updated On:2013-04-30T15:06:57.0Z +Expiration Date:2020-01-01T23:59:59.0Z +Status:OK +Registrant ID:H2661317 +Registrant Name:Registry Manager +Registrant Organization:.PW Registry +Registrant Street1:N/A +Registrant City:N/A +Registrant State/Province:N/A +Registrant Postal Code:N/A +Registrant Country:PW +Registrant Phone: +Registrant Email:contact@registry.pw +Admin ID:H2661317 +Admin Name:Registry Manager +Admin Organization:.PW Registry +Admin Street1:N/A +Admin City:N/A +Admin State/Province:N/A +Admin Postal Code:N/A +Admin Country:PW +Admin Phone: +Admin Email:contact@registry.pw +Tech ID:H2661317 +Tech Name:Registry Manager +Tech Organization:.PW Registry +Tech Street1:N/A +Tech City:N/A +Tech State/Province:N/A +Tech Postal Code:N/A +Tech Country:PW +Tech Phone: +Tech Email:contact@registry.pw +Billing ID:H2661317 +Billing Name:Registry Manager +Billing Organization:.PW Registry +Billing Street1:N/A +Billing City:N/A +Billing State/Province:N/A +Billing Postal Code:N/A +Billing Country:PW +Billing Phone: +Billing Email:contact@registry.pw +Sponsoring Registrar ID:H2661317 +Sponsoring Registrar Organization:.PW Registry +Sponsoring Registrar Street1:N/A +Sponsoring Registrar City:N/A +Sponsoring Registrar State/Province:N/A +Sponsoring Registrar Postal Code:N/A +Sponsoring Registrar Country:PW +Sponsoring Registrar Phone:N/A +Sponsoring Registrar Website:http://www.registry.pw +Name Server:NS0.CENTRALNIC-DNS.COM +Name Server:NS1.CENTRALNIC-DNS.COM +Name Server:NS2.CENTRALNIC-DNS.COM +Name Server:NS3.CENTRALNIC-DNS.COM +Name Server:NS4.CENTRALNIC-DNS.COM +Name Server:NS5.CENTRALNIC-DNS.COM +DNSSEC:Unsigned + + +