whois 4.0.6 → 6.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (82) hide show
  1. checksums.yaml +4 -4
  2. data/.github/FUNDING.yml +12 -0
  3. data/.github/dependabot.yml +17 -0
  4. data/.github/workflows/release.yml +19 -0
  5. data/.github/workflows/tests.yml +29 -0
  6. data/.gitignore +11 -0
  7. data/.rspec +1 -0
  8. data/.rubocop.yml +27 -0
  9. data/.rubocop_opinionated.yml +115 -0
  10. data/.rubocop_todo.yml +89 -0
  11. data/.simplecov +6 -0
  12. data/.tool-versions +1 -0
  13. data/CHANGELOG.md +147 -44
  14. data/CONTRIBUTING.md +18 -6
  15. data/Gemfile +8 -0
  16. data/LICENSE.txt +1 -1
  17. data/README.md +4 -4
  18. data/Rakefile +28 -0
  19. data/SECURITY.md +24 -0
  20. data/bin/console +1 -0
  21. data/bin/whoisrb +6 -5
  22. data/data/ipv4.json +1 -3
  23. data/data/tld.json +125 -1049
  24. data/lib/whois/client.rb +5 -7
  25. data/lib/whois/errors.rb +4 -6
  26. data/lib/whois/record/part.rb +5 -6
  27. data/lib/whois/record.rb +5 -8
  28. data/lib/whois/server/adapters/afilias.rb +4 -5
  29. data/lib/whois/server/adapters/arin.rb +7 -8
  30. data/lib/whois/server/adapters/arpa.rb +19 -24
  31. data/lib/whois/server/adapters/base.rb +29 -46
  32. data/lib/whois/server/adapters/formatted.rb +4 -6
  33. data/lib/whois/server/adapters/none.rb +4 -6
  34. data/lib/whois/server/adapters/not_implemented.rb +4 -6
  35. data/lib/whois/server/adapters/standard.rb +4 -6
  36. data/lib/whois/server/adapters/verisign.rb +4 -5
  37. data/lib/whois/server/adapters/web.rb +4 -6
  38. data/lib/whois/server/socket_handler.rb +11 -12
  39. data/lib/whois/server.rb +73 -64
  40. data/lib/whois/version.rb +4 -2
  41. data/lib/whois.rb +32 -33
  42. data/spec/fixtures/referrals/afilias.bz.txt +23 -0
  43. data/spec/fixtures/referrals/arin_referral_apnic.txt +78 -0
  44. data/spec/fixtures/referrals/arin_referral_missing.txt +52 -0
  45. data/spec/fixtures/referrals/arin_referral_ripe.txt +50 -0
  46. data/spec/fixtures/referrals/arin_referral_rwhois.txt +63 -0
  47. data/spec/fixtures/referrals/arin_referral_servernap.txt +63 -0
  48. data/spec/fixtures/referrals/arin_referral_whois.txt +56 -0
  49. data/spec/fixtures/referrals/crsnic.com.txt +60 -0
  50. data/spec/fixtures/referrals/crsnic.com_referral.txt +56 -0
  51. data/spec/fixtures/referrals/crsnic.com_referral_missing.txt +50 -0
  52. data/spec/integration/whois_spec.rb +73 -0
  53. data/spec/spec_helper.rb +19 -0
  54. data/spec/support/helpers/connectivity_helper.rb +15 -0
  55. data/spec/support/helpers/spec_helper.rb +31 -0
  56. data/spec/whois/client_spec.rb +143 -0
  57. data/spec/whois/record/part_spec.rb +38 -0
  58. data/spec/whois/record_spec.rb +168 -0
  59. data/spec/whois/server/adapters/afilias_spec.rb +49 -0
  60. data/spec/whois/server/adapters/arin_spec.rb +83 -0
  61. data/spec/whois/server/adapters/arpa_spec.rb +29 -0
  62. data/spec/whois/server/adapters/base_spec.rb +155 -0
  63. data/spec/whois/server/adapters/formatted_spec.rb +53 -0
  64. data/spec/whois/server/adapters/none_spec.rb +23 -0
  65. data/spec/whois/server/adapters/not_implemented_spec.rb +24 -0
  66. data/spec/whois/server/adapters/standard_spec.rb +42 -0
  67. data/spec/whois/server/adapters/verisign_spec.rb +60 -0
  68. data/spec/whois/server/adapters/web_spec.rb +24 -0
  69. data/spec/whois/server/socket_handler_spec.rb +33 -0
  70. data/spec/whois/server_spec.rb +302 -0
  71. data/spec/whois/web_interface_error_spec.rb +23 -0
  72. data/spec/whois/whois_spec.rb +15 -0
  73. data/utils/compare-whois.rb +30 -0
  74. data/utils/deftld.rb +230 -0
  75. data/utils/defutils.rb +26 -0
  76. data/utils/fixupd.rb +60 -0
  77. data/utils/matrix.rb +68 -0
  78. data/utils/mkwhois.rb +31 -0
  79. data/whois.gemspec +19 -32
  80. metadata +58 -11
  81. data/4.0-Upgrade.md +0 -143
  82. data/bin/setup +0 -8
