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,26 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ args = ARGV
4
+ case command = args.shift
5
+
6
+ # Command retag-newgtld
7
+ when "retag-newgtld"
8
+ require 'open-uri'
9
+
10
+ tlds = []
11
+ count = 0
12
+ open("https://newgtlds.icann.org/newgtlds.csv").each_line do |line|
13
+ count += 1
14
+ next if count < 3
15
+ tlds << line.split(",", 2).first
16
+ end
17
+
18
+ puts "Updating #{tlds.size} newGTLDs..."
19
+ puts "utils/deftld.rb update #{tlds.join(" ")} --type newgtld"
20
+ puts `utils/deftld.rb update #{tlds.join(" ")} --type newgtld`
21
+
22
+ else
23
+ puts "Unknown command `#{command}`"
24
+ exit 1
25
+ end
26
+
@@ -0,0 +1,60 @@
1
+ #!/usr/bin/env ruby -w
2
+
3
+ $:.unshift(File.expand_path("../../lib", __FILE__))
4
+
5
+ require 'fileutils'
6
+ require 'net/https'
7
+ require 'uri'
8
+ require 'yaml'
9
+ require 'whois'
10
+
11
+ # SOURCE = "tlds.yml"
12
+ # defs = YAML.load_file(SOURCE)
13
+
14
+
15
+ SOURCE = "https://gist.github.com/weppos/3907123/raw/tlds.yml"
16
+ uri = URI.parse(SOURCE)
17
+ http = Net::HTTP.new(uri.host, uri.port)
18
+ http.use_ssl = true
19
+ http.verify_mode = OpenSSL::SSL::VERIFY_NONE # read into this
20
+ defs = YAML.load(http.get(uri.request_uri).body)
21
+
22
+ client = Whois::Client.new
23
+
24
+ defs.each do |tld, node|
25
+ fixtures = node.reject { |k,v| k.index("_") == 0 }
26
+ subdir = node["_subdir"] ? "/#{node["_subdir"]}" : ""
27
+ fixtures.each do |name, domain|
28
+ begin
29
+ record = client.lookup(domain)
30
+ part = record.parts.first
31
+ target = File.expand_path("../../spec/fixtures/responses/#{part.host}#{subdir}/#{name}.txt", __FILE__)
32
+ FileUtils.mkdir_p(File.dirname(target))
33
+ File.open(target, "w+") { |f| f.write(part.body) }
34
+ puts "Saved #{target}"
35
+ rescue => e
36
+ puts "Error for #{domain}: #{e.message}"
37
+ end
38
+ end
39
+ end
40
+
41
+
42
+ # skippable = {}
43
+ # defs.each do |tld, node|
44
+ # fixtures = node.reject { |k,v| k.index("_") == 0 }.reject { |k,v| node["_#{k}_skipdiff"].nil? }
45
+ # subdir = node["_subdir"] ? "/#{node["_subdir"]}" : ""
46
+ # fixtures.each do |name, domain|
47
+ # target = "spec/fixtures/responses/#{node["_server"]}#{subdir}/#{name}.txt"
48
+ # skippable[target] = node["_#{name}_skipdiff"]
49
+ # end
50
+ # end
51
+
52
+ # changes = `git status`.scan(/modified:\s+(.+)/).flatten
53
+ # changes.each do |path|
54
+ # next unless (alpha = skippable[path])
55
+ # beta = `git show HEAD~1:#{path} | diff - #{path}`.scan(/^(\d+)c\1/).flatten.map(&:to_i)
56
+ # if (alpha - beta) == []
57
+ # `git checkout #{path}`
58
+ # puts "Reset #{path}"
59
+ # end
60
+ # end
@@ -0,0 +1,68 @@
1
+ #!/usr/bin/env ruby -w
2
+
3
+ ROOT = File.expand_path("../..", __FILE__)
4
+ LIB = File.join(ROOT, "lib")
5
+
6
+ $:.unshift(LIB)
7
+
8
+ def pretty_state(state)
9
+ case state
10
+ when :supported then 'Y'
11
+ when :not_supported then 'N'
12
+ when :not_implemented then '.'
13
+ end
14
+ end
15
+
16
+ def matrix(hosts)
17
+ hosts.map do |host|
18
+ klass = P.parser_klass(host)
19
+ props = klass._properties
20
+ PROPERTIES.inject([host]) { |all, property| all << pretty_state(props[property]) }
21
+ end
22
+ end
23
+
24
+ def markdown_matrix(matrix, header: nil, formatter: ->(columns) { "| #{columns.join(" | ")} |" })
25
+ matrix = matrix.dup
26
+ length = matrix.inject(0) { |l, row| l = row[0].size > l ? row[0].size : l }
27
+ matrix.each { |row| row[0] = row[0].ljust(length) }
28
+
29
+ output = matrix.map(&formatter)
30
+ if header
31
+ string = formatter.(header)
32
+ output.unshift [string, string.gsub(/([^\|])/, "-")]
33
+ end
34
+ output.join("\n")
35
+ end
36
+
37
+
38
+ require 'whois'
39
+
40
+ P = Whois::Record::Parser
41
+ PROPERTIES = [:disclaimer, :domain, :domain_id, :status, :available?, :registered?, :created_on, :updated_on, :expires_on, :registrar, :registrant_contacts, :admin_contacts, :technical_contacts, :nameservers]
42
+
43
+ hosts = Dir.glob(File.join(LIB, "whois/record/parser/*.rb"))
44
+ .reject { |f| f =~ /\/(base|blank|example)/ }
45
+ .map { |f| File.basename(f, ".rb") }
46
+
47
+ pthin = %w(
48
+ whois.1und1.info
49
+ whois.ascio.com
50
+ whois.comlaude.com
51
+ whois.dreamhost.com
52
+ whois.enom.com
53
+ whois.gandi.net
54
+ whois.godaddy.com
55
+ whois.markmonitor.com
56
+ whois.networksolutions.com
57
+ whois.pairnic.com
58
+ whois.register.com
59
+ whois.rrpproxy.net
60
+ whois.schlund.info
61
+ whois.tucows.com
62
+ whois.udag.net
63
+ whois.yoursrs.com
64
+ )
65
+ ptlds = hosts - pthin
66
+
67
+ puts markdown_matrix(matrix(ptlds), header: ["parser"] + PROPERTIES)
68
+ puts markdown_matrix(matrix(pthin), header: ["parser"] + PROPERTIES)
@@ -0,0 +1,31 @@
1
+ #!/usr/bin/env ruby -w
2
+
3
+ # Usage:
4
+ #
5
+ # $ ./utils/mkwhois.rb google.com.br status_registered
6
+ #
7
+ # It will execute the query and dump the result into a file
8
+ # called status_registered.txt into the appriate folder based
9
+ # on the hostname that was queried, and the TLD.
10
+
11
+ $:.unshift(File.expand_path("../../lib", __FILE__))
12
+
13
+ require 'fileutils'
14
+ require 'whois'
15
+ begin
16
+ require File.expand_path("../whois-utf8", __FILE__)
17
+ rescue LoadError
18
+ end
19
+
20
+ d = ARGV.shift || raise("Missing domain")
21
+ n = ARGV.shift || raise("Missing file name")
22
+
23
+ r = Whois.lookup(d)
24
+ tld = r.server.allocation
25
+
26
+ r.parts.each do |part|
27
+ target = File.expand_path("../../spec/fixtures/responses/#{part.host}/#{tld}/#{n}.txt", __FILE__)
28
+ FileUtils.mkdir_p(File.dirname(target))
29
+ File.open(target, "w+") { |f| f.write(part.body) }
30
+ puts "#{target}"
31
+ end
@@ -1,39 +1,26 @@
1
1
  # -*- encoding: utf-8 -*-
