whois 4.0.8 → 4.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (69) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +11 -0
  3. data/.rspec +1 -0
  4. data/.simplecov +4 -0
  5. data/.travis.yml +27 -0
  6. data/CHANGELOG.md +9 -0
  7. data/Gemfile +5 -0
  8. data/LICENSE.txt +1 -1
  9. data/README.md +1 -1
  10. data/Rakefile +33 -0
  11. data/data/tld.json +21 -21
  12. data/lib/whois.rb +1 -1
  13. data/lib/whois/client.rb +1 -1
  14. data/lib/whois/errors.rb +1 -1
  15. data/lib/whois/record.rb +1 -1
  16. data/lib/whois/record/part.rb +1 -1
  17. data/lib/whois/server.rb +14 -2
  18. data/lib/whois/server/adapters/afilias.rb +1 -1
  19. data/lib/whois/server/adapters/arin.rb +1 -1
  20. data/lib/whois/server/adapters/arpa.rb +1 -1
  21. data/lib/whois/server/adapters/base.rb +1 -1
  22. data/lib/whois/server/adapters/formatted.rb +1 -1
  23. data/lib/whois/server/adapters/none.rb +1 -1
  24. data/lib/whois/server/adapters/not_implemented.rb +1 -1
  25. data/lib/whois/server/adapters/standard.rb +1 -1
  26. data/lib/whois/server/adapters/verisign.rb +1 -1
  27. data/lib/whois/server/adapters/web.rb +1 -1
  28. data/lib/whois/server/socket_handler.rb +1 -1
  29. data/lib/whois/version.rb +2 -2
  30. data/spec/fixtures/referrals/afilias.bz.txt +23 -0
  31. data/spec/fixtures/referrals/arin_referral_apnic.txt +78 -0
  32. data/spec/fixtures/referrals/arin_referral_missing.txt +52 -0
  33. data/spec/fixtures/referrals/arin_referral_ripe.txt +50 -0
  34. data/spec/fixtures/referrals/arin_referral_rwhois.txt +63 -0
  35. data/spec/fixtures/referrals/arin_referral_servernap.txt +63 -0
  36. data/spec/fixtures/referrals/arin_referral_whois.txt +56 -0
  37. data/spec/fixtures/referrals/crsnic.com.txt +60 -0
  38. data/spec/fixtures/referrals/crsnic.com_referral.txt +56 -0
  39. data/spec/fixtures/referrals/crsnic.com_referral_missing.txt +50 -0
  40. data/spec/integration/whois_spec.rb +73 -0
  41. data/spec/spec_helper.rb +24 -0
  42. data/spec/support/helpers/connectivity_helper.rb +15 -0
  43. data/spec/support/helpers/spec_helper.rb +31 -0
  44. data/spec/whois/client_spec.rb +144 -0
  45. data/spec/whois/errors_spec.rb +23 -0
  46. data/spec/whois/record/part_spec.rb +38 -0
  47. data/spec/whois/record_spec.rb +158 -0
  48. data/spec/whois/server/adapters/afilias_spec.rb +49 -0
  49. data/spec/whois/server/adapters/arin_spec.rb +84 -0
  50. data/spec/whois/server/adapters/arpa_spec.rb +20 -0
  51. data/spec/whois/server/adapters/base_spec.rb +150 -0
  52. data/spec/whois/server/adapters/formatted_spec.rb +53 -0
  53. data/spec/whois/server/adapters/none_spec.rb +23 -0
  54. data/spec/whois/server/adapters/not_implemented_spec.rb +24 -0
  55. data/spec/whois/server/adapters/standard_spec.rb +42 -0
  56. data/spec/whois/server/adapters/verisign_spec.rb +60 -0
  57. data/spec/whois/server/adapters/web_spec.rb +24 -0
  58. data/spec/whois/server/socket_handler_spec.rb +27 -0
  59. data/spec/whois/server_spec.rb +300 -0
  60. data/spec/whois/whois_spec.rb +15 -0
  61. data/tasks/spec.rake +199 -0
  62. data/utils/compare-whois.rb +30 -0
  63. data/utils/deftld.rb +231 -0
  64. data/utils/defutils.rb +26 -0
  65. data/utils/fixupd.rb +60 -0
  66. data/utils/matrix.rb +68 -0
  67. data/utils/mkwhois.rb +31 -0
  68. data/whois.gemspec +19 -32
  69. metadata +82 -5