@@ -1,16 +1,17 @@
1
+ # frozen_string_literal: true
2
+
1
3
  #--
2
4
  # Ruby Whois
3
5
  #
4
6
  # An intelligent pure Ruby WHOIS client and parser.
5
7
  #
6
- # Copyright (c) 2009-2018 Simone Carletti <weppos@weppos.net>
8
+ # Copyright (c) 2009-2024 Simone Carletti <weppos@weppos.net>
7
9
  #++
8
10
 
9
11
 
10
12
  module Whois
11
13
  class Server
12
14
  module Adapters
13
-
14
15
  #
15
16
  # = Web Adapter
16
17
  #
@@ -21,7 +22,6 @@ module Whois
21
22
  # adapter, just a little bit more specific.
22
23
  #
23
24
  class Web < Base
24
-
25
25
  # Always raises a {Whois::WebInterfaceError} exception
26
26
  # including the web address for the WHOIS inteface.
27
27
  #
@@ -30,12 +30,10 @@ module Whois
30
30
  #
31
31
  # @raise [Whois::WebInterfaceError] For every request.
32
32
  #
33
- def request(string)
33
+ def request(_string)
34
34
  raise WebInterfaceError, options[:url]
35
35
  end
36
-
37
36
  end
38
-
39
37
  end
40
38
  end
41
39
  end
@@ -1,30 +1,30 @@
1
+ # frozen_string_literal: true
2
+
1
3
  #--
2
4
  # Ruby Whois
3
5
  #
4
6
  # An intelligent pure Ruby WHOIS client and parser.
5
7
  #
6
- # Copyright (c) 2009-2018 Simone Carletti <weppos@weppos.net>
8
+ # Copyright (c) 2009-2024 Simone Carletti <weppos@weppos.net>
7
9
  #++
8
10
 
9
11
 
10
- require 'socket'
11
- require 'whois/errors'
12
+ require "socket"
13
+ require "whois/errors"
12
14
 
13
15
 
14
16
  module Whois
15
17
  class Server
16
-
17
18
  # The SocketHandler is the default query handler provided with the
18
19
  # Whois library. It performs the WHOIS query using a synchronous
19
20
  # socket connection.
20
21
  class SocketHandler
21
-
22
22
  # Array of connection errors to rescue
23
23
  # and wrap into a {Whois::ConnectionError}
24
24
  RESCUABLE_CONNECTION_ERRORS = [
25
- SystemCallError,
26
- SocketError,
27
- ]
25
+ SystemCallError,
26
+ SocketError,
27
+ ].freeze
28
28
 
29
29
  # Performs the Socket request.
30
30
  #
@@ -36,8 +36,8 @@ module Whois
36
36
  #
37
37
  def call(query, *args)
38
38
  execute(query, *args)
39
- rescue *RESCUABLE_CONNECTION_ERRORS => error
40
- raise ConnectionError, "#{error.class}: #{error.message}"
39
+ rescue *RESCUABLE_CONNECTION_ERRORS => e
40
+ raise ConnectionError, "#{e.class}: #{e.message}"
41
41
  end
42
42
 
43
43
  # Executes the low-level Socket connection.
@@ -56,9 +56,8 @@ module Whois
56
56
  client.write("#{query}\r\n") # I could use put(foo) and forget the \n
57
57
  client.read # but write/read is more symmetric than puts/read
