diff --git a/pythonwhois/net.py b/pythonwhois/net.py index 6fe226a..7d71b87 100644 --- a/pythonwhois/net.py +++ b/pythonwhois/net.py @@ -73,13 +73,17 @@ def get_whois_raw(domain, server="", previous=None, rfc3490=True, never_cut=Fals if never_cut == False: new_list = [response] + previous server_list.append(target_server) - for line in [x.strip() for x in response.splitlines()]: - match = re.match("(refer|whois server|referral url|whois server|registrar whois):\s*([^\s]+\.[^\s]+)", line, re.IGNORECASE) - if match is not None: - referal_server = match.group(2) - if referal_server != server and "://" not in referal_server: # We want to ignore anything non-WHOIS (eg. HTTP) for now. - # Referal to another WHOIS server... - return get_whois_raw(domain, referal_server, new_list, server_list=server_list, with_server_list=with_server_list) + + # Ignore redirects from registries who publish the registrar data themselves + if target_server not in ('whois.nic.xyz',): + for line in [x.strip() for x in response.splitlines()]: + match = re.match("(refer|whois server|referral url|whois server|registrar whois):\s*([^\s]+\.[^\s]+)", line, re.IGNORECASE) + if match is not None: + referal_server = match.group(2) + if referal_server != server and "://" not in referal_server: # We want to ignore anything non-WHOIS (eg. HTTP) for now. + # Referal to another WHOIS server... + return get_whois_raw(domain, referal_server, new_list, server_list=server_list, with_server_list=with_server_list) + if with_server_list: return (new_list, server_list) else: diff --git a/test/data/ajp.xyz b/test/data/ajp.xyz new file mode 100644 index 0000000..2cdcd9c --- /dev/null +++ b/test/data/ajp.xyz @@ -0,0 +1,84 @@ +Domain Name: AJP.XYZ +Domain ID: D4498232-CNIC +WHOIS Server: whois.enom.com +Referral URL: +Updated Date: 2015-07-12T06:42:17.0Z +Creation Date: 2014-07-25T00:00:00.0Z +Registry Expiry Date: 2016-07-25T23:59:59.0Z +Sponsoring Registrar: eNom, Inc. +Sponsoring Registrar IANA ID: 48 +Domain Status: clientTransferProhibited https://icann.org/epp#clientTransferProhibited +Domain Status: serverTransferProhibited https://icann.org/epp#serverTransferProhibited +Registrant ID: 11d79c5806455279 +Registrant Name: Andrew Pietila +Registrant Organization: +Registrant Street: 7555 Langley Ave S +Registrant City: Cottage Grove +Registrant State/Province: MN +Registrant Postal Code: 55016 +Registrant Country: US +Registrant Phone: +1.6519640898 +Registrant Phone Ext: +Registrant Fax: +1.6519640898 +Registrant Fax Ext: +Registrant Email: the@ubernerd.us +Admin ID: 11d79c5806455279 +Admin Name: Andrew Pietila +Admin Organization: +Admin Street: 7555 Langley Ave S +Admin City: Cottage Grove +Admin State/Province: MN +Admin Postal Code: 55016 +Admin Country: US +Admin Phone: +1.6519640898 +Admin Phone Ext: +Admin Fax: +1.6519640898 +Admin Fax Ext: +Admin Email: the@ubernerd.us +Tech ID: 11d79c5806455279 +Tech Name: Andrew Pietila +Tech Organization: +Tech Street: 7555 Langley Ave S +Tech City: Cottage Grove +Tech State/Province: MN +Tech Postal Code: 55016 +Tech Country: US +Tech Phone: +1.6519640898 +Tech Phone Ext: +Tech Fax: +1.6519640898 +Tech Fax Ext: +Tech Email: the@ubernerd.us +Name Server: DAN.NS.CLOUDFLARE.COM +Name Server: ZOE.NS.CLOUDFLARE.COM +DNSSEC: unsigned +Billing ID: 11d79c5806455279 +Billing Name: Andrew Pietila +Billing Organization: +Billing Street: 7555 Langley Ave S +Billing City: Cottage Grove +Billing State/Province: MN +Billing Postal Code: 55016 +Billing Country: US +Billing Phone: +1.6519640898 +Billing Phone Ext: +Billing Fax: +1.6519640898 +Billing Fax Ext: +Billing Email: the@ubernerd.us +>>> Last update of WHOIS database: 2015-09-07T01:08:06.0Z <<< + +For more information on Whois status codes, please visit https://icann.org/epp + +This whois service is provided by CentralNic Ltd and only contains +information pertaining to Internet domain names registered by our +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/ + +Access to the whois service is rate limited. For more information, please +see https://registrar-console.centralnic.com/pub/whois_guidance. + + diff --git a/test/target_default/ajp.xyz b/test/target_default/ajp.xyz new file mode 100644 index 0000000..208c936 --- /dev/null +++ b/test/target_default/ajp.xyz @@ -0,0 +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": "the@ubernerd.us"}, "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": "the@ubernerd.us"}, "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": "the@ubernerd.us"}, "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": "the@ubernerd.us"}}, "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: the@ubernerd.us\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: the@ubernerd.us\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: the@ubernerd.us\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: the@ubernerd.us\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"]} \ No newline at end of file diff --git a/test/target_normalized/ajp.xyz b/test/target_normalized/ajp.xyz new file mode 100644 index 0000000..6cd500d --- /dev/null +++ b/test/target_normalized/ajp.xyz @@ -0,0 +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": "the@ubernerd.us"}, "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": "the@ubernerd.us"}, "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": "the@ubernerd.us"}, "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": "the@ubernerd.us"}}, "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: the@ubernerd.us\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: the@ubernerd.us\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: the@ubernerd.us\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: the@ubernerd.us\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"]} \ No newline at end of file