Skip to content

Commit 706deab

Browse files
committed
Add support for .xyz (CentralNic)
1 parent e8fbd73 commit 706deab

File tree

4 files changed

+97
-7
lines changed

4 files changed

+97
-7
lines changed

pythonwhois/net.py

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -73,13 +73,17 @@ def get_whois_raw(domain, server="", previous=None, rfc3490=True, never_cut=Fals
7373
if never_cut == False:
7474
new_list = [response] + previous
7575
server_list.append(target_server)
76-
for line in [x.strip() for x in response.splitlines()]:
77-
match = re.match("(refer|whois server|referral url|whois server|registrar whois):\s*([^\s]+\.[^\s]+)", line, re.IGNORECASE)
78-
if match is not None:
79-
referal_server = match.group(2)
80-
if referal_server != server and "://" not in referal_server: # We want to ignore anything non-WHOIS (eg. HTTP) for now.
81-
# Referal to another WHOIS server...
82-
return get_whois_raw(domain, referal_server, new_list, server_list=server_list, with_server_list=with_server_list)
76+
77+
# Ignore redirects from registries who publish the registrar data themselves
78+
if target_server not in ('whois.nic.xyz',):
79+
for line in [x.strip() for x in response.splitlines()]:
80+
match = re.match("(refer|whois server|referral url|whois server|registrar whois):\s*([^\s]+\.[^\s]+)", line, re.IGNORECASE)
81+
if match is not None:
82+
referal_server = match.group(2)
83+
if referal_server != server and "://" not in referal_server: # We want to ignore anything non-WHOIS (eg. HTTP) for now.
84+
# Referal to another WHOIS server...
85+
return get_whois_raw(domain, referal_server, new_list, server_list=server_list, with_server_list=with_server_list)
86+
8387
if with_server_list:
8488
return (new_list, server_list)
8589
else:

test/data/ajp.xyz

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
Domain Name: AJP.XYZ
2+
Domain ID: D4498232-CNIC
3+
WHOIS Server: whois.enom.com
4+
Referral URL:
5+
Updated Date: 2015-07-12T06:42:17.0Z
6+
Creation Date: 2014-07-25T00:00:00.0Z
7+
Registry Expiry Date: 2016-07-25T23:59:59.0Z
8+
Sponsoring Registrar: eNom, Inc.
9+
Sponsoring Registrar IANA ID: 48
10+
Domain Status: clientTransferProhibited https://icann.org/epp#clientTransferProhibited
11+
Domain Status: serverTransferProhibited https://icann.org/epp#serverTransferProhibited
12+
Registrant ID: 11d79c5806455279
13+
Registrant Name: Andrew Pietila
14+
Registrant Organization:
15+
Registrant Street: 7555 Langley Ave S
16+
Registrant City: Cottage Grove
17+
Registrant State/Province: MN
18+
Registrant Postal Code: 55016
19+
Registrant Country: US
20+
Registrant Phone: +1.6519640898
21+
Registrant Phone Ext:
22+
Registrant Fax: +1.6519640898
23+
Registrant Fax Ext:
24+
Registrant Email: [email protected]
25+
Admin ID: 11d79c5806455279
26+
Admin Name: Andrew Pietila
27+
Admin Organization:
28+
Admin Street: 7555 Langley Ave S
29+
Admin City: Cottage Grove
30+
Admin State/Province: MN
31+
Admin Postal Code: 55016
32+
Admin Country: US
33+
Admin Phone: +1.6519640898
34+
Admin Phone Ext:
35+
Admin Fax: +1.6519640898
36+
Admin Fax Ext:
37+
Admin Email: [email protected]
38+
Tech ID: 11d79c5806455279
39+
Tech Name: Andrew Pietila
40+
Tech Organization:
41+
Tech Street: 7555 Langley Ave S
42+
Tech City: Cottage Grove
43+
Tech State/Province: MN
44+
Tech Postal Code: 55016
45+
Tech Country: US
46+
Tech Phone: +1.6519640898
47+
Tech Phone Ext:
48+
Tech Fax: +1.6519640898
49+
Tech Fax Ext:
50+
Tech Email: [email protected]
51+
Name Server: DAN.NS.CLOUDFLARE.COM
52+
Name Server: ZOE.NS.CLOUDFLARE.COM
53+
DNSSEC: unsigned
54+
Billing ID: 11d79c5806455279
55+
Billing Name: Andrew Pietila
56+
Billing Organization:
57+
Billing Street: 7555 Langley Ave S
58+
Billing City: Cottage Grove
59+
Billing State/Province: MN
60+
Billing Postal Code: 55016
61+
Billing Country: US
62+
Billing Phone: +1.6519640898
63+
Billing Phone Ext:
64+
Billing Fax: +1.6519640898
65+
Billing Fax Ext:
66+
Billing Email: [email protected]
67+
>>> Last update of WHOIS database: 2015-09-07T01:08:06.0Z <<<
68+
69+
For more information on Whois status codes, please visit https://icann.org/epp
70+
71+
This whois service is provided by CentralNic Ltd and only contains
72+
information pertaining to Internet domain names registered by our
73+
our customers. By using this service you are agreeing (1) not to use any
74+
information presented here for any purpose other than determining
75+
ownership of domain names, (2) not to store or reproduce this data in
76+
any way, (3) not to use any high-volume, automated, electronic processes
77+
to obtain data from this service. Abuse of this service is monitored and
78+
actions in contravention of these terms will result in being permanently
79+
blacklisted. All data is (c) CentralNic Ltd https://www.centralnic.com/
80+
81+
Access to the whois service is rate limited. For more information, please
82+
see https://registrar-console.centralnic.com/pub/whois_guidance.
83+
84+

test/target_default/ajp.xyz

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"status": ["clientTransferProhibited https://icann.org/epp#clientTransferProhibited", "serverTransferProhibited https://icann.org/epp#serverTransferProhibited"], "updated_date": ["2015-07-12T06:42:17"], "contacts": {"admin": {"city": "Cottage Grove", "fax": "+1.6519640898", "handle": "11d79c5806455279", "name": "Andrew Pietila", "state": "MN", "phone": "+1.6519640898", "street": "7555 Langley Ave S", "country": "US", "postalcode": "55016", "email": "[email protected]"}, "tech": {"city": "Cottage Grove", "fax": "+1.6519640898", "handle": "11d79c5806455279", "name": "Andrew Pietila", "state": "MN", "phone": "+1.6519640898", "street": "7555 Langley Ave S", "country": "US", "postalcode": "55016", "email": "[email protected]"}, "registrant": {"city": "Cottage Grove", "fax": "+1.6519640898", "handle": "11d79c5806455279", "name": "Andrew Pietila", "state": "MN", "phone": "+1.6519640898", "street": "7555 Langley Ave S", "country": "US", "postalcode": "55016", "email": "[email protected]"}, "billing": {"city": "Cottage Grove", "fax": "+1.6519640898", "handle": "11d79c5806455279", "name": "Andrew Pietila", "state": "MN", "phone": "+1.6519640898", "street": "7555 Langley Ave S", "country": "US", "postalcode": "55016", "email": "[email protected]"}}, "nameservers": ["DAN.NS.CLOUDFLARE.COM", "ZOE.NS.CLOUDFLARE.COM"], "expiration_date": ["2016-07-25T23:59:59"], "raw": ["Domain Name: AJP.XYZ\nDomain ID: D4498232-CNIC\nWHOIS Server: whois.enom.com\nReferral URL: \nUpdated Date: 2015-07-12T06:42:17.0Z\nCreation Date: 2014-07-25T00:00:00.0Z\nRegistry Expiry Date: 2016-07-25T23:59:59.0Z\nSponsoring Registrar: eNom, Inc.\nSponsoring Registrar IANA ID: 48\nDomain Status: clientTransferProhibited https://icann.org/epp#clientTransferProhibited\nDomain Status: serverTransferProhibited https://icann.org/epp#serverTransferProhibited\nRegistrant ID: 11d79c5806455279\nRegistrant Name: Andrew Pietila\nRegistrant Organization: \nRegistrant Street: 7555 Langley Ave S\nRegistrant City: Cottage Grove\nRegistrant State/Province: MN\nRegistrant Postal Code: 55016\nRegistrant Country: US\nRegistrant Phone: +1.6519640898\nRegistrant Phone Ext: \nRegistrant Fax: +1.6519640898\nRegistrant Fax Ext: \nRegistrant Email: [email protected]\nAdmin ID: 11d79c5806455279\nAdmin Name: Andrew Pietila\nAdmin Organization: \nAdmin Street: 7555 Langley Ave S\nAdmin City: Cottage Grove\nAdmin State/Province: MN\nAdmin Postal Code: 55016\nAdmin Country: US\nAdmin Phone: +1.6519640898\nAdmin Phone Ext: \nAdmin Fax: +1.6519640898\nAdmin Fax Ext: \nAdmin Email: [email protected]\nTech ID: 11d79c5806455279\nTech Name: Andrew Pietila\nTech Organization: \nTech Street: 7555 Langley Ave S\nTech City: Cottage Grove\nTech State/Province: MN\nTech Postal Code: 55016\nTech Country: US\nTech Phone: +1.6519640898\nTech Phone Ext: \nTech Fax: +1.6519640898\nTech Fax Ext: \nTech Email: [email protected]\nName Server: DAN.NS.CLOUDFLARE.COM\nName Server: ZOE.NS.CLOUDFLARE.COM\nDNSSEC: unsigned\nBilling ID: 11d79c5806455279\nBilling Name: Andrew Pietila\nBilling Organization: \nBilling Street: 7555 Langley Ave S\nBilling City: Cottage Grove\nBilling State/Province: MN\nBilling Postal Code: 55016\nBilling Country: US\nBilling Phone: +1.6519640898\nBilling Phone Ext: \nBilling Fax: +1.6519640898\nBilling Fax Ext: \nBilling Email: [email protected]\n>>> Last update of WHOIS database: 2015-09-07T01:08:06.0Z <<<\n\nFor more information on Whois status codes, please visit https://icann.org/epp\n\nThis whois service is provided by CentralNic Ltd and only contains\ninformation pertaining to Internet domain names registered by our\nour customers. By using this service you are agreeing (1) not to use any\ninformation presented here for any purpose other than determining\nownership of domain names, (2) not to store or reproduce this data in \nany way, (3) not to use any high-volume, automated, electronic processes\nto obtain data from this service. Abuse of this service is monitored and\nactions in contravention of these terms will result in being permanently\nblacklisted. All data is (c) CentralNic Ltd https://www.centralnic.com/\n\nAccess to the whois service is rate limited. For more information, please\nsee https://registrar-console.centralnic.com/pub/whois_guidance.\n\n\n"], "whois_server": ["whois.enom.com"], "registrar": ["eNom, Inc."], "creation_date": ["2014-07-25T00:00:00", "2014-07-25T00:00:00"], "id": ["D4498232-CNIC"]}