58
58
  ensure # and I really want to use read instead of gets.
59
- client.close if client # If != client something went wrong.
59
+ client&.close # If != client something went wrong.
60
60
  end
61
61
  end
62
-
63
62
  end
64
63
  end
data/lib/whois/server.rb CHANGED
@@ -1,53 +1,55 @@
1
+ # frozen_string_literal: true
2
+
1
3
  #--
2
4
  # Ruby Whois
3
5
  #
4
6
  # An intelligent pure Ruby WHOIS client and parser.
5
7
  #
6
- # Copyright (c) 2009-2018 Simone Carletti <weppos@weppos.net>
8
+ # Copyright (c) 2009-2024 Simone Carletti <weppos@weppos.net>
7
9
  #++
8
10
 
9
11
 
10
- require 'ipaddr'
11
- require 'json'
12
- require 'whois/server/adapters/base'
12
+ require "ipaddr"
13
+ require "json"
14
+ require "whois/server/adapters/base"
15
+ require "whois/server/adapters/arin"
16
+ require "whois/server/adapters/arpa"
17
+ require "whois/server/adapters/afilias"
18
+ require "whois/server/adapters/formatted"
19
+ require "whois/server/adapters/none"
20
+ require "whois/server/adapters/not_implemented"
21
+ require "whois/server/adapters/standard"
22
+ require "whois/server/adapters/verisign"
23
+ require "whois/server/adapters/web"
13
24
 
14
25
 
15
26
  module Whois
16
-
17
27
  # The {Whois::Server} class has two important roles:
18
28
  #
19
29
  # 1. it acts as a database for the WHOIS server definitions
20
30
  # 2. it is responsible for selecting the right adapter used to handle the query to the WHOIS server(s).
21
31
  #
22
32
  class Server
23
-
24
33
  # The {Whois::Server::Adapters} module is a namespace for all
25
34
  # WHOIS server adapters. Each adapter is a subclass of {Whois::Server::Adapters::Base},
26
35
  # customized to handle WHOIS queries for a type or a group of servers.
27
36
  module Adapters
28
- autoload :Base, "whois/server/adapters/base"
29
- autoload :Arin, "whois/server/adapters/arin"
30
- autoload :Arpa, "whois/server/adapters/arpa"
31
- autoload :Afilias, "whois/server/adapters/afilias"
32
- autoload :Formatted, "whois/server/adapters/formatted"
33
- autoload :None, "whois/server/adapters/none"
34
- autoload :NotImplemented, "whois/server/adapters/not_implemented"
35
- autoload :Standard, "whois/server/adapters/standard"
36
- autoload :Verisign, "whois/server/adapters/verisign"
37
- autoload :Web, "whois/server/adapters/web"
38
37
  end
39
38
 
40
39
  # @return [Array<Symbol>] the definition types
41
40
  TYPES = [
42
- TYPE_TLD = :tld,
43
- TYPE_IPV4 = :ipv4,
44
- TYPE_IPV6 = :ipv6,
45
- TYPE_ASN16 = :asn16,
46
- TYPE_ASN32 = :asn32,
41
+ TYPE_TLD = :tld,
42
+ TYPE_IPV4 = :ipv4,
43
+ TYPE_IPV6 = :ipv6,
44
+ TYPE_ASN16 = :asn16,
45
+ TYPE_ASN32 = :asn32,
47
46
  ].freeze
48
47
 
49
- class << self
48
+ # Empty hash constant used to save allocation for definitions with empty settings.
49
+ EMPTY_HASH = {}.freeze
50
+ private_constant :EMPTY_HASH
50
51
 
52
+ class << self
51
53
  # Clears the definition and reset them to an empty list.
52
54
  #
53
55
  # @return [void]
@@ -62,7 +64,7 @@ module Whois
62
64
  # @return [void]
63
65
  def load_definitions
64
66
  clear_definitions
65
- Dir[File.expand_path("../../../data/*.json", __FILE__)].each { |f| load_json(f) }
67
+ Dir[File.expand_path("../../data/*.json", __dir__)].each { |f| load_json(f) }
66
68
  end
67
69
 
68
70
  # Loads the definitions from a JSON file.
@@ -72,10 +74,18 @@ module Whois
72
74
  # @return [void]