2
- # stub: whois 4.0.7 ruby lib
2
+ $:.push File.expand_path('../lib', __FILE__)
3
+ require 'whois/version'
3
4
 
4
5
  Gem::Specification.new do |s|
5
- s.name = "whois".freeze
6
- s.version = "4.0.8"
6
+ s.name = 'whois'
7
+ s.version = Whois::VERSION
8
+ s.authors = ['Simone Carletti']
9
+ s.email = ['weppos@weppos.net']
10
+ s.homepage = 'https://whoisrb.org/'
11
+ s.summary = 'An intelligent pure Ruby WHOIS client and parser.'
12
+ s.description = 'Whois is an intelligent WHOIS client and parser written in pure Ruby. It can query registry data for IPv4, IPv6 and top level domains, and parse the responses into easy-to-use Ruby objects via the whois-parser library.'
13
+ s.license = 'MIT'
7
14
 
8
- s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
9
- s.require_paths = ["lib".freeze]
10
- s.authors = ["Simone Carletti".freeze]
11
- s.date = "2018-07-19"
12
- s.description = "Whois is an intelligent WHOIS client and parser written in pure Ruby. It can query registry data for IPv4, IPv6 and top level domains, and parse the responses into easy-to-use Ruby objects via the whois-parser library.".freeze
13
- s.email = ["weppos@weppos.net".freeze]
14
- s.executables = ["whoisrb".freeze]
15
- s.files = [".yardopts".freeze, "4.0-Upgrade.md".freeze, "CHANGELOG.md".freeze, "CONTRIBUTING.md".freeze, "LICENSE.txt".freeze, "README.md".freeze, "bin/console".freeze, "bin/setup".freeze, "bin/whoisrb".freeze, "data/asn16.json".freeze, "data/asn32.json".freeze, "data/ipv4.json".freeze, "data/ipv6.json".freeze, "data/tld.json".freeze, "lib/whois.rb".freeze, "lib/whois/client.rb".freeze, "lib/whois/errors.rb".freeze, "lib/whois/record.rb".freeze, "lib/whois/record/part.rb".freeze, "lib/whois/server.rb".freeze, "lib/whois/server/adapters/afilias.rb".freeze, "lib/whois/server/adapters/arin.rb".freeze, "lib/whois/server/adapters/arpa.rb".freeze, "lib/whois/server/adapters/base.rb".freeze, "lib/whois/server/adapters/formatted.rb".freeze, "lib/whois/server/adapters/none.rb".freeze, "lib/whois/server/adapters/not_implemented.rb".freeze, "lib/whois/server/adapters/standard.rb".freeze, "lib/whois/server/adapters/verisign.rb".freeze, "lib/whois/server/adapters/web.rb".freeze, "lib/whois/server/socket_handler.rb".freeze, "lib/whois/version.rb".freeze, "whois.gemspec".freeze]
16
- s.homepage = "https://whoisrb.org/".freeze
17
- s.licenses = ["MIT".freeze]
18
- s.required_ruby_version = Gem::Requirement.new(">= 2.0.0".freeze)
19
- s.rubygems_version = "2.7.3".freeze
20
- s.summary = "An intelligent pure Ruby WHOIS client and parser.".freeze
15
+ s.required_ruby_version = '>= 2.0.0'
21
16
 