@@ -0,0 +1,60 @@
1
+ Domain Name: GOOGLE.COM
2
+ Registry Domain ID: 2138514_DOMAIN_COM-VRSN
3
+ Registrar WHOIS Server: whois.markmonitor.com
4
+ Registrar URL: http://www.markmonitor.com
5
+ Updated Date: 2011-07-20T16:55:31Z
6
+ Creation Date: 1997-09-15T04:00:00Z
7
+ Registry Expiry Date: 2020-09-14T04:00:00Z
8
+ Registrar: MarkMonitor Inc.
9
+ Registrar IANA ID: 292
10
+ Registrar Abuse Contact Email: abusecomplaints@markmonitor.com
11
+ Registrar Abuse Contact Phone: +1.2083895740
12
+ Domain Status: clientDeleteProhibited https://icann.org/epp#clientDeleteProhibited
13
+ Domain Status: clientTransferProhibited https://icann.org/epp#clientTransferProhibited
14
+ Domain Status: clientUpdateProhibited https://icann.org/epp#clientUpdateProhibited
15
+ Domain Status: serverDeleteProhibited https://icann.org/epp#serverDeleteProhibited
16
+ Domain Status: serverTransferProhibited https://icann.org/epp#serverTransferProhibited
17
+ Domain Status: serverUpdateProhibited https://icann.org/epp#serverUpdateProhibited
18
+ Name Server: NS1.GOOGLE.COM
19
+ Name Server: NS2.GOOGLE.COM
20
+ Name Server: NS3.GOOGLE.COM
21
+ Name Server: NS4.GOOGLE.COM
22
+ DNSSEC: unsigned
23
+ URL of the ICANN Whois Inaccuracy Complaint Form: https://www.icann.org/wicf/
24
+ >>> Last update of whois database: 2017-07-27T09:05:12Z <<<
25
+
26
+ For more information on Whois status codes, please visit https://icann.org/epp
27
+
28
+ NOTICE: The expiration date displayed in this record is the date the
29
+ registrar's sponsorship of the domain name registration in the registry is
30
+ currently set to expire. This date does not necessarily reflect the expiration
31
+ date of the domain name registrant's agreement with the sponsoring
32
+ registrar. Users may consult the sponsoring registrar's Whois database to
33
+ view the registrar's reported date of expiration for this registration.
34
+
35
+ TERMS OF USE: You are not authorized to access or query our Whois
36
+ database through the use of electronic processes that are high-volume and
37
+ automated except as reasonably necessary to register domain names or
38
+ modify existing registrations; the Data in VeriSign Global Registry
39
+ Services' ("VeriSign") Whois database is provided by VeriSign for
40
+ information purposes only, and to assist persons in obtaining information
41
+ about or related to a domain name registration record. VeriSign does not
42
+ guarantee its accuracy. By submitting a Whois query, you agree to abide
43
+ by the following terms of use: You agree that you may use this Data only
44
+ for lawful purposes and that under no circumstances will you use this Data
45
+ to: (1) allow, enable, or otherwise support the transmission of mass
46
+ unsolicited, commercial advertising or solicitations via e-mail, telephone,
47
+ or facsimile; or (2) enable high volume, automated, electronic processes
48
+ that apply to VeriSign (or its computer systems). The compilation,
49
+ repackaging, dissemination or other use of this Data is expressly
50
+ prohibited without the prior written consent of VeriSign. You agree not to
51
+ use electronic processes that are automated and high-volume to access or
52
+ query the Whois database except as reasonably necessary to register
53
+ domain names or modify existing registrations. VeriSign reserves the right
54
+ to restrict your access to the Whois database in its sole discretion to ensure
55
+ operational stability. VeriSign may restrict or terminate your access to the
56
+ Whois database for failure to abide by these terms of use. VeriSign
57
+ reserves the right to modify these terms at any time.
58
+
59
+ The Registry database contains ONLY .COM, .NET, .EDU domains and
60
+ Registrars.
@@ -0,0 +1,56 @@
1
+ Domain Name: SIMONECARLETTI.COM
2
+ Registry Domain ID: 190944418_DOMAIN_COM-VRSN
3
+ Registrar WHOIS Server: whois.enom.com
4
+ Registrar URL: http://www.enom.com
5
+ Updated Date: 2017-06-30T07:40:47Z
6
+ Creation Date: 2005-07-29T18:06:26Z
7
+ Registry Expiry Date: 2018-07-29T18:06:26Z
8
+ Registrar: eNom, Inc.
9
+ Registrar IANA ID: 48
10
+ Registrar Abuse Contact Email:
11
+ Registrar Abuse Contact Phone:
12
+ Domain Status: clientTransferProhibited https://icann.org/epp#clientTransferProhibited
13
+ Name Server: NS1.DNSIMPLE.COM
14
+ Name Server: NS2.DNSIMPLE.COM
15
+ Name Server: NS3.DNSIMPLE.COM
16
+ Name Server: NS4.DNSIMPLE.COM
17
+ DNSSEC: signedDelegation
18
+ DNSSEC DS Data: 49279 8 2 2CA00478371FEA679FD902ECF47D4B2941383E460BA14FFCABBB160C14FEF369
19
+ URL of the ICANN Whois Inaccuracy Complaint Form: https://www.icann.org/wicf/
20
+ >>> Last update of whois database: 2017-07-27T09:06:28Z <<<
21
+
22
+ For more information on Whois status codes, please visit https://icann.org/epp
23
+
24
+ NOTICE: The expiration date displayed in this record is the date the
25
+ registrar's sponsorship of the domain name registration in the registry is
26
+ currently set to expire. This date does not necessarily reflect the expiration
27
+ date of the domain name registrant's agreement with the sponsoring
28
+ registrar. Users may consult the sponsoring registrar's Whois database to
29
+ view the registrar's reported date of expiration for this registration.
30
+
31
+ TERMS OF USE: You are not authorized to access or query our Whois
32
+ database through the use of electronic processes that are high-volume and
33
+ automated except as reasonably necessary to register domain names or
34
+ modify existing registrations; the Data in VeriSign Global Registry
35
+ Services' ("VeriSign") Whois database is provided by VeriSign for
36
+ information purposes only, and to assist persons in obtaining information
37
+ about or related to a domain name registration record. VeriSign does not
38
+ guarantee its accuracy. By submitting a Whois query, you agree to abide
39
+ by the following terms of use: You agree that you may use this Data only
40
+ for lawful purposes and that under no circumstances will you use this Data
41
+ to: (1) allow, enable, or otherwise support the transmission of mass
42
+ unsolicited, commercial advertising or solicitations via e-mail, telephone,
43
+ or facsimile; or (2) enable high volume, automated, electronic processes
44
+ that apply to VeriSign (or its computer systems). The compilation,
45
+ repackaging, dissemination or other use of this Data is expressly
46
+ prohibited without the prior written consent of VeriSign. You agree not to
47
+ use electronic processes that are automated and high-volume to access or
48
+ query the Whois database except as reasonably necessary to register
49
+ domain names or modify existing registrations. VeriSign reserves the right
50
+ to restrict your access to the Whois database in its sole discretion to ensure
51
+ operational stability. VeriSign may restrict or terminate your access to the
52
+ Whois database for failure to abide by these terms of use. VeriSign
53
+ reserves the right to modify these terms at any time.
54
+
55
+ The Registry database contains ONLY .COM, .NET, .EDU domains and
56
+ Registrars.
@@ -0,0 +1,50 @@
1
+
2
+ Whois Server Version 2.0
3
+
4
+ Domain names in the .com and .net domains can now be registered
5
+ with many different competing registrars. Go to http://www.internic.net
6
+ for detailed information.
7
+
8
+ Domain Name: VRSN-20100925-DNSSECMONITOR86.NET
9
+ Registrar: VERISIGN GLOBAL REGISTRY SERVICES TEST
10
+ Name Server: NS1.DNSSECTESTHOST.CC
11
+ Status: ok
12
+ Updated Date: 25-sep-2010
13
+ Creation Date: 25-sep-2010
14
+ Expiration Date: 25-sep-2011
15
+
16
+ >>> Last update of whois database: Thu, 04 Aug 2011 14:27:39 UTC <<<
17
+
18
+ NOTICE: The expiration date displayed in this record is the date the
19
+ registrar's sponsorship of the domain name registration in the registry is
20
+ currently set to expire. This date does not necessarily reflect the expiration
21
+ date of the domain name registrant's agreement with the sponsoring
22
+ registrar. Users may consult the sponsoring registrar's Whois database to
23
+ view the registrar's reported date of expiration for this registration.
24
+
25
+ TERMS OF USE: You are not authorized to access or query our Whois
26
+ database through the use of electronic processes that are high-volume and
27
+ automated except as reasonably necessary to register domain names or
28
+ modify existing registrations; the Data in VeriSign Global Registry
29
+ Services' ("VeriSign") Whois database is provided by VeriSign for
30
+ information purposes only, and to assist persons in obtaining information
31
+ about or related to a domain name registration record. VeriSign does not
32
+ guarantee its accuracy. By submitting a Whois query, you agree to abide
33
+ by the following terms of use: You agree that you may use this Data only
34
+ for lawful purposes and that under no circumstances will you use this Data
35
+ to: (1) allow, enable, or otherwise support the transmission of mass
36
+ unsolicited, commercial advertising or solicitations via e-mail, telephone,
37
+ or facsimile; or (2) enable high volume, automated, electronic processes
38
+ that apply to VeriSign (or its computer systems). The compilation,
39
+ repackaging, dissemination or other use of this Data is expressly
40
+ prohibited without the prior written consent of VeriSign. You agree not to
41
+ use electronic processes that are automated and high-volume to access or
42
+ query the Whois database except as reasonably necessary to register
43
+ domain names or modify existing registrations. VeriSign reserves the right
44
+ to restrict your access to the Whois database in its sole discretion to ensure
45
+ operational stability. VeriSign may restrict or terminate your access to the
46
+ Whois database for failure to abide by these terms of use. VeriSign
47
+ reserves the right to modify these terms at any time.
48
+
49
+ The Registry database contains ONLY .COM, .NET, .EDU domains and
50
+ Registrars.
@@ -0,0 +1,73 @@
1
+ require 'spec_helper'
2
+
3
+ describe Whois do
4
+
5
+ let(:response) { "Domain: example.it\nStatus: AVAILABLE\n" }
6
+
7
+ describe "Basic WHOIS querying and parsing" do
8
+ it "works" do
9
+ with_definitions do
10
+ Whois::Server.define(:tld, "it", "whois.nic.it")
11
+ expect(Whois::Server::Adapters::Standard.query_handler).to receive(:call)
12
+ .with("example.it", "whois.nic.it", 43)
13
+ .and_return(response)
14
+
15
+ record = Whois.lookup("example.it")
16
+
17
+ expect(record).to be_a(Whois::Record)
18
+ # expect(record.available?).to be_truthy
19
+ # expect(record.registered?).to be_falsey
20
+
21
+ # expect(record.parser).to be_a(Whois::Record::Parser)
22
+ # expect(record.parser.parsers.first).to be_a(Whois::Record::Parser::WhoisNicIt)
23
+ end
24
+ end
25
+ end
26
+
27
+ describe "Passing :bind_host and :bind_port options" do
28
+ it "binds the WHOIS query to given host and port" do
29
+ with_definitions do
30
+ Whois::Server.define(:tld, "it", "whois.nic.it")
31
+ expect(Whois::Server::Adapters::Standard.query_handler).to receive(:call)
32
+ .with("example.it", "whois.nic.it", 43, "192.168.1.1", 3000)
33
+ .and_return(response)
34
+
35
+ client = Whois::Client.new(:bind_host => "192.168.1.1", :bind_port => 3000)
36
+ client.lookup("example.it")
37
+ end
38
+ end
39
+ end
40
+
41
+ describe "Passing :bind_port options" do
42
+ it "binds the WHOIS query to given port and defaults host" do
43
+ with_definitions do
44
+ Whois::Server.define(:tld, "it", "whois.nic.it")
45
+ expect(Whois::Server::Adapters::Standard.query_handler).to receive(:call)
46
+ .with("example.it", "whois.nic.it", 43, Whois::Server::Adapters::Base::DEFAULT_BIND_HOST, 3000)
47
+ .and_return(response)
48
+
49
+ client = Whois::Client.new(:bind_port => 3000)
50
+ client.lookup("example.it")
51
+ end
52
+ end
53
+ end
54
+
55
+ describe "Passing :host options" do
56
+ it "forces the WHOIS query to given host" do
57
+ with_definitions do
58
+ Whois::Server.define(:tld, "it", "whois.nic.it")
59
+ expect(Whois::Server::Adapters::Standard.query_handler).to receive(:call)
60
+ .with("example.it", "whois.example.com", 43)
61
+ .and_return(response)
62
+
63
+ client = Whois::Client.new(:host => "whois.example.com")
64
+ record = client.lookup("example.it")
65
+
66
+ expect(record.parts.size).to eq(1)
67
+ expect(record.parts.first.body).to eq(response)
68
+ expect(record.parts.first.host).to eq("whois.example.com")
69
+ end
70
+ end
71
+ end
72
+
73
+ end
@@ -0,0 +1,24 @@
1
+ if ENV['COVERALL']
2
+ require 'coveralls'
3
+ Coveralls.wear!
4
+ end
5
+
6
+ require 'rspec'
7
+ require 'whois'
8
+
9
+ unless defined?(SPEC_ROOT)
10
+ SPEC_ROOT = File.expand_path("../", __FILE__)
11
+ end
12
+
13
+ # The fixtures are UTF-8 encoded.
14
+ # Make sure Ruby uses the proper encoding.
15
+ Encoding.default_external = Encoding::UTF_8
16
+ Encoding.default_internal = Encoding::UTF_8
17
+
18
+ # Requires supporting ruby files with custom matchers and macros, etc,
19
+ # in spec/support/ and its subdirectories.
20
+ Dir[File.join(SPEC_ROOT, "support/**/*.rb")].each { |f| require f }
21
+
22
+ RSpec.configure do |config|
23
+ config.mock_with :rspec
24
+ end
@@ -0,0 +1,15 @@
1
+ module RSpecSupportConnectivityHelpers
2
+ def need_connectivity
3
+ if connectivity_available?
4
+ yield
5
+ end
6
+ end
7
+
8
+ def connectivity_available?
9
+ ENV["ONLINE"].to_i == 1
10
+ end
11
+ end
12
+
13
+ RSpec.configure do |config|
14
+ config.extend RSpecSupportConnectivityHelpers
15
+ end
@@ -0,0 +1,31 @@
1
+ module RSpecSupportSpecHelpers
2
+
3
+ def fixture(*names)
4
+ File.join(SPEC_ROOT, "fixtures", *names)
5
+ end
6
+
7
+ private
8
+
9
+ # Temporary resets Server @@definitions
10
+ # to let the test setup a custom definition list.
11
+ def with_definitions
12
+ definitions_setup
13
+ yield
14
+ ensure
15
+ definitions_teardown
16
+ end
17
+
18
+ def definitions_setup
19
+ @_definitions = Whois::Server.send :instance_variable_get, :@definitions
20
+ Whois::Server.clear_definitions
21
+ end
22
+
23
+ def definitions_teardown
24
+ Whois::Server.send :instance_variable_set, :@definitions, @_definitions
25
+ end
26
+
27
+ end
28
+
29
+ RSpec.configure do |config|
30
+ config.include RSpecSupportSpecHelpers
31
+ end
@@ -0,0 +1,144 @@
1
+ require 'spec_helper'
2
+
3
+ describe Whois::Client do
4
+
5
+ describe "#initialize" do
6
+ it "accepts a zero parameters" do
7
+ expect { described_class.new }.to_not raise_error
8
+ end
9
+
10
+ it "accepts a settings parameter" do
11
+ expect { described_class.new({ foo: "bar" }) }.to_not raise_error
12
+ end
13
+
14
+
15
+ it "accepts a timeout setting with a value in seconds" do
16
+ client = described_class.new(timeout: 100)
17
+ expect(client.timeout).to eq(100)
18
+ end
19
+
20
+ it "accepts a timeout setting with a nil value" do
21
+ client = described_class.new(timeout: nil)
22
+ expect(client.timeout).to be_nil
23
+ end
24
+
25
+ it "accepts a block" do
26
+ described_class.new do |client|
27
+ expect(client).to be_instance_of(described_class)
28
+ end
29
+ end
30
+
31
+
32
+ it "defaults timeout setting to DEFAULT_TIMEOUT" do
33
+ client = described_class.new
34
+ expect(client.timeout).to eq(described_class::DEFAULT_TIMEOUT)
35
+ end
36
+
37
+ it "sets settings to given argument, except timeout" do
38
+ client = described_class.new(timeout: nil, foo: "bar")
39
+ expect(client.settings).to eq({ foo: "bar" })
40
+ end
41
+ end
42
+
43
+ describe "#lookup" do
44
+ it "converts the argument to string" do
45
+ query = ["example", ".", "test"]
46
+ query.instance_eval do
47
+ def to_s
48
+ join
49
+ end
50
+ end
51
+
52
+ server = Whois::Server::Adapters::Base.new(:tld, "test", "whois.test")
53
+ expect(server).to receive(:lookup).with("example.test")
54
+ expect(Whois::Server).to receive(:guess).with("example.test").and_return(server)
55
+
56
+ described_class.new.lookup(query)
57
+ end
58
+
59
+ it "converts the argument to downcase" do
60
+ server = Whois::Server::Adapters::Base.new(:tld, "test", "whois.test")
61
+ expect(server).to receive(:lookup).with("example.test")
62
+ expect(Whois::Server).to receive(:guess).with("example.test").and_return(server)
63
+
64
+ described_class.new.lookup("Example.TEST")
65
+ end
66
+
67
+ it "detects email" do
68
+ expect {
69
+ described_class.new.lookup("weppos@weppos.net")
70
+ }.to raise_error(Whois::ServerNotSupported)
71
+ end
72
+
73
+ it "works with domain with no whois" do
74
+ Whois::Server.define(:tld, "nowhois", nil, adapter: Whois::Server::Adapters::None)
75
+
76
+ expect {
77
+ described_class.new.lookup("domain.nowhois")
78
+ }.to raise_error(Whois::NoInterfaceError, /no whois server/)
79
+ end
80
+
81
+ it "works with domain with web whois" do
82
+ Whois::Server.define(:tld, "webwhois", nil, adapter: Whois::Server::Adapters::Web, url: "http://www.example.com/")
83
+
84
+ expect {
85
+ described_class.new.lookup("domain.webwhois")
86
+ }.to raise_error(Whois::WebInterfaceError, /www\.example\.com/)
87
+ end
88
+
89
+ it "raises if timeout is exceeded" do
90
+ adapter = Class.new(Whois::Server::Adapters::Base) do
91
+ def lookup(*)
92
+ sleep(2)
93
+ end
94
+ end
95
+ expect(Whois::Server).to receive(:guess).and_return(adapter.new(:tld, "test", "whois.test"))
96
+
97
+ client = described_class.new(timeout: 1)
98
+ expect {
99
+ client.lookup("example.test")
100
+ }.to raise_error(Timeout::Error)
101
+ end
102
+
103
+ it "does not raise if timeout is not exceeded" do
104
+ adapter = Class.new(Whois::Server::Adapters::Base) do
105
+ def lookup(*)
106
+ sleep(1)
107
+ end
108
+ end
109
+ expect(Whois::Server).to receive(:guess).and_return(adapter.new(:tld, "test", "whois.test"))
110
+
111
+ client = described_class.new(timeout: 5)
112
+ expect {
113
+ client.lookup("example.test")
114
+ }.to_not raise_error
115
+ end
116
+
117
+ it "supports unlimited timeout" do
118
+ adapter = Class.new(Whois::Server::Adapters::Base) do
119
+ def lookup(*)
120
+ sleep(1)
121
+ end
122
+ end
123
+ expect(Whois::Server).to receive(:guess).and_return(adapter.new(:tld, "test", "whois.test"))
124
+
125
+ client = described_class.new.tap { |c| c.timeout = nil }
126
+ expect {
127
+ client.lookup("example.test")
128
+ }.to_not raise_error
129
+ end
130
+
131
+ end
132
+
133
+ # FIXME: use RSpec metadata
134
+ need_connectivity do
135
+ describe "#query" do
136
+ it "sends a query for given domain" do
137
+ record = described_class.new.lookup("weppos.it")
138
+ assert record.match?(/Domain:\s+weppos\.it/)
139
+ assert record.match?(/Created:/)
140
+ end
141
+ end
142
+ end
143
+
144
+ end