73
75
  def load_json(file)
74
76
  type = File.basename(file, File.extname(file)).to_sym
75
- JSON.load(File.read(file)).each do |allocation, settings|
77
+ JSON.parse(File.read(file)).each do |allocation, settings|
76
78
  next if allocation == "_"
79
+
77
80
  settings.reject! { |k, _| k.start_with?("_") }
78
- define(type, allocation, settings.delete("host"), Hash[settings.map { |k,v| [k.to_sym, v] }])
81
+ host = settings.delete("host")
82
+ host = intern_string(host) if host
83
+ options = if settings.empty?
84
+ EMPTY_HASH
85
+ else
86
+ settings.to_h { |k, v| [k.to_sym, v.is_a?(String) ? intern_string(v) : v] }.freeze
87
+ end
88
+ define(type, allocation, host, options)
79
89
  end
80
90
  end
81
91
 
@@ -100,7 +110,7 @@ module Whois
100
110
  #
101
111
  def definitions(type)
102
112
  TYPES.include?(type) or
103
- raise(ArgumentError, "`#{type}` is not a valid definition type")
113
+ raise(ArgumentError, "`#{type}` is not a valid definition type")
104
114
 
105
115
  _definitions(type).values
106
116
  end
@@ -142,11 +152,11 @@ module Whois
142
152
  # :adapter => Whois::Server::Adapters::Web,
143
153
  # :url => "http://www.nic.ar/"
144
154
  #
145
- def define(type, allocation, host, options = {})
155
+ def define(type, allocation, host, options = EMPTY_HASH)
146
156
  TYPES.include?(type) or
147
- raise(ArgumentError, "`#{type}` is not a valid definition type")
157
+ raise(ArgumentError, "`#{type}` is not a valid definition type")
148
158
 
149
- _definitions(type)[allocation] = [allocation, host, options]
159
+ _definitions(type)[allocation] = [allocation, host, options.freeze]
150
160
  end
151
161
 
152
162
  # Creates a new server adapter from given arguments
@@ -222,19 +232,13 @@ module Whois
222
232
  # but the object type doesn't have any supported WHOIS adapter associated.
223
233
  def guess(string)
224
234
  # Top Level Domain match
225
- if matches_tld?(string)
226
- return factory(:tld, ".", "whois.iana.org")
227
- end
235
+ return factory(:tld, ".", "whois.iana.org") if matches_tld?(string)
228
236
 
229
237
  # IP address (secure match)
230
- if matches_ip?(string)
231
- return find_for_ip(string)
232
- end
238
+ return find_for_ip(string) if matches_ip?(string)
233
239
 
234
240
  # Email Address (secure match)
235
- if matches_email?(string)
236
- return find_for_email(string)
237
- end
241
+ return find_for_email(string) if matches_email?(string)
238
242
 
239
243
  # Domain Name match
240
244
  if (server = find_for_domain(string))
@@ -242,9 +246,7 @@ module Whois
242
246
  end
243
247
 
244
248
  # ASN match
245
- if matches_asn?(string)
246
- return find_for_asn(string)
247
- end
249
+ return find_for_asn(string) if matches_asn?(string)
248
250
 
249
251
  # Game Over
250
252
  raise ServerNotFound, "Unable to find a WHOIS server for `#{string}'"
@@ -263,13 +265,12 @@ module Whois
263
265
  begin
264
266
  ip = IPAddr.new(string)
265
267
  type = ip.ipv4? ? TYPE_IPV4 : TYPE_IPV6
266
- _definitions(type).each do |_, definition|
267
- if IPAddr.new(definition.first).include?(ip)
268
- return factory(type, *definition)
269
- end
268
+ _definitions(type).each_value do |definition|
269
+ return factory(type, *definition) if IPAddr.new(definition.first).include?(ip)
270
270
  end
271
271
  rescue ArgumentError
272
272
  # continue
273
+ nil
273
274
  end
274
275
  raise AllocationUnknown, "IP Allocation for `#{string}' unknown"
275
276
  end
@@ -279,7 +280,7 @@ module Whois
279
280
  # @param string [String]
280
281
  # @raise [Whois::ServerNotSupported]
281
282
  # emails are not supported.