22
- if s.respond_to? :specification_version then
23
- s.specification_version = 4
17
+ s.require_paths = %w( lib )
18
+ s.executables =%w( whoisrb )
19
+ s.files = `git ls-files`.split("\n")
20
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
21
+ s.extra_rdoc_files = %w( LICENSE.txt .yardopts )
24
22
 
25
- if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
26
- s.add_development_dependency(%q<rake>.freeze, [">= 0"])
27
- s.add_development_dependency(%q<rspec>.freeze, [">= 0"])
28
- s.add_development_dependency(%q<yard>.freeze, [">= 0"])
29
- else
30
- s.add_dependency(%q<rake>.freeze, [">= 0"])
31
- s.add_dependency(%q<rspec>.freeze, [">= 0"])
32
- s.add_dependency(%q<yard>.freeze, [">= 0"])
33
- end
34
- else
35
- s.add_dependency(%q<rake>.freeze, [">= 0"])
36
- s.add_dependency(%q<rspec>.freeze, [">= 0"])
37
- s.add_dependency(%q<yard>.freeze, [">= 0"])
38
- end
23
+ s.add_development_dependency "rake"
24
+ s.add_development_dependency "rspec"
25
+ s.add_development_dependency "yard"
39
26
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: whois
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.0.8
4
+ version: 4.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Simone Carletti
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-03-05 00:00:00.000000000 Z
11
+ date: 2019-04-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -60,14 +60,22 @@ email:
60
60
  executables:
61
61
  - whoisrb
62
62
  extensions: []
63
- extra_rdoc_files: []
63
+ extra_rdoc_files:
64
+ - LICENSE.txt
65
+ - ".yardopts"
64
66
  files:
67
+ - ".gitignore"
68
+ - ".rspec"
69
+ - ".simplecov"
70
+ - ".travis.yml"
65
71
  - ".yardopts"
66
72
  - 4.0-Upgrade.md
67
73
  - CHANGELOG.md
68
74
  - CONTRIBUTING.md
75
+ - Gemfile
69
76
  - LICENSE.txt
70
77
  - README.md
78
+ - Rakefile
71
79
  - bin/console
72
80
  - bin/setup
73
81
  - bin/whoisrb
@@ -94,6 +102,44 @@ files:
94
102
  - lib/whois/server/adapters/web.rb
95
103
  - lib/whois/server/socket_handler.rb
96
104
  - lib/whois/version.rb