test/target_normalized/ajp.xyz

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"status": ["clientTransferProhibited https://icann.org/epp#clientTransferProhibited", "serverTransferProhibited https://icann.org/epp#serverTransferProhibited"], "updated_date": ["2015-07-12T06:42:17"], "contacts": {"admin": {"city": "Cottage Grove", "fax": "+1.6519640898", "handle": "11d79c5806455279", "name": "Andrew Pietila", "state": "Minnesota", "phone": "+1.6519640898", "street": "7555 Langley Ave S", "country": "United States", "postalcode": "55016", "email": "[email protected]"}, "tech": {"city": "Cottage Grove", "fax": "+1.6519640898", "handle": "11d79c5806455279", "name": "Andrew Pietila", "state": "Minnesota", "phone": "+1.6519640898", "street": "7555 Langley Ave S", "country": "United States", "postalcode": "55016", "email": "[email protected]"}, "registrant": {"city": "Cottage Grove", "fax": "+1.6519640898", "handle": "11d79c5806455279", "name": "Andrew Pietila", "state": "Minnesota", "phone": "+1.6519640898", "street": "7555 Langley Ave S", "country": "United States", "postalcode": "55016", "email": "[email protected]"}, "billing": {"city": "Cottage Grove", "fax": "+1.6519640898", "handle": "11d79c5806455279", "name": "Andrew Pietila", "state": "Minnesota", "phone": "+1.6519640898", "street": "7555 Langley Ave S", "country": "United States", "postalcode": "55016", "email": "[email protected]"}}, "nameservers": ["dan.ns.cloudflare.com", "zoe.ns.cloudflare.com"], "expiration_date": ["2016-07-25T23:59:59"], "raw": ["Domain Name: AJP.XYZ\nDomain ID: D4498232-CNIC\nWHOIS Server: whois.enom.com\nReferral URL: \nUpdated Date: 2015-07-12T06:42:17.0Z\nCreation Date: 2014-07-25T00:00:00.0Z\nRegistry Expiry Date: 2016-07-25T23:59:59.0Z\nSponsoring Registrar: eNom, Inc.\nSponsoring Registrar IANA ID: 48\nDomain Status: clientTransferProhibited https://icann.org/epp#clientTransferProhibited\nDomain Status: serverTransferProhibited https://icann.org/epp#serverTransferProhibited\nRegistrant ID: 11d79c5806455279\nRegistrant Name: Andrew Pietila\nRegistrant Organization: \nRegistrant Street: 7555 Langley Ave S\nRegistrant City: Cottage Grove\nRegistrant State/Province: MN\nRegistrant Postal Code: 55016\nRegistrant Country: US\nRegistrant Phone: +1.6519640898\nRegistrant Phone Ext: \nRegistrant Fax: +1.6519640898\nRegistrant Fax Ext: \nRegistrant Email: [email protected]\nAdmin ID: 11d79c5806455279\nAdmin Name: Andrew Pietila\nAdmin Organization: \nAdmin Street: 7555 Langley Ave S\nAdmin City: Cottage Grove\nAdmin State/Province: MN\nAdmin Postal Code: 55016\nAdmin Country: US\nAdmin Phone: +1.6519640898\nAdmin Phone Ext: \nAdmin Fax: +1.6519640898\nAdmin Fax Ext: \nAdmin Email: [email protected]\nTech ID: 11d79c5806455279\nTech Name: Andrew Pietila\nTech Organization: \nTech Street: 7555 Langley Ave S\nTech City: Cottage Grove\nTech State/Province: MN\nTech Postal Code: 55016\nTech Country: US\nTech Phone: +1.6519640898\nTech Phone Ext: \nTech Fax: +1.6519640898\nTech Fax Ext: \nTech Email: [email protected]\nName Server: DAN.NS.CLOUDFLARE.COM\nName Server: ZOE.NS.CLOUDFLARE.COM\nDNSSEC: unsigned\nBilling ID: 11d79c5806455279\nBilling Name: Andrew Pietila\nBilling Organization: \nBilling Street: 7555 Langley Ave S\nBilling City: Cottage Grove\nBilling State/Province: MN\nBilling Postal Code: 55016\nBilling Country: US\nBilling Phone: +1.6519640898\nBilling Phone Ext: \nBilling Fax: +1.6519640898\nBilling Fax Ext: \nBilling Email: [email protected]\n>>> Last update of WHOIS database: 2015-09-07T01:08:06.0Z <<<\n\nFor more information on Whois status codes, please visit https://icann.org/epp\n\nThis whois service is provided by CentralNic Ltd and only contains\ninformation pertaining to Internet domain names registered by our\nour customers. By using this service you are agreeing (1) not to use any\ninformation presented here for any purpose other than determining\nownership of domain names, (2) not to store or reproduce this data in \nany way, (3) not to use any high-volume, automated, electronic processes\nto obtain data from this service. Abuse of this service is monitored and\nactions in contravention of these terms will result in being permanently\nblacklisted. All data is (c) CentralNic Ltd https://www.centralnic.com/\n\nAccess to the whois service is rate limited. For more information, please\nsee https://registrar-console.centralnic.com/pub/whois_guidance.\n\n\n"], "whois_server": ["whois.enom.com"], "registrar": ["eNom, Inc."], "creation_date": ["2014-07-25T00:00:00", "2014-07-25T00:00:00"], "id": ["D4498232-CNIC"]}

0 commit comments

Comments
 (0)