282
- def find_for_email(string)
283
+ def find_for_email(_string)
283
284
  raise ServerNotSupported, "No WHOIS server is known for email objects"
284
285
  end
285
286
 
@@ -292,14 +293,14 @@ module Whois
292
293
  token = string
293
294
  defs = _definitions(TYPE_TLD)
294
295
 
295
- while token != "" do
296
+ while token != ""
296
297
  if (found = defs[token])
297
298
  return factory(:tld, *found)
298
299
  else
299
300
  index = token.index(".")
300
301
  break if index.nil?
301
302
 
302
- token = token[(index + 1)..-1]
303
+ token = token[(index + 1)..]
303
304
  end
304
305
  end
305
306
 
@@ -316,8 +317,8 @@ module Whois
316
317
  # that matches one of the existing server definitions.
317
318
  def find_for_asn(string)
318
319
  asn = string[/\d+/].to_i
319
- asn_type = asn <= 65535 ? TYPE_ASN16 : TYPE_ASN32
320
- _definitions(asn_type).each do |_, definition|
320
+ asn_type = asn <= 65_535 ? TYPE_ASN16 : TYPE_ASN32
321
+ _definitions(asn_type).each_value do |definition|
321
322
  if (range = definition.first.split.map(&:to_i)) && asn >= range.first && asn <= range.last
322
323
  return factory(asn_type, *definition)
323
324
  end
@@ -336,13 +337,22 @@ module Whois
336
337
  end
337
338
  end
338
339
 
340
+ if String.method_defined?(:-@)
341
+ def intern_string(string)
342
+ -string
343
+ end
344
+ else
345
+ def intern_string(string)
346
+ string.freeze
347
+ end
348
+ end
339
349
 
340
350
  def camelize(string)
341
351
  string.to_s.split("_").collect(&:capitalize).join
342
352
  end
343
353
 
344
354
  def matches_tld?(string)
345
- string =~ /^\.(xn--)?[a-z0-9]+$/
355
+ string.match?(/^\.(xn--)?[a-z0-9]+$/)
346
356
  end
347
357
 
348
358
  def matches_ip?(string)
@@ -350,36 +360,35 @@ module Whois
350
360
  end
351
361
 
352
362
  def matches_email?(string)
353
- string =~ /@/
363
+ string.include?("@")
354
364
  end
355
365
 
356
366
  def matches_asn?(string)
357
- string =~ /^as\d+$/i
367
+ string.match?(/^as\d+$/i)
358
368
  end
359
369
 
360
-
361
370
  def valid_ipv4?(addr)
