mirror of
https://github.com/Evolix/chexpire.git
synced 2024-06-09 19:14:29 +02:00
Merge pull request #14 from Evolix/more-whois-ext
Whois support for .com, .net, .org
This commit is contained in:
commit
12b0239e8f
|
@ -7,6 +7,5 @@ module Whois
|
||||||
class ParserError < Error; end
|
class ParserError < Error; end
|
||||||
|
|
||||||
class FieldNotFoundError < ParserError; end
|
class FieldNotFoundError < ParserError; end
|
||||||
class MissingDateFormatError < ParserError; end
|
|
||||||
class InvalidDateError < ParserError; end
|
class InvalidDateError < ParserError; end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,10 +1,11 @@
|
||||||
require "null_logger"
|
require "null_logger"
|
||||||
require "whois/errors"
|
require "whois/errors"
|
||||||
require "whois/parser/fr"
|
require "whois/parser/afnic"
|
||||||
|
require "whois/parser/verisign"
|
||||||
|
|
||||||
module Whois
|
module Whois
|
||||||
module Parser
|
module Parser
|
||||||
PARSERS = [Fr].freeze
|
PARSERS = [AFNIC, Verisign].freeze
|
||||||
|
|
||||||
class << self
|
class << self
|
||||||
def for(domain, logger: NullLogger.new)
|
def for(domain, logger: NullLogger.new)
|
||||||
|
|
|
@ -4,8 +4,15 @@ require_relative "base"
|
||||||
|
|
||||||
module Whois
|
module Whois
|
||||||
module Parser
|
module Parser
|
||||||
class Fr < Base
|
class AFNIC < Base
|
||||||
SUPPORTED_TLD = %w[.fr].freeze
|
SUPPORTED_TLD = %w[
|
||||||
|
.fr
|
||||||
|
.re
|
||||||
|
.tf
|
||||||
|
.yt
|
||||||
|
.pm
|
||||||
|
.wf
|
||||||
|
].freeze
|
||||||
COMMENT_REGEX = /^%+ +(?<text>.+)$/
|
COMMENT_REGEX = /^%+ +(?<text>.+)$/
|
||||||
FIELD_REGEX = /^(?<name>[^:]+)\s*:\s+(?<value>.+)$/
|
FIELD_REGEX = /^(?<name>[^:]+)\s*:\s+(?<value>.+)$/
|
||||||
|
|
|
@ -49,13 +49,15 @@ module Whois
|
||||||
end
|
end
|
||||||
|
|
||||||
def parse_date(str)
|
def parse_date(str)
|
||||||
fail MissingDateFormatError, "Date format not set" if date_format.nil?
|
date_format.nil? ? Time.parse(str) : Time.strptime(str, date_format)
|
||||||
|
rescue ArgumentError
|
||||||
begin
|
msg = if date_format.nil?
|
||||||
Time.strptime(str, date_format)
|
"Date `#{str}` is not parsable without specifying a date format"
|
||||||
rescue ArgumentError
|
else
|
||||||
raise InvalidDateError, "Date `#{str}` does not match format #{date_format}"
|
"Date `#{str}` does not match format #{date_format}"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
raise InvalidDateError, msg
|
||||||
end
|
end
|
||||||
|
|
||||||
def comment_include?(str)
|
def comment_include?(str)
|
||||||
|
@ -64,6 +66,12 @@ module Whois
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def text_include?(str)
|
||||||
|
entries.any? { |e|
|
||||||
|
e.text? && e.text.include?(str)
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
def raise_not_found
|
def raise_not_found
|
||||||
fail DomainNotFoundError, "Domain #{domain} not found in the registry database."
|
fail DomainNotFoundError, "Domain #{domain} not found in the registry database."
|
||||||
end
|
end
|
||||||
|
|
46
app/services/whois/parser/pir.rb
Normal file
46
app/services/whois/parser/pir.rb
Normal file
|
@ -0,0 +1,46 @@
|
||||||
|
require "domain_helper"
|
||||||
|
require "whois/errors"
|
||||||
|
require_relative "base"
|
||||||
|
|
||||||
|
module Whois
|
||||||
|
module Parser
|
||||||
|
class PIR < Base
|
||||||
|
SUPPORTED_TLD = %w[
|
||||||
|
.org
|
||||||
|
.ngo
|
||||||
|
.ong
|
||||||
|
.opr
|
||||||
|
].freeze
|
||||||
|
|
||||||
|
COMMENT_REGEX = /^(%|>)+ +(?<text>.+)$/
|
||||||
|
FIELD_REGEX = /^(?<name>[^:]+)\s*:\s+(?<value>.+)$/
|
||||||
|
|
||||||
|
def self.supports?(domain)
|
||||||
|
SUPPORTED_TLD.include?(tld(domain))
|
||||||
|
end
|
||||||
|
|
||||||
|
protected
|
||||||
|
|
||||||
|
def do_parse
|
||||||
|
raise_not_found if text_include?("NOT FOUND")
|
||||||
|
|
||||||
|
extract_values
|
||||||
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
|
||||||
|
def extract_values
|
||||||
|
domain_index = get_field!("Domain Name", value: domain.upcase).index
|
||||||
|
|
||||||
|
created_date = get_value!("Creation Date", after: domain_index)
|
||||||
|
response.created_at = parse_date(created_date)
|
||||||
|
|
||||||
|
expire_date = get_value!("Registry Expiry Date", after: domain_index)
|
||||||
|
response.expire_at = parse_date(expire_date)
|
||||||
|
|
||||||
|
updated_date = get_value!("Updated Date", after: domain_index)
|
||||||
|
response.updated_at = parse_date(updated_date)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
49
app/services/whois/parser/verisign.rb
Normal file
49
app/services/whois/parser/verisign.rb
Normal file
|
@ -0,0 +1,49 @@
|
||||||
|
require "domain_helper"
|
||||||
|
require "whois/errors"
|
||||||
|
require_relative "base"
|
||||||
|
|
||||||
|
module Whois
|
||||||
|
module Parser
|
||||||
|
class Verisign < Base
|
||||||
|
SUPPORTED_TLD = %w[
|
||||||
|
.com
|
||||||
|
.net
|
||||||
|
.cc
|
||||||
|
.tv
|
||||||
|
.name
|
||||||
|
.jobs
|
||||||
|
.edu
|
||||||
|
.gov
|
||||||
|
].freeze
|
||||||
|
COMMENT_REGEX = /^(%|>)+ +(?<text>.+)$/
|
||||||
|
FIELD_REGEX = /^(?<name>[^:]+)\s*:\s+(?<value>.+)$/
|
||||||
|
|
||||||
|
def self.supports?(domain)
|
||||||
|
SUPPORTED_TLD.include?(tld(domain))
|
||||||
|
end
|
||||||
|
|
||||||
|
protected
|
||||||
|
|
||||||
|
def do_parse
|
||||||
|
raise_not_found if text_include?("No match for domain")
|
||||||
|
|
||||||
|
extract_values
|
||||||
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
|
||||||
|
def extract_values
|
||||||
|
domain_index = get_field!("Domain Name", value: domain.upcase).index
|
||||||
|
|
||||||
|
created_date = get_value!("Creation Date", after: domain_index)
|
||||||
|
response.created_at = parse_date(created_date)
|
||||||
|
|
||||||
|
expire_date = get_value!("Registry Expiry Date", after: domain_index)
|
||||||
|
response.expire_at = parse_date(expire_date)
|
||||||
|
|
||||||
|
updated_date = get_value!("Updated Date", after: domain_index)
|
||||||
|
response.updated_at = parse_date(updated_date)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
139
test/fixtures/files/whois/domain.com.txt
vendored
Normal file
139
test/fixtures/files/whois/domain.com.txt
vendored
Normal file
|
@ -0,0 +1,139 @@
|
||||||
|
% IANA WHOIS server
|
||||||
|
% for more information on IANA, visit http://www.iana.org
|
||||||
|
% This query returned 1 object
|
||||||
|
|
||||||
|
refer: whois.verisign-grs.com
|
||||||
|
|
||||||
|
domain: COM
|
||||||
|
|
||||||
|
organisation: VeriSign Global Registry Services
|
||||||
|
address: 12061 Bluemont Way
|
||||||
|
address: Reston Virginia 20190
|
||||||
|
address: United States
|
||||||
|
|
||||||
|
contact: administrative
|
||||||
|
name: Registry Customer Service
|
||||||
|
organisation: VeriSign Global Registry Services
|
||||||
|
address: 12061 Bluemont Way
|
||||||
|
address: Reston Virginia 20190
|
||||||
|
address: United States
|
||||||
|
phone: +1 703 925-6999
|
||||||
|
fax-no: +1 703 948 3978
|
||||||
|
e-mail: info@verisign-grs.com
|
||||||
|
|
||||||
|
contact: technical
|
||||||
|
name: Registry Customer Service
|
||||||
|
organisation: VeriSign Global Registry Services
|
||||||
|
address: 12061 Bluemont Way
|
||||||
|
address: Reston Virginia 20190
|
||||||
|
address: United States
|
||||||
|
phone: +1 703 925-6999
|
||||||
|
fax-no: +1 703 948 3978
|
||||||
|
e-mail: info@verisign-grs.com
|
||||||
|
|
||||||
|
nserver: A.GTLD-SERVERS.NET 192.5.6.30 2001:503:a83e:0:0:0:2:30
|
||||||
|
nserver: B.GTLD-SERVERS.NET 192.33.14.30 2001:503:231d:0:0:0:2:30
|
||||||
|
nserver: C.GTLD-SERVERS.NET 192.26.92.30 2001:503:83eb:0:0:0:0:30
|
||||||
|
nserver: D.GTLD-SERVERS.NET 192.31.80.30 2001:500:856e:0:0:0:0:30
|
||||||
|
nserver: E.GTLD-SERVERS.NET 192.12.94.30 2001:502:1ca1:0:0:0:0:30
|
||||||
|
nserver: F.GTLD-SERVERS.NET 192.35.51.30 2001:503:d414:0:0:0:0:30
|
||||||
|
nserver: G.GTLD-SERVERS.NET 192.42.93.30 2001:503:eea3:0:0:0:0:30
|
||||||
|
nserver: H.GTLD-SERVERS.NET 192.54.112.30 2001:502:8cc:0:0:0:0:30
|
||||||
|
nserver: I.GTLD-SERVERS.NET 192.43.172.30 2001:503:39c1:0:0:0:0:30
|
||||||
|
nserver: J.GTLD-SERVERS.NET 192.48.79.30 2001:502:7094:0:0:0:0:30
|
||||||
|
nserver: K.GTLD-SERVERS.NET 192.52.178.30 2001:503:d2d:0:0:0:0:30
|
||||||
|
nserver: L.GTLD-SERVERS.NET 192.41.162.30 2001:500:d937:0:0:0:0:30
|
||||||
|
nserver: M.GTLD-SERVERS.NET 192.55.83.30 2001:501:b1f9:0:0:0:0:30
|
||||||
|
ds-rdata: 30909 8 2 E2D3C916F6DEEAC73294E8268FB5885044A833FC5459588F4A9184CFC41A5766
|
||||||
|
|
||||||
|
whois: whois.verisign-grs.com
|
||||||
|
|
||||||
|
status: ACTIVE
|
||||||
|
remarks: Registration information: http://www.verisigninc.com
|
||||||
|
|
||||||
|
created: 1985-01-01
|
||||||
|
changed: 2017-10-05
|
||||||
|
source: IANA
|
||||||
|
|
||||||
|
Domain Name: DOMAIN.COM
|
||||||
|
Registry Domain ID: 608082_DOMAIN_COM-VRSN
|
||||||
|
Registrar WHOIS Server: whois.domain.com
|
||||||
|
Registrar URL: http://www.domain.com
|
||||||
|
Updated Date: 2018-02-13T18:33:26Z
|
||||||
|
Creation Date: 1994-07-01T04:00:00Z
|
||||||
|
Registry Expiry Date: 2021-01-07T13:34:24Z
|
||||||
|
Registrar: Domain.com, LLC
|
||||||
|
Registrar IANA ID: 886
|
||||||
|
Registrar Abuse Contact Email: compliance@domain-inc.net
|
||||||
|
Registrar Abuse Contact Phone: 602-226-2389
|
||||||
|
Domain Status: clientDeleteProhibited https://icann.org/epp#clientDeleteProhibited
|
||||||
|
Domain Status: clientTransferProhibited https://icann.org/epp#clientTransferProhibited
|
||||||
|
Domain Status: clientUpdateProhibited https://icann.org/epp#clientUpdateProhibited
|
||||||
|
Name Server: NS-1250.AWSDNS-28.ORG
|
||||||
|
Name Server: NS-166.AWSDNS-20.COM
|
||||||
|
Name Server: NS-2022.AWSDNS-60.CO.UK
|
||||||
|
Name Server: NS-683.AWSDNS-21.NET
|
||||||
|
DNSSEC: unsigned
|
||||||
|
URL of the ICANN Whois Inaccuracy Complaint Form: https://www.icann.org/wicf/
|
||||||
|
>>> Last update of whois database: 2018-06-05T14:05:20Z <<<
|
||||||
|
|
||||||
|
Domain Name: DOMAIN.COM
|
||||||
|
Registry Domain ID: 608082_DOMAIN_COM-VRSN
|
||||||
|
Registrar WHOIS Server: whois.domain.com
|
||||||
|
Registrar URL: www.domain.com
|
||||||
|
Updated Date: 2016-10-21T20:11:05
|
||||||
|
Creation Date: 1994-07-01T04:00:00
|
||||||
|
Registrar Registration Expiration Date: 2021-01-07T13:34:24
|
||||||
|
Registrar: Domain.com, LLC
|
||||||
|
Registrar IANA ID: 886
|
||||||
|
Reseller: Domain Name Holding Company, Inc
|
||||||
|
Domain Status: clientDeleteProhibited https://icann.org/epp#clientDeleteProhibited
|
||||||
|
Domain Status: clientTransferProhibited https://icann.org/epp#clientTransferProhibited
|
||||||
|
Domain Status: clientUpdateProhibited https://icann.org/epp#clientUpdateProhibited
|
||||||
|
Registry Registrant ID:
|
||||||
|
Registrant Name: Data Protected Data Protected
|
||||||
|
Registrant Organization: Data Protected
|
||||||
|
Registrant Street: 123 Data Protected
|
||||||
|
Registrant City: Toronto
|
||||||
|
Registrant State/Province: ON
|
||||||
|
Registrant Postal Code: M6K 3M1
|
||||||
|
Registrant Country: CA
|
||||||
|
Registrant Phone: +1.0000000000
|
||||||
|
Registrant Phone Ext:
|
||||||
|
Registrant Fax: +1.0000000000
|
||||||
|
Registrant Fax Ext:
|
||||||
|
Registrant Email: noreply@data-protected.net
|
||||||
|
Registry Admin ID:
|
||||||
|
Admin Name: Data Protected Data Protected
|
||||||
|
Admin Organization: Data Protected
|
||||||
|
Admin Street: 123 Data Protected
|
||||||
|
Admin City: Toronto
|
||||||
|
Admin State/Province: ON
|
||||||
|
Admin Postal Code: M6K 3M1
|
||||||
|
Admin Country: CA
|
||||||
|
Admin Phone: +1.0000000000
|
||||||
|
Admin Phone Ext:
|
||||||
|
Admin Fax: +1.0000000000
|
||||||
|
Admin Fax Ext:
|
||||||
|
Admin Email: noreply@data-protected.net
|
||||||
|
Registry Tech ID:
|
||||||
|
Tech Name: Data Protected Data Protected
|
||||||
|
Tech Organization: Data Protected
|
||||||
|
Tech Street: 123 Data Protected
|
||||||
|
Tech City: Toronto
|
||||||
|
Tech State/Province: ON
|
||||||
|
Tech Postal Code: M6K 3M1
|
||||||
|
Tech Country: CA
|
||||||
|
Tech Phone: +1.0000000000
|
||||||
|
Tech Phone Ext:
|
||||||
|
Tech Fax: +1.0000000000
|
||||||
|
Tech Fax Ext:
|
||||||
|
Tech Email: noreply@data-protected.net
|
||||||
|
Name Server: ns-166.dnsserver.com
|
||||||
|
Name Server: ns-683.dnsserver.net
|
||||||
|
Name Server: ns-1250.dnsserver.org
|
||||||
|
|
||||||
|
Registrar Abuse Contact Email: compliance@domain-inc.net
|
||||||
|
Registrar Abuse Contact Phone: +1.0123456789
|
||||||
|
URL of the ICANN WHOIS Data Problem Reporting System: http://wdprs.internic.net/
|
||||||
|
>>> Last update of WHOIS database: 2016-10-21T20:11:05 <<<
|
138
test/fixtures/files/whois/domain.org.txt
vendored
Normal file
138
test/fixtures/files/whois/domain.org.txt
vendored
Normal file
|
@ -0,0 +1,138 @@
|
||||||
|
% IANA WHOIS server
|
||||||
|
% for more information on IANA, visit http://www.iana.org
|
||||||
|
% This query returned 1 object
|
||||||
|
|
||||||
|
refer: whois.pir.org
|
||||||
|
|
||||||
|
domain: ORG
|
||||||
|
|
||||||
|
organisation: Public Interest Registry (PIR)
|
||||||
|
address: 1775 Wiehle Avenue
|
||||||
|
address: Suite 102A
|
||||||
|
address: Reston Virginia 20190
|
||||||
|
address: United States
|
||||||
|
|
||||||
|
contact: administrative
|
||||||
|
name: Director of Operations, Compliance and Customer Support
|
||||||
|
organisation: Public Interest Registry (PIR)
|
||||||
|
address: 1775 Wiehle Avenue
|
||||||
|
address: Reston Virginia 20190
|
||||||
|
address: United States
|
||||||
|
phone: +1 919 369 4161
|
||||||
|
fax-no: +1 703 889 5779
|
||||||
|
e-mail: ops@pir.org
|
||||||
|
|
||||||
|
contact: technical
|
||||||
|
name: Senior Director, DNS Infrastructure Group
|
||||||
|
organisation: Afilias
|
||||||
|
address: Building 3, Suite 105
|
||||||
|
address: 300 Welsh Road
|
||||||
|
address: Horsham, Pennsylvania 19044
|
||||||
|
address: United States
|
||||||
|
phone: +1 215.706.5700
|
||||||
|
fax-no: +1 215.706.5701
|
||||||
|
e-mail: tld-tech-poc@afilias.info
|
||||||
|
|
||||||
|
nserver: A0.ORG.AFILIAS-NST.INFO 199.19.56.1 2001:500:e:0:0:0:0:1
|
||||||
|
nserver: A2.ORG.AFILIAS-NST.INFO 199.249.112.1 2001:500:40:0:0:0:0:1
|
||||||
|
nserver: B0.ORG.AFILIAS-NST.ORG 199.19.54.1 2001:500:c:0:0:0:0:1
|
||||||
|
nserver: B2.ORG.AFILIAS-NST.ORG 199.249.120.1 2001:500:48:0:0:0:0:1
|
||||||
|
nserver: C0.ORG.AFILIAS-NST.INFO 199.19.53.1 2001:500:b:0:0:0:0:1
|
||||||
|
nserver: D0.ORG.AFILIAS-NST.ORG 199.19.57.1 2001:500:f:0:0:0:0:1
|
||||||
|
ds-rdata: 9795 7 2 3922b31b6f3a4ea92b19eb7b52120f031fd8e05ff0b03bafcf9f891bfe7ff8e5
|
||||||
|
ds-rdata: 9795 7 1 364dfab3daf254cab477b5675b10766ddaa24982
|
||||||
|
|
||||||
|
whois: whois.pir.org
|
||||||
|
|
||||||
|
status: ACTIVE
|
||||||
|
remarks: Registration information: http://www.pir.org
|
||||||
|
|
||||||
|
created: 1985-01-01
|
||||||
|
changed: 2016-05-10
|
||||||
|
source: IANA
|
||||||
|
|
||||||
|
Domain Name: DOMAIN.ORG
|
||||||
|
Registry Domain ID: D1511762-LROR
|
||||||
|
Registrar WHOIS Server: whois.domain.com
|
||||||
|
Registrar URL: www.domain.com
|
||||||
|
Updated Date: 2018-04-02T03:47:23Z
|
||||||
|
Creation Date: 1995-04-30T04:00:00Z
|
||||||
|
Registry Expiry Date: 2019-05-01T04:00:00Z
|
||||||
|
Registrar Registration Expiration Date:
|
||||||
|
Registrar: Domain.com, LLC
|
||||||
|
Registrar IANA ID: 886
|
||||||
|
Registrar Abuse Contact Email: compliance@domain-inc.net
|
||||||
|
Registrar Abuse Contact Phone: +1.6022262389
|
||||||
|
Reseller:
|
||||||
|
Domain Status: clientDeleteProhibited https://icann.org/epp#clientDeleteProhibited
|
||||||
|
Domain Status: clientTransferProhibited https://icann.org/epp#clientTransferProhibited
|
||||||
|
Domain Status: clientUpdateProhibited https://icann.org/epp#clientUpdateProhibited
|
||||||
|
Registrant Organization: Endurance International Group West, Inc
|
||||||
|
Registrant State/Province: MA
|
||||||
|
Registrant Country: US
|
||||||
|
Name Server: DNS1.DOMAINBANK.COM
|
||||||
|
Name Server: DNS2.DOMAINBANK.COM
|
||||||
|
DNSSEC: unsigned
|
||||||
|
URL of the ICANN Whois Inaccuracy Complaint Form: https://www.icann.org/wicf/
|
||||||
|
>>> Last update of WHOIS database: 2018-06-05T14:44:20Z <<<
|
||||||
|
|
||||||
|
Domain Name: DOMAIN.ORG
|
||||||
|
Registry Domain ID: D1511762-LROR
|
||||||
|
Registrar WHOIS Server: whois.domain.com
|
||||||
|
Registrar URL: www.domain.com
|
||||||
|
Updated Date: 2018-04-02T03:47:23
|
||||||
|
Creation Date: 1995-04-29T04:00:00
|
||||||
|
Registrar Registration Expiration Date: 2019-05-01T04:00:00
|
||||||
|
Registrar: Domain.com, LLC
|
||||||
|
Registrar IANA ID: 886
|
||||||
|
Reseller: Domain Name Holding Company, Inc
|
||||||
|
Domain Status: clientDeleteProhibited https://icann.org/epp#clientDeleteProhibited
|
||||||
|
Domain Status: clientTransferProhibited https://icann.org/epp#clientTransferProhibited
|
||||||
|
Domain Status: clientUpdateProhibited https://icann.org/epp#clientUpdateProhibited
|
||||||
|
Registry Registrant ID:
|
||||||
|
Registrant Name: Data Protected Data Protected
|
||||||
|
Registrant Organization: Data Protected
|
||||||
|
Registrant Street: 123 Data Protected
|
||||||
|
Registrant City: Toronto
|
||||||
|
Registrant State/Province: ON
|
||||||
|
Registrant Postal Code: M6K 3M1
|
||||||
|
Registrant Country: CA
|
||||||
|
Registrant Phone: +1.0000000000
|
||||||
|
Registrant Phone Ext:
|
||||||
|
Registrant Fax: +1.0000000000
|
||||||
|
Registrant Fax Ext:
|
||||||
|
Registrant Email: noreply@data-protected.net
|
||||||
|
Registry Admin ID:
|
||||||
|
Admin Name: Data Protected Data Protected
|
||||||
|
Admin Organization: Data Protected
|
||||||
|
Admin Street: 123 Data Protected
|
||||||
|
Admin City: Toronto
|
||||||
|
Admin State/Province: ON
|
||||||
|
Admin Postal Code: M6K 3M1
|
||||||
|
Admin Country: CA
|
||||||
|
Admin Phone: +1.0000000000
|
||||||
|
Admin Phone Ext:
|
||||||
|
Admin Fax: +1.0000000000
|
||||||
|
Admin Fax Ext:
|
||||||
|
Admin Email: noreply@data-protected.net
|
||||||
|
Registry Tech ID:
|
||||||
|
Tech Name: Data Protected Data Protected
|
||||||
|
Tech Organization: Data Protected
|
||||||
|
Tech Street: 123 Data Protected
|
||||||
|
Tech City: Toronto
|
||||||
|
Tech State/Province: ON
|
||||||
|
Tech Postal Code: M6K 3M1
|
||||||
|
Tech Country: CA
|
||||||
|
Tech Phone: +1.0000000000
|
||||||
|
Tech Phone Ext:
|
||||||
|
Tech Fax: +1.0000000000
|
||||||
|
Tech Fax Ext:
|
||||||
|
Tech Email: noreply@data-protected.net
|
||||||
|
Name Server: dns1.domainbank.com
|
||||||
|
Name Server: dns2.domainbank.com
|
||||||
|
|
||||||
|
Registrar Abuse Contact Email: compliance@domain-inc.net
|
||||||
|
Registrar Abuse Contact Phone: +1.6027165396
|
||||||
|
URL of the ICANN WHOIS Data Problem Reporting System: http://wdprs.internic.net/
|
||||||
|
>>> Last update of WHOIS database: 2018-04-02T03:47:23 <<<
|
||||||
|
|
60
test/fixtures/files/whois/willneverexist.com.txt
vendored
Normal file
60
test/fixtures/files/whois/willneverexist.com.txt
vendored
Normal file
|
@ -0,0 +1,60 @@
|
||||||
|
% IANA WHOIS server
|
||||||
|
% for more information on IANA, visit http://www.iana.org
|
||||||
|
% This query returned 1 object
|
||||||
|
|
||||||
|
refer: whois.verisign-grs.com
|
||||||
|
|
||||||
|
domain: COM
|
||||||
|
|
||||||
|
organisation: VeriSign Global Registry Services
|
||||||
|
address: 12061 Bluemont Way
|
||||||
|
address: Reston Virginia 20190
|
||||||
|
address: United States
|
||||||
|
|
||||||
|
contact: administrative
|
||||||
|
name: Registry Customer Service
|
||||||
|
organisation: VeriSign Global Registry Services
|
||||||
|
address: 12061 Bluemont Way
|
||||||
|
address: Reston Virginia 20190
|
||||||
|
address: United States
|
||||||
|
phone: +1 703 925-6999
|
||||||
|
fax-no: +1 703 948 3978
|
||||||
|
e-mail: info@verisign-grs.com
|
||||||
|
|
||||||
|
contact: technical
|
||||||
|
name: Registry Customer Service
|
||||||
|
organisation: VeriSign Global Registry Services
|
||||||
|
address: 12061 Bluemont Way
|
||||||
|
address: Reston Virginia 20190
|
||||||
|
address: United States
|
||||||
|
phone: +1 703 925-6999
|
||||||
|
fax-no: +1 703 948 3978
|
||||||
|
e-mail: info@verisign-grs.com
|
||||||
|
|
||||||
|
nserver: A.GTLD-SERVERS.NET 192.5.6.30 2001:503:a83e:0:0:0:2:30
|
||||||
|
nserver: B.GTLD-SERVERS.NET 192.33.14.30 2001:503:231d:0:0:0:2:30
|
||||||
|
nserver: C.GTLD-SERVERS.NET 192.26.92.30 2001:503:83eb:0:0:0:0:30
|
||||||
|
nserver: D.GTLD-SERVERS.NET 192.31.80.30 2001:500:856e:0:0:0:0:30
|
||||||
|
nserver: E.GTLD-SERVERS.NET 192.12.94.30 2001:502:1ca1:0:0:0:0:30
|
||||||
|
nserver: F.GTLD-SERVERS.NET 192.35.51.30 2001:503:d414:0:0:0:0:30
|
||||||
|
nserver: G.GTLD-SERVERS.NET 192.42.93.30 2001:503:eea3:0:0:0:0:30
|
||||||
|
nserver: H.GTLD-SERVERS.NET 192.54.112.30 2001:502:8cc:0:0:0:0:30
|
||||||
|
nserver: I.GTLD-SERVERS.NET 192.43.172.30 2001:503:39c1:0:0:0:0:30
|
||||||
|
nserver: J.GTLD-SERVERS.NET 192.48.79.30 2001:502:7094:0:0:0:0:30
|
||||||
|
nserver: K.GTLD-SERVERS.NET 192.52.178.30 2001:503:d2d:0:0:0:0:30
|
||||||
|
nserver: L.GTLD-SERVERS.NET 192.41.162.30 2001:500:d937:0:0:0:0:30
|
||||||
|
nserver: M.GTLD-SERVERS.NET 192.55.83.30 2001:501:b1f9:0:0:0:0:30
|
||||||
|
ds-rdata: 30909 8 2 E2D3C916F6DEEAC73294E8268FB5885044A833FC5459588F4A9184CFC41A5766
|
||||||
|
|
||||||
|
whois: whois.verisign-grs.com
|
||||||
|
|
||||||
|
status: ACTIVE
|
||||||
|
remarks: Registration information: http://www.verisigninc.com
|
||||||
|
|
||||||
|
created: 1985-01-01
|
||||||
|
changed: 2017-10-05
|
||||||
|
source: IANA
|
||||||
|
|
||||||
|
No match for domain "WILLNEVEREXIST.COM".
|
||||||
|
>>> Last update of whois database: 2018-06-05T14:06:36Z <<<
|
||||||
|
|
56
test/fixtures/files/whois/willneverexist.org.txt
vendored
Normal file
56
test/fixtures/files/whois/willneverexist.org.txt
vendored
Normal file
|
@ -0,0 +1,56 @@
|
||||||
|
% IANA WHOIS server
|
||||||
|
% for more information on IANA, visit http://www.iana.org
|
||||||
|
% This query returned 1 object
|
||||||
|
|
||||||
|
refer: whois.pir.org
|
||||||
|
|
||||||
|
domain: ORG
|
||||||
|
|
||||||
|
organisation: Public Interest Registry (PIR)
|
||||||
|
address: 1775 Wiehle Avenue
|
||||||
|
address: Suite 102A
|
||||||
|
address: Reston Virginia 20190
|
||||||
|
address: United States
|
||||||
|
|
||||||
|
contact: administrative
|
||||||
|
name: Director of Operations, Compliance and Customer Support
|
||||||
|
organisation: Public Interest Registry (PIR)
|
||||||
|
address: 1775 Wiehle Avenue
|
||||||
|
address: Reston Virginia 20190
|
||||||
|
address: United States
|
||||||
|
phone: +1 919 369 4161
|
||||||
|
fax-no: +1 703 889 5779
|
||||||
|
e-mail: ops@pir.org
|
||||||
|
|
||||||
|
contact: technical
|
||||||
|
name: Senior Director, DNS Infrastructure Group
|
||||||
|
organisation: Afilias
|
||||||
|
address: Building 3, Suite 105
|
||||||
|
address: 300 Welsh Road
|
||||||
|
address: Horsham, Pennsylvania 19044
|
||||||
|
address: United States
|
||||||
|
phone: +1 215.706.5700
|
||||||
|
fax-no: +1 215.706.5701
|
||||||
|
e-mail: tld-tech-poc@afilias.info
|
||||||
|
|
||||||
|
nserver: A0.ORG.AFILIAS-NST.INFO 199.19.56.1 2001:500:e:0:0:0:0:1
|
||||||
|
nserver: A2.ORG.AFILIAS-NST.INFO 199.249.112.1 2001:500:40:0:0:0:0:1
|
||||||
|
nserver: B0.ORG.AFILIAS-NST.ORG 199.19.54.1 2001:500:c:0:0:0:0:1
|
||||||
|
nserver: B2.ORG.AFILIAS-NST.ORG 199.249.120.1 2001:500:48:0:0:0:0:1
|
||||||
|
nserver: C0.ORG.AFILIAS-NST.INFO 199.19.53.1 2001:500:b:0:0:0:0:1
|
||||||
|
nserver: D0.ORG.AFILIAS-NST.ORG 199.19.57.1 2001:500:f:0:0:0:0:1
|
||||||
|
ds-rdata: 9795 7 2 3922b31b6f3a4ea92b19eb7b52120f031fd8e05ff0b03bafcf9f891bfe7ff8e5
|
||||||
|
ds-rdata: 9795 7 1 364dfab3daf254cab477b5675b10766ddaa24982
|
||||||
|
|
||||||
|
whois: whois.pir.org
|
||||||
|
|
||||||
|
status: ACTIVE
|
||||||
|
remarks: Registration information: http://www.pir.org
|
||||||
|
|
||||||
|
created: 1985-01-01
|
||||||
|
changed: 2016-05-10
|
||||||
|
source: IANA
|
||||||
|
|
||||||
|
NOT FOUND
|
||||||
|
>>> Last update of WHOIS database: 2018-06-05T14:44:34Z <<<
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
require "test_helper"
|
require "test_helper"
|
||||||
require "whois/parser/fr"
|
require "whois/parser/afnic"
|
||||||
require "whois/response"
|
require "whois/response"
|
||||||
require "whois/errors"
|
require "whois/errors"
|
||||||
|
|
||||||
module Whois
|
module Whois
|
||||||
class FrTest < ActiveSupport::TestCase
|
class AFNICTest < ActiveSupport::TestCase
|
||||||
test "should parse a whois response" do
|
test "should parse a whois response" do
|
||||||
parser = Parser::Fr.new("domain.fr")
|
parser = Parser::AFNIC.new("domain.fr")
|
||||||
domain_fr = file_fixture("whois/domain.fr.txt").read
|
domain_fr = file_fixture("whois/domain.fr.txt").read
|
||||||
response = parser.parse(domain_fr)
|
response = parser.parse(domain_fr)
|
||||||
assert_kind_of Response, response
|
assert_kind_of Response, response
|
||||||
|
@ -19,12 +19,22 @@ module Whois
|
||||||
end
|
end
|
||||||
|
|
||||||
test "should raises DomainNotFoundError when domain is not registered" do
|
test "should raises DomainNotFoundError when domain is not registered" do
|
||||||
parser = Parser::Fr.new("willneverexist.fr")
|
parser = Parser::AFNIC.new("willneverexist.fr")
|
||||||
not_found_fr = file_fixture("whois/willneverexist.fr.txt").read
|
not_found_fr = file_fixture("whois/willneverexist.fr.txt").read
|
||||||
|
|
||||||
assert_raises DomainNotFoundError do
|
assert_raises DomainNotFoundError do
|
||||||
parser.parse(not_found_fr)
|
parser.parse(not_found_fr)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
test "should raises InvalidDateError when a date is not in the expected format" do
|
||||||
|
parser = Parser::AFNIC.new("domain.fr")
|
||||||
|
domain_fr = file_fixture("whois/domain.fr.txt").read
|
||||||
|
domain_fr.gsub!("17/02/2019", "17-02-2019")
|
||||||
|
|
||||||
|
assert_raises InvalidDateError do
|
||||||
|
parser.parse(domain_fr)
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
40
test/services/whois/parser/pir_test.rb
Normal file
40
test/services/whois/parser/pir_test.rb
Normal file
|
@ -0,0 +1,40 @@
|
||||||
|
require "test_helper"
|
||||||
|
require "whois/parser/pir"
|
||||||
|
require "whois/response"
|
||||||
|
require "whois/errors"
|
||||||
|
|
||||||
|
module Whois
|
||||||
|
class PIRTest < ActiveSupport::TestCase
|
||||||
|
test "should parse a whois response" do
|
||||||
|
parser = Parser::PIR.new("domain.org")
|
||||||
|
domain_com = file_fixture("whois/domain.org.txt").read
|
||||||
|
response = parser.parse(domain_com)
|
||||||
|
assert_kind_of Response, response
|
||||||
|
|
||||||
|
assert_equal Time.new(1995, 4, 30, 4, 0, 0, 0), response.created_at
|
||||||
|
assert response.created_at.utc?
|
||||||
|
|
||||||
|
assert_equal Time.new(2018, 4, 2, 3, 47, 23, 0), response.updated_at
|
||||||
|
assert_equal Time.new(2019, 5, 1, 4, 0, 0, 0), response.expire_at
|
||||||
|
end
|
||||||
|
|
||||||
|
test "should raises DomainNotFoundError when domain is not registered" do
|
||||||
|
parser = Parser::PIR.new("willneverexist.org")
|
||||||
|
not_found = file_fixture("whois/willneverexist.org.txt").read
|
||||||
|
|
||||||
|
assert_raises DomainNotFoundError do
|
||||||
|
parser.parse(not_found)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
test "should raises InvalidDateError when a date is not parsable" do
|
||||||
|
parser = Parser::PIR.new("domain.org")
|
||||||
|
domain_com = file_fixture("whois/domain.org.txt").read
|
||||||
|
domain_com.gsub!("2018-04-02T03:47:23Z", "not a date")
|
||||||
|
|
||||||
|
assert_raises InvalidDateError do
|
||||||
|
parser.parse(domain_com)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
40
test/services/whois/parser/verisign_test.rb
Normal file
40
test/services/whois/parser/verisign_test.rb
Normal file
|
@ -0,0 +1,40 @@
|
||||||
|
require "test_helper"
|
||||||
|
require "whois/parser/verisign"
|
||||||
|
require "whois/response"
|
||||||
|
require "whois/errors"
|
||||||
|
|
||||||
|
module Whois
|
||||||
|
class VerisignTest < ActiveSupport::TestCase
|
||||||
|
test "should parse a whois response" do
|
||||||
|
parser = Parser::Verisign.new("domain.com")
|
||||||
|
domain_com = file_fixture("whois/domain.com.txt").read
|
||||||
|
response = parser.parse(domain_com)
|
||||||
|
assert_kind_of Response, response
|
||||||
|
|
||||||
|
assert_equal Time.new(1994, 7, 1, 4, 0, 0, 0), response.created_at
|
||||||
|
assert response.created_at.utc?
|
||||||
|
|
||||||
|
assert_equal Time.new(2018, 2, 13, 18, 33, 26, 0), response.updated_at
|
||||||
|
assert_equal Time.new(2021, 1, 7, 13, 34, 24, 0), response.expire_at
|
||||||
|
end
|
||||||
|
|
||||||
|
test "should raises DomainNotFoundError when domain is not registered" do
|
||||||
|
parser = Parser::Verisign.new("willneverexist.com")
|
||||||
|
not_found_com = file_fixture("whois/willneverexist.com.txt").read
|
||||||
|
|
||||||
|
assert_raises DomainNotFoundError do
|
||||||
|
parser.parse(not_found_com)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
test "should raises InvalidDateError when a date is not parsable" do
|
||||||
|
parser = Parser::Verisign.new("domain.com")
|
||||||
|
domain_com = file_fixture("whois/domain.com.txt").read
|
||||||
|
domain_com.gsub!("2018-02-13T18:33:26Z", "not a date")
|
||||||
|
|
||||||
|
assert_raises InvalidDateError do
|
||||||
|
parser.parse(domain_com)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
|
@ -4,9 +4,16 @@ require "whois/errors"
|
||||||
|
|
||||||
module Whois
|
module Whois
|
||||||
class ParserTest < ActiveSupport::TestCase
|
class ParserTest < ActiveSupport::TestCase
|
||||||
test "should instanciate a parser class matching the tld" do
|
test "should instanciate a parser class matching AFNIC tlds" do
|
||||||
assert_kind_of Parser::Fr, Parser.for("example.fr")
|
assert_kind_of Parser::AFNIC, Parser.for("example.fr")
|
||||||
|
end
|
||||||
|
|
||||||
|
test "should instanciate a parser class matching Verisign tlds" do
|
||||||
|
assert_kind_of Parser::Verisign, Parser.for("example.com")
|
||||||
|
assert_kind_of Parser::Verisign, Parser.for("example.net")
|
||||||
|
end
|
||||||
|
|
||||||
|
test "should raises an exception when a domain is not supported" do
|
||||||
assert_raises UnsupportedDomainError do
|
assert_raises UnsupportedDomainError do
|
||||||
Parser.for("example.xyz")
|
Parser.for("example.xyz")
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue