mirror of
https://github.com/Evolix/chexpire.git
synced 2024-04-25 21:40:49 +02:00
Add Neustar registry for .us
This commit is contained in:
parent
f34f8e82f9
commit
f9c146acab
|
@ -6,11 +6,18 @@ require "whois/errors"
|
|||
require "whois/parser/afilias"
|
||||
require "whois/parser/afnic"
|
||||
require "whois/parser/cira"
|
||||
require "whois/parser/neustar"
|
||||
require "whois/parser/verisign"
|
||||
|
||||
module Whois
|
||||
module Parser
|
||||
PARSERS = [AFNIC, CIRA, Verisign, Afilias].freeze
|
||||
PARSERS = [
|
||||
Afilias,
|
||||
AFNIC,
|
||||
CIRA,
|
||||
Neustar,
|
||||
Verisign,
|
||||
].freeze
|
||||
|
||||
class << self
|
||||
def for(domain, logger: NullLogger.new)
|
||||
|
|
47
app/services/whois/parser/neustar.rb
Normal file
47
app/services/whois/parser/neustar.rb
Normal file
|
@ -0,0 +1,47 @@
|
|||
# Copyright (C) 2018 Colin Darie <colin@darie.eu>, 2018 Evolix <info@evolix.fr>
|
||||
# License: GNU AGPL-3+ (see full text in LICENSE file)
|
||||
|
||||
require "domain_helper"
|
||||
require "whois/errors"
|
||||
require_relative "base"
|
||||
|
||||
module Whois
|
||||
module Parser
|
||||
class Neustar < Base
|
||||
# https://www.about.us/
|
||||
SUPPORTED_TLD = %w[
|
||||
.us
|
||||
].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 Data Found")
|
||||
|
||||
extract_values
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def extract_values
|
||||
domain_index = get_field!("Domain Name", value: domain.downcase).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
|
124
test/fixtures/files/whois/domain.us.txt
vendored
Normal file
124
test/fixtures/files/whois/domain.us.txt
vendored
Normal file
|
@ -0,0 +1,124 @@
|
|||
% IANA WHOIS server
|
||||
% for more information on IANA, visit http://www.iana.org
|
||||
% This query returned 1 object
|
||||
|
||||
refer: whois.nic.us
|
||||
|
||||
domain: US
|
||||
|
||||
organisation: NeuStar, Inc.
|
||||
address: Loudoun Tech Center
|
||||
address: 46000 Center Oak Plaza
|
||||
address: Sterling Virginia 20166
|
||||
address: United States
|
||||
|
||||
contact: administrative
|
||||
name: Director
|
||||
organisation: NeuStar, Inc.
|
||||
address: 21575 Ridgetop Circle
|
||||
address: Sterling, VA 20166
|
||||
address: United States
|
||||
phone: +1 (844) 677-2878
|
||||
fax-no: +1 (571) 434-5401
|
||||
e-mail: technical1@registry.neustar
|
||||
|
||||
contact: technical
|
||||
name: Neustar Operations
|
||||
organisation: NeuStar, Inc.
|
||||
address: Loudoun Tech Center
|
||||
address: 46000 Center Oak Plaza
|
||||
address: Sterling Virginia 20166
|
||||
address: United States
|
||||
phone: +1 571 434 5487
|
||||
fax-no: +1 571 434 5401
|
||||
e-mail: registrytechnical2@neustar.biz
|
||||
|
||||
nserver: A.CCTLD.US 156.154.124.70
|
||||
nserver: B.CCTLD.US 156.154.125.70 2001:0502:ad09:0:0:0:0:29
|
||||
nserver: C.CCTLD.US 156.154.127.70
|
||||
nserver: E.CCTLD.US 156.154.126.70
|
||||
nserver: F.CCTLD.US 2001:500:3682:0:0:0:0:11 209.173.58.70
|
||||
nserver: K.CCTLD.US 156.154.128.70 2001:503:e239:0:0:0:3:1
|
||||
ds-rdata: 39361 8 1 09E0AF18E54225F87A3B10E95C9DA3F1E58E5B59
|
||||
ds-rdata: 39361 8 2 415D8DAE2299D2C2DAB7458ED4C715268CD2EB3AE3C1C249FF1696BF62112201
|
||||
|
||||
whois: whois.nic.us
|
||||
|
||||
status: ACTIVE
|
||||
remarks: Registration information: http://www.nic.us
|
||||
|
||||
created: 1985-02-15
|
||||
changed: 2018-09-25
|
||||
source: IANA
|
||||
|
||||
Domain Name: domain.us
|
||||
Registry Domain ID: D653294-US
|
||||
Registrar WHOIS Server:
|
||||
Registrar URL: www.neustarregistry.biz
|
||||
Updated Date: 2018-06-02T00:05:41Z
|
||||
Creation Date: 2002-04-18T15:36:40Z
|
||||
Registry Expiry Date: 2019-04-17T23:59:59Z
|
||||
Registrar: Neustar, Inc.
|
||||
Registrar IANA ID: 1111112
|
||||
Registrar Abuse Contact Email: reg-support@support.neustar
|
||||
Registrar Abuse Contact Phone:
|
||||
Domain Status: clientDeleteProhibited https://icann.org/epp#clientDeleteProhibited
|
||||
Domain Status: clientTransferProhibited https://icann.org/epp#clientTransferProhibited
|
||||
Domain Status: clientUpdateProhibited https://icann.org/epp#clientUpdateProhibited
|
||||
Domain Status: inactive https://icann.org/epp#inactive
|
||||
Registry Registrant ID: C37639215-US
|
||||
Registrant Name: .US Registration Policy
|
||||
Registrant Organization:
|
||||
Registrant Street: 46000 Center Oak Plaza
|
||||
Registrant Street:
|
||||
Registrant Street:
|
||||
Registrant City: Sterling
|
||||
Registrant State/Province: VA
|
||||
Registrant Postal Code: 20166
|
||||
Registrant Country: US
|
||||
Registrant Phone: +1.5714345728
|
||||
Registrant Phone Ext:
|
||||
Registrant Fax:
|
||||
Registrant Fax Ext:
|
||||
Registrant Email: support.us@neustar.us
|
||||
Registrant Application Purpose: P5
|
||||
Registrant Nexus Category: C21
|
||||
Registry Admin ID: C37639215-US
|
||||
Admin Name: .US Registration Policy
|
||||
Admin Organization:
|
||||
Admin Street: 46000 Center Oak Plaza
|
||||
Admin Street:
|
||||
Admin Street:
|
||||
Admin City: Sterling
|
||||
Admin State/Province: VA
|
||||
Admin Postal Code: 20166
|
||||
Admin Country: US
|
||||
Admin Phone: +1.5714345728
|
||||
Admin Phone Ext:
|
||||
Admin Fax:
|
||||
Admin Fax Ext:
|
||||
Admin Email: support.us@neustar.us
|
||||
Admin Application Purpose: P5
|
||||
Admin Nexus Category: C21
|
||||
Registry Tech ID: C37639215-US
|
||||
Tech Name: .US Registration Policy
|
||||
Tech Organization:
|
||||
Tech Street: 46000 Center Oak Plaza
|
||||
Tech Street:
|
||||
Tech Street:
|
||||
Tech City: Sterling
|
||||
Tech State/Province: VA
|
||||
Tech Postal Code: 20166
|
||||
Tech Country: US
|
||||
Tech Phone: +1.5714345728
|
||||
Tech Phone Ext:
|
||||
Tech Fax:
|
||||
Tech Fax Ext:
|
||||
Tech Email: support.us@neustar.us
|
||||
Tech Application Purpose: P5
|
||||
Tech Nexus Category: C21
|
||||
Name Server:
|
||||
DNSSEC: unsigned
|
||||
URL of the ICANN Whois Inaccuracy Complaint Form: https://www.icann.org/wicf/
|
||||
>>> Last update of WHOIS database: 2019-02-28T20:42:41Z <<<
|
||||
|
57
test/fixtures/files/whois/willneverexist.us.txt
vendored
Normal file
57
test/fixtures/files/whois/willneverexist.us.txt
vendored
Normal file
|
@ -0,0 +1,57 @@
|
|||
% IANA WHOIS server
|
||||
% for more information on IANA, visit http://www.iana.org
|
||||
% This query returned 1 object
|
||||
|
||||
refer: whois.nic.us
|
||||
|
||||
domain: US
|
||||
|
||||
organisation: NeuStar, Inc.
|
||||
address: Loudoun Tech Center
|
||||
address: 46000 Center Oak Plaza
|
||||
address: Sterling Virginia 20166
|
||||
address: United States
|
||||
|
||||
contact: administrative
|
||||
name: Director
|
||||
organisation: NeuStar, Inc.
|
||||
address: 21575 Ridgetop Circle
|
||||
address: Sterling, VA 20166
|
||||
address: United States
|
||||
phone: +1 (844) 677-2878
|
||||
fax-no: +1 (571) 434-5401
|
||||
e-mail: technical1@registry.neustar
|
||||
|
||||
contact: technical
|
||||
name: Neustar Operations
|
||||
organisation: NeuStar, Inc.
|
||||
address: Loudoun Tech Center
|
||||
address: 46000 Center Oak Plaza
|
||||
address: Sterling Virginia 20166
|
||||
address: United States
|
||||
phone: +1 571 434 5487
|
||||
fax-no: +1 571 434 5401
|
||||
e-mail: registrytechnical2@neustar.biz
|
||||
|
||||
nserver: A.CCTLD.US 156.154.124.70
|
||||
nserver: B.CCTLD.US 156.154.125.70 2001:0502:ad09:0:0:0:0:29
|
||||
nserver: C.CCTLD.US 156.154.127.70
|
||||
nserver: E.CCTLD.US 156.154.126.70
|
||||
nserver: F.CCTLD.US 2001:500:3682:0:0:0:0:11 209.173.58.70
|
||||
nserver: K.CCTLD.US 156.154.128.70 2001:503:e239:0:0:0:3:1
|
||||
ds-rdata: 39361 8 1 09E0AF18E54225F87A3B10E95C9DA3F1E58E5B59
|
||||
ds-rdata: 39361 8 2 415D8DAE2299D2C2DAB7458ED4C715268CD2EB3AE3C1C249FF1696BF62112201
|
||||
|
||||
whois: whois.nic.us
|
||||
|
||||
status: ACTIVE
|
||||
remarks: Registration information: http://www.nic.us
|
||||
|
||||
created: 1985-02-15
|
||||
changed: 2018-09-25
|
||||
source: IANA
|
||||
|
||||
No Data Found
|
||||
URL of the ICANN Whois Inaccuracy Complaint Form: https://www.icann.org/wicf/
|
||||
>>> Last update of WHOIS database: 2019-02-28T20:43:45Z <<<
|
||||
|
43
test/services/whois/parser/neustar_test.rb
Normal file
43
test/services/whois/parser/neustar_test.rb
Normal file
|
@ -0,0 +1,43 @@
|
|||
# Copyright (C) 2018 Colin Darie <colin@darie.eu>, 2018 Evolix <info@evolix.fr>
|
||||
# License: GNU AGPL-3+ (see full text in LICENSE file)
|
||||
|
||||
require "test_helper"
|
||||
require "whois/parser/neustar"
|
||||
require "whois/response"
|
||||
require "whois/errors"
|
||||
|
||||
module Whois
|
||||
class NeustarTest < ActiveSupport::TestCase
|
||||
test "should parse a whois response for .us" do
|
||||
parser = Parser::Neustar.new("domain.us")
|
||||
whois_output = file_fixture("whois/domain.us.txt").read
|
||||
response = parser.parse(whois_output)
|
||||
assert_kind_of Response, response
|
||||
|
||||
assert_equal Time.new(2002, 4, 18, 15, 36, 40, 0), response.created_at
|
||||
assert response.created_at.utc?
|
||||
|
||||
assert_equal Time.new(2018, 6, 2, 0, 5, 41, 0), response.updated_at
|
||||
assert_equal Time.new(2019, 4, 17, 23, 59, 59, 0), response.expire_at
|
||||
end
|
||||
|
||||
test "should raises DomainNotFoundError for .us when domain is not registered" do
|
||||
parser = Parser::Neustar.new("willneverexist.us")
|
||||
not_found = file_fixture("whois/willneverexist.us.txt").read
|
||||
|
||||
assert_raises DomainNotFoundError do
|
||||
parser.parse(not_found)
|
||||
end
|
||||
end
|
||||
|
||||
test "should raises InvalidDateError for .us when a date is not parsable" do
|
||||
parser = Parser::Neustar.new("domain.us")
|
||||
whois_output = file_fixture("whois/domain.us.txt").read
|
||||
whois_output.gsub!("2018-06-02T00:05:41Z", "not a date")
|
||||
|
||||
assert_raises InvalidDateError do
|
||||
parser.parse(whois_output)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Reference in a new issue