362
- if /\A(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\Z/ =~ addr
363
- return $~.captures.all? {|i| i.to_i < 256}
371
+ if (m = /\A(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\Z/.match(addr))
372
+ return m.captures.all? { |i| i.to_i < 256 }
364
373
  end
374
+
365
375
  false
366
376
  end
367
377
 
368
378
  def valid_ipv6?(addr)
369
379
  # IPv6 (normal)
370
- return true if /\A[\dA-Fa-f]{1,4}(:[\dA-Fa-f]{1,4})*\Z/ =~ addr
371
- return true if /\A[\dA-Fa-f]{1,4}(:[\dA-Fa-f]{1,4})*::([\dA-Fa-f]{1,4}(:[\dA-Fa-f]{1,4})*)?\Z/ =~ addr
372
- return true if /\A::([\dA-Fa-f]{1,4}(:[\dA-Fa-f]{1,4})*)?\Z/ =~ addr
380
+ return true if addr.match?(/\A[\dA-Fa-f]{1,4}(:[\dA-Fa-f]{1,4})*\Z/)
381
+ return true if addr.match?(/\A[\dA-Fa-f]{1,4}(:[\dA-Fa-f]{1,4})*::([\dA-Fa-f]{1,4}(:[\dA-Fa-f]{1,4})*)?\Z/)
382
+ return true if addr.match?(/\A::([\dA-Fa-f]{1,4}(:[\dA-Fa-f]{1,4})*)?\Z/)
373
383
  # IPv6 (IPv4 compat)
374
- return true if /\A[\dA-Fa-f]{1,4}(:[\dA-Fa-f]{1,4})*:/ =~ addr && valid_ipv4?($')
375
- return true if /\A[\dA-Fa-f]{1,4}(:[\dA-Fa-f]{1,4})*::([\dA-Fa-f]{1,4}(:[\dA-Fa-f]{1,4})*:)?/ =~ addr && valid_ipv4?($')
376
- return true if /\A::([\dA-Fa-f]{1,4}(:[\dA-Fa-f]{1,4})*:)?/ =~ addr && valid_ipv4?($')
384
+ return true if /\A[\dA-Fa-f]{1,4}(:[\dA-Fa-f]{1,4})*:/ =~ addr && valid_ipv4?(Regexp.last_match.post_match)
385
+ return true if /\A[\dA-Fa-f]{1,4}(:[\dA-Fa-f]{1,4})*::([\dA-Fa-f]{1,4}(:[\dA-Fa-f]{1,4})*:)?/ =~ addr && valid_ipv4?(Regexp.last_match.post_match)
386
+ return true if /\A::([\dA-Fa-f]{1,4}(:[\dA-Fa-f]{1,4})*:)?/ =~ addr && valid_ipv4?(Regexp.last_match.post_match)
387
+
377
388
  false
378
389
  end
379
-
380
390
  end
381
391
  end
382
-
383
392
  end
384
393
 
385
394
  Whois::Server.load_definitions
data/lib/whois/version.rb CHANGED
@@ -1,13 +1,15 @@
1
+ # frozen_string_literal: true
2
+
1
3
  #--
2
4
  # Ruby Whois
3
5
  #
4
6
  # An intelligent pure Ruby WHOIS client and parser.
5
7
  #
6
- # Copyright (c) 2009-2018 Simone Carletti <weppos@weppos.net>
8
+ # Copyright (c) 2009-2024 Simone Carletti <weppos@weppos.net>
7
9
  #++
8
10
 
9
11
 
10
12
  module Whois
11
13
  # The current library version.
12
- VERSION = "4.0.6".freeze
14
+ VERSION = "6.0.3"
13
15
  end
data/lib/whois.rb CHANGED
@@ -1,23 +1,23 @@
1
+ # frozen_string_literal: true
2
+
1
3
  #--
2
4
  # Ruby Whois
3
5
  #
4
6
  # An intelligent pure Ruby WHOIS client and parser.
5
7
  #
6
- # Copyright (c) 2009-2018 Simone Carletti <weppos@weppos.net>
8
+ # Copyright (c) 2009-2024 Simone Carletti <weppos@weppos.net>
7
9
  #++
8
10
 
9
11
 
10
- require 'whois/version'
11
- require 'whois/errors'
12
- require 'whois/client'
13
- require 'whois/server'
14
- require 'whois/record'
12
+ require "whois/version"
13
+ require "whois/errors"
14
+ require "whois/client"
15
+ require "whois/server"
16
+ require "whois/record"
15
17
 
16
18
 
17
19
  module Whois
18
-
19
20
  class << self
20
-
21
21
  # Queries the WHOIS server for <tt>object</tt> and returns
22
22
  # the response from the server.
23
23
  #
@@ -35,21 +35,21 @@ module Whois
35
35
  Client.new.lookup(object)
36
36
  end
37
37
 
38
- alias_method :whois, :lookup
38
+ alias whois lookup
39
39
 
40
40
 
41
41
  # @deprecated
42
42
  def available?(object)
43
43
  unless defined? Whois::Parser
44
44
  warn("Whois.available? requires the gem `whois-parser`")
45
- return
45
+ return false
46
46
  end
47
47
 
48
- deprecate(%Q{Whois.available? is deprecated. Call Whois.whois("#{object}").available?})
48
+ deprecate(%{Whois.available? is deprecated. Call Whois.whois("#{object}").parser.available?})
49
49
 
50
50
  result = lookup(object).parser.available?
51
51
  if result.nil?
52
- warn "This method is not supported for this kind of object.\n" +
52
+ warn "This method is not supported for this kind of object.\n" \
53
53
  "Use Whois.lookup('#{object}') instead."
54
54
  end
55
55
  result
@@ -59,20 +59,20 @@ module Whois
59
59
  def registered?(object)
60
60
  unless defined? Whois::Parser
61
61
  warn("Whois.registered? requires the gem `whois-parser`")
62
- return
62
+ return false
63
63
  end
64
64
 
65
- deprecate(%Q{Whois.registered? is deprecated. Call Whois.whois("#{object}").available?})
65
+ deprecate(%{Whois.registered? is deprecated. Call Whois.whois("#{object}").parser.registered?})
66
66
 
67
67
  result = lookup(object).parser.registered?
68
68
  if result.nil?
69
- warn "This method is not supported for this kind of object.\n" +
69
+ warn "This method is not supported for this kind of object.\n" \
70
70
  "Use Whois.lookup('#{object}') instead."
71
71
  end
72
72
  result
73
73
  end
74
74
 
75
- def deprecate(message = nil, callstack = caller)
75
+ def deprecate(message = nil, _callstack = caller)
76
76
  # warn("DEPRECATION WARNING: #{message} #{deprecation_caller_message(callstack)}")
77
77
  warn("DEPRECATION WARNING: #{message}")
78
78
  end
@@ -87,9 +87,9 @@ module Whois
87
87
  # @api private
88
88
  # @private
89
89
  def bug!(error, message)
90
- raise error, message.dup <<
91
- " Please report the issue at" <<
92
- " http://github.com/weppos/whois/issues"
90
+ raise error, message.dup <<
91
+ " Please report the issue at " \
92
+ "http://github.com/weppos/whois/issues"
93
93
  end
94
94
 
95
95
 
@@ -97,26 +97,25 @@ module Whois
97
97
 
98
98
  def deprecation_caller_message(callstack)
99
99
  file, line, method = extract_callstack(callstack)
100
- if file
101
- if line && method
102
- "(called from #{method} at #{file}:#{line})"
103
- else
104
- "(called from #{file}:#{line})"
105
- end
100
+ return unless file
101
+
102
+ if line && method
103
+ "(called from #{method} at #{file}:#{line})"
104
+ else
105
+ "(called from #{file}:#{line})"
106
106
  end
107
107
  end
108
108
 
109
109
  def extract_callstack(callstack)
110
- gem_root = File.expand_path("../../../", __FILE__) + "/"
110
+ gem_root = "#{File.expand_path('../..', __dir__)}/"
111
111
  offending_line = callstack.find { |line| !line.start_with?(gem_root) } || callstack.first
112
- if offending_line
113
- if md = offending_line.match(/^(.+?):(\d+)(?::in `(.*?)')?/)
114
- md.captures
115
- else
116
- offending_line
117
- end
112
+ return unless offending_line
113
+
114
+ if (md = offending_line.match(/^(.+?):(\d+)(?::in `(.*?)')?/))
115
+ md.captures
116
+ else
117
+ offending_line
118
118
  end
119
119
  end
120
120
  end
121
-
122
121
  end
@@ -0,0 +1,23 @@
1
+ Domain Name: BELIZENIC.BZ
2
+ Registry Domain ID: D105800000000355891-AGRS
3
+ Registrar WHOIS Server: whois.belizenic.bz
4
+ Registrar URL:
5
+ Updated Date: 2017-04-11T20:43:07Z
6
+ Creation Date: 2001-04-30T19:00:00Z
7
+ Registry Expiry Date: 2018-04-30T19:00:00Z
8
+ Registrar Registration Expiration Date:
9
+ Registrar: University Management Limited
10
+ Registrar IANA ID: 800165
11
+ Registrar Abuse Contact Email:
12
+ Registrar Abuse Contact Phone:
13
+ Reseller:
14
+ Domain Status: ok https://icann.org/epp#ok
15
+ Name Server: NS1.BELIZENIC.BZ
16
+ Name Server: PIXIE.UCB.EDU.BZ
17
+ DNSSEC: unsigned
18
+ URL of the ICANN Whois Inaccuracy Complaint Form: https://www.icann.org/wicf/
19
+ >>> Last update of WHOIS database: 2017-07-27T16:49:05Z <<<
20
+
21
+ For more information on Whois status codes, please visit https://icann.org/epp
22
+
23
+ Access to WHOIS information is provided to assist persons in determining the contents of a domain name registration record in the registry database. The data in this record is provided by The Registry Operator for informational purposes only, and accuracy is not guaranteed. This service is intended only for query-based access. You agree that you will use this data only for lawful purposes and that, under no circumstances will you use this data to: (a) allow, enable, or otherwise support the transmission by e-mail, telephone, or facsimile of mass unsolicited, commercial advertising or solicitations to entities other than the data recipient's own existing customers; or (b) enable high volume, automated, electronic processes that send queries or data to the systems of Registry Operator, a Registrar, or Afilias except as reasonably necessary to register domain names or modify existing registrations. All rights reserved. Registry Operator reserves the right to modify these terms at any time. By submitting this query, you agree to abide by this policy.
@@ -0,0 +1,78 @@
1
+
2
+ #
3
+ # ARIN WHOIS data and services are subject to the Terms of Use
4
+ # available at: https://www.arin.net/whois_tou.html
5
+ #
6
+ # If you see inaccuracies in the results, please report at
7
+ # http://www.arin.net/public/whoisinaccuracy/index.xhtml
8
+ #
9
+
10
+
11
+ #
12
+ # Query terms are ambiguous. The query is assumed to be:
13
+ # "n 144.134.121.81"
14
+ #
15
+ # Use "?" to get help.
16
+ #
17
+
18
+ #
19
+ # The following results may also be obtained via:
20
+ # http://whois.arin.net/rest/nets;q=144.134.121.81?showDetails=true&showARIN=false&ext=netref2
21
+ #
22
+
23
+ NetRange: 144.130.0.0 - 144.140.255.255
24
+ CIDR: 144.132.0.0/14, 144.136.0.0/14, 144.130.0.0/15, 144.140.0.0/16
25
+ OriginAS:
26
+ NetName: APNIC-ERX-144-130-0-0
27
+ NetHandle: NET-144-130-0-0-1
28
+ Parent: NET-144-0-0-0-0
29
+ NetType: Early Registrations, Transferred to APNIC
30
+ Comment: This IP address range is not registered in the ARIN database.
31
+ Comment: This range was transferred to the APNIC Whois Database as
32
+ Comment: part of the ERX (Early Registration Transfer) project.
33
+ Comment: For details, refer to the APNIC Whois Database via
34
+ Comment: WHOIS.APNIC.NET or http://wq.apnic.net/apnic-bin/whois.pl
35
+ Comment:
36
+ Comment: ** IMPORTANT NOTE: APNIC is the Regional Internet Registry
37
+ Comment: for the Asia Pacific region. APNIC does not operate networks
38
+ Comment: using this IP address range and is not able to investigate
39
+ Comment: spam or abuse reports relating to these addresses. For more
40
+ Comment: help, refer to http://www.apnic.net/apnic-info/whois_search2/abuse-and-spamming
41
+ RegDate: 2004-01-07
42
+ Updated: 2009-10-08
43
+ Ref: http://whois.arin.net/rest/net/NET-144-130-0-0-1
44
+
45
+ OrgName: Asia Pacific Network Information Centre
46
+ OrgId: APNIC
47
+ Address: PO Box 3646
48
+ City: South Brisbane
49
+ StateProv: QLD
50
+ PostalCode: 4101
51
+ Country: AU
52
+ RegDate:
53
+ Updated: 2012-01-24
54
+ Ref: http://whois.arin.net/rest/org/APNIC
55
+
56
+ ReferralServer: whois://whois.apnic.net
57
+
58
+ OrgTechHandle: AWC12-ARIN
59
+ OrgTechName: APNIC Whois Contact
60
+ OrgTechPhone: +61 7 3858 3188
61
+ OrgTechEmail: search-apnic-not-arin@apnic.net
62
+ OrgTechRef: http://whois.arin.net/rest/poc/AWC12-ARIN
63
+
64
+ OrgAbuseHandle: AWC12-ARIN
65
+ OrgAbuseName: APNIC Whois Contact
66
+ OrgAbusePhone: +61 7 3858 3188
67
+ OrgAbuseEmail: search-apnic-not-arin@apnic.net
68
+ OrgAbuseRef: http://whois.arin.net/rest/poc/AWC12-ARIN
69
+
70
+
71
+ #
72
+ # ARIN WHOIS data and services are subject to the Terms of Use
73
+ # available at: https://www.arin.net/whois_tou.html
74
+ #
75
+ # If you see inaccuracies in the results, please report at
76
+ # http://www.arin.net/public/whoisinaccuracy/index.xhtml
77
+ #
78
+