105
+ - spec/fixtures/referrals/afilias.bz.txt
106
+ - spec/fixtures/referrals/arin_referral_apnic.txt
107
+ - spec/fixtures/referrals/arin_referral_missing.txt
108
+ - spec/fixtures/referrals/arin_referral_ripe.txt
109
+ - spec/fixtures/referrals/arin_referral_rwhois.txt
110
+ - spec/fixtures/referrals/arin_referral_servernap.txt
111
+ - spec/fixtures/referrals/arin_referral_whois.txt
112
+ - spec/fixtures/referrals/crsnic.com.txt
113
+ - spec/fixtures/referrals/crsnic.com_referral.txt
114
+ - spec/fixtures/referrals/crsnic.com_referral_missing.txt
115
+ - spec/integration/whois_spec.rb
116
+ - spec/spec_helper.rb
117
+ - spec/support/helpers/connectivity_helper.rb
118
+ - spec/support/helpers/spec_helper.rb
119
+ - spec/whois/client_spec.rb
120
+ - spec/whois/errors_spec.rb
121
+ - spec/whois/record/part_spec.rb
122
+ - spec/whois/record_spec.rb
123
+ - spec/whois/server/adapters/afilias_spec.rb
124
+ - spec/whois/server/adapters/arin_spec.rb
125
+ - spec/whois/server/adapters/arpa_spec.rb
126
+ - spec/whois/server/adapters/base_spec.rb
127
+ - spec/whois/server/adapters/formatted_spec.rb
128
+ - spec/whois/server/adapters/none_spec.rb
129
+ - spec/whois/server/adapters/not_implemented_spec.rb
130
+ - spec/whois/server/adapters/standard_spec.rb
131
+ - spec/whois/server/adapters/verisign_spec.rb
132
+ - spec/whois/server/adapters/web_spec.rb
133
+ - spec/whois/server/socket_handler_spec.rb
134
+ - spec/whois/server_spec.rb
135
+ - spec/whois/whois_spec.rb
136
+ - tasks/spec.rake
137
+ - utils/compare-whois.rb
138
+ - utils/deftld.rb
139
+ - utils/defutils.rb
140
+ - utils/fixupd.rb
141
+ - utils/matrix.rb
142
+ - utils/mkwhois.rb
97
143
  - whois.gemspec
98
144
  homepage: https://whoisrb.org/
99
145
  licenses:
@@ -114,8 +160,39 @@ required_rubygems_version: !ruby/object:Gem::Requirement
114
160
  - !ruby/object:Gem::Version
115
161
  version: '0'
116
162
  requirements: []
117
- rubygems_version: 3.0.2
163
+ rubygems_version: 3.0.3
118
164
  signing_key:
119
165
  specification_version: 4
120
166
  summary: An intelligent pure Ruby WHOIS client and parser.
121
- test_files: []
167
+ test_files:
168
+ - spec/fixtures/referrals/afilias.bz.txt
169
+ - spec/fixtures/referrals/arin_referral_apnic.txt
170
+ - spec/fixtures/referrals/arin_referral_missing.txt
171
+ - spec/fixtures/referrals/arin_referral_ripe.txt
172
+ - spec/fixtures/referrals/arin_referral_rwhois.txt
173
+ - spec/fixtures/referrals/arin_referral_servernap.txt
174
+ - spec/fixtures/referrals/arin_referral_whois.txt
175
+ - spec/fixtures/referrals/crsnic.com.txt
176
+ - spec/fixtures/referrals/crsnic.com_referral.txt
177
+ - spec/fixtures/referrals/crsnic.com_referral_missing.txt
178
+ - spec/integration/whois_spec.rb
179
+ - spec/spec_helper.rb
180
+ - spec/support/helpers/connectivity_helper.rb
181
+ - spec/support/helpers/spec_helper.rb
182
+ - spec/whois/client_spec.rb
183
+ - spec/whois/errors_spec.rb
184
+ - spec/whois/record/part_spec.rb
185
+ - spec/whois/record_spec.rb
186
+ - spec/whois/server/adapters/afilias_spec.rb
187
+ - spec/whois/server/adapters/arin_spec.rb
188
+ - spec/whois/server/adapters/arpa_spec.rb
189
+ - spec/whois/server/adapters/base_spec.rb
190
+ - spec/whois/server/adapters/formatted_spec.rb
191
+ - spec/whois/server/adapters/none_spec.rb
192
+ - spec/whois/server/adapters/not_implemented_spec.rb
193
+ - spec/whois/server/adapters/standard_spec.rb
194
+ - spec/whois/server/adapters/verisign_spec.rb
195
+ - spec/whois/server/adapters/web_spec.rb
196
+ - spec/whois/server/socket_handler_spec.rb
197
+ - spec/whois/server_spec.rb
198
+ - spec/whois/whois_spec.rb