whois 5.0.1 → 5.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/FUNDING.yml +6 -2
- data/.github/dependabot.yml +19 -0
- data/.github/workflows/codeql-analysis.yml +64 -0
- data/.github/workflows/release.yml +16 -0
- data/.github/workflows/tests.yml +30 -0
- data/.rubocop.yml +27 -0
- data/.rubocop_opinionated.yml +135 -0
- data/.rubocop_todo.yml +166 -0
- data/.simplecov +2 -0
- data/.tool-versions +1 -0
- data/CHANGELOG.md +86 -54
- data/CONTRIBUTING.md +12 -12
- data/Gemfile +6 -1
- data/LICENSE.txt +1 -1
- data/README.md +22 -22
- data/Rakefile +12 -17
- data/bin/console +1 -0
- data/bin/whoisrb +4 -3
- data/data/ipv4.json +1 -3
- data/data/tld.json +10 -103
- data/lib/whois/client.rb +4 -2
- data/lib/whois/errors.rb +4 -2
- data/lib/whois/record/part.rb +5 -4
- data/lib/whois/record.rb +4 -2
- data/lib/whois/server/adapters/afilias.rb +4 -1
- data/lib/whois/server/adapters/arin.rb +7 -4
- data/lib/whois/server/adapters/arpa.rb +20 -19
- data/lib/whois/server/adapters/base.rb +26 -40
- data/lib/whois/server/adapters/formatted.rb +4 -2
- data/lib/whois/server/adapters/none.rb +3 -1
- data/lib/whois/server/adapters/not_implemented.rb +3 -1
- data/lib/whois/server/adapters/standard.rb +4 -2
- data/lib/whois/server/adapters/verisign.rb +4 -1
- data/lib/whois/server/adapters/web.rb +3 -1
- data/lib/whois/server/socket_handler.rb +8 -6
- data/lib/whois/server.rb +41 -47
- data/lib/whois/version.rb +4 -2
- data/lib/whois.rb +15 -13
- data/spec/integration/whois_spec.rb +7 -7
- data/spec/spec_helper.rb +4 -4
- data/spec/support/helpers/connectivity_helper.rb +3 -3
- data/spec/support/helpers/spec_helper.rb +2 -0
- data/spec/whois/client_spec.rb +8 -9
- data/spec/whois/record/part_spec.rb +4 -4
- data/spec/whois/record_spec.rb +11 -9
- data/spec/whois/server/adapters/afilias_spec.rb +4 -4
- data/spec/whois/server/adapters/arin_spec.rb +9 -10
- data/spec/whois/server/adapters/arpa_spec.rb +2 -2
- data/spec/whois/server/adapters/base_spec.rb +13 -13
- data/spec/whois/server/adapters/formatted_spec.rb +8 -8
- data/spec/whois/server/adapters/none_spec.rb +2 -2
- data/spec/whois/server/adapters/not_implemented_spec.rb +4 -4
- data/spec/whois/server/adapters/standard_spec.rb +5 -5
- data/spec/whois/server/adapters/verisign_spec.rb +5 -5
- data/spec/whois/server/adapters/web_spec.rb +4 -4
- data/spec/whois/server/socket_handler_spec.rb +7 -5
- data/spec/whois/server_spec.rb +31 -29
- data/spec/whois/{errors_spec.rb → web_interface_error_spec.rb} +4 -4
- data/spec/whois/whois_spec.rb +3 -3
- data/whois.gemspec +10 -10
- metadata +16 -11
- data/.travis.yml +0 -18
- data/bin/setup +0 -8
- data/tasks/spec.rake +0 -199
data/Rakefile
CHANGED
@@ -1,33 +1,28 @@
|
|
1
|
-
|
1
|
+
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require "bundler/gem_tasks"
|
3
4
|
|
4
|
-
|
5
|
-
task :default => :spec
|
6
|
-
task :test => :spec
|
5
|
+
task default: [:test, :rubocop]
|
7
6
|
|
8
7
|
|
9
|
-
require
|
8
|
+
require "rspec/core/rake_task"
|
10
9
|
|
11
10
|
RSpec::Core::RakeTask.new do |t|
|
12
11
|
t.verbose = !ENV["VERBOSE"].nil?
|
13
12
|
end
|
14
13
|
|
14
|
+
task test: :spec
|
15
15
|
|
16
|
-
require 'yard'
|
17
16
|
|
18
|
-
|
19
|
-
y.options = ["--output-dir", "yardoc"]
|
20
|
-
end
|
17
|
+
require "rubocop/rake_task"
|
21
18
|
|
22
|
-
|
23
|
-
task :clobber do
|
24
|
-
rm_r "yardoc" rescue nil
|
25
|
-
end
|
26
|
-
end
|
19
|
+
RuboCop::RakeTask.new
|
27
20
|
|
28
|
-
task :clobber => "yardoc:clobber"
|
29
21
|
|
22
|
+
require "yard/rake/yardoc_task"
|
30
23
|
|
31
|
-
|
32
|
-
|
24
|
+
YARD::Rake::YardocTask.new(:yardoc) do |y|
|
25
|
+
y.options = ["--output-dir", "yardoc"]
|
33
26
|
end
|
27
|
+
|
28
|
+
CLOBBER.include "yardoc"
|
data/bin/console
CHANGED
data/bin/whoisrb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
2
3
|
|
3
|
-
|
4
|
+
$LOAD_PATH.unshift(File.expand_path('../lib', __dir__))
|
4
5
|
|
5
6
|
require 'optparse'
|
6
7
|
require 'whois'
|
@@ -8,7 +9,7 @@ require 'whois'
|
|
8
9
|
|
9
10
|
options = {}
|
10
11
|
OptionParser.new do |opts|
|
11
|
-
opts.banner
|
12
|
+
opts.banner = "Whois: an intelligent pure Ruby WHOIS client"
|
12
13
|
opts.define_head "Usage: whoisrb [options] object"
|
13
14
|
opts.separator ""
|
14
15
|
opts.separator "Examples:"
|
@@ -46,7 +47,7 @@ OptionParser.new do |opts|
|
|
46
47
|
exit 1
|
47
48
|
end
|
48
49
|
|
49
|
-
if ARGV.
|
50
|
+
if ARGV.empty?
|
50
51
|
puts opts
|
51
52
|
exit 1
|
52
53
|
end
|
data/data/ipv4.json
CHANGED
data/data/tld.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"_": {
|
3
3
|
"schema": "2",
|
4
|
-
"updated": "
|
4
|
+
"updated": "2023-11-08 10:10:00 UTC"
|
5
5
|
},
|
6
6
|
"aaa": {
|
7
7
|
"_type": "newgtld",
|
@@ -654,11 +654,6 @@
|
|
654
654
|
"bn": {
|
655
655
|
"host": "whois.bnnic.bn"
|
656
656
|
},
|
657
|
-
"bnl": {
|
658
|
-
"_group": "afiliassrs",
|
659
|
-
"_type": "newgtld",
|
660
|
-
"host": "whois.nic.bnl"
|
661
|
-
},
|
662
657
|
"bnpparibas": {
|
663
658
|
"_group": "afiliassrs",
|
664
659
|
"_type": "newgtld",
|
@@ -927,10 +922,6 @@
|
|
927
922
|
"_type": "newgtld",
|
928
923
|
"host": "whois.uniregistry.net"
|
929
924
|
},
|
930
|
-
"cartier": {
|
931
|
-
"_type": "newgtld",
|
932
|
-
"adapter": "none"
|
933
|
-
},
|
934
925
|
"casa": {
|
935
926
|
"_group": "mmregistry",
|
936
927
|
"_type": "newgtld",
|
@@ -1071,11 +1062,6 @@
|
|
1071
1062
|
"_type": "newgtld",
|
1072
1063
|
"host": "whois.nic.google"
|
1073
1064
|
},
|
1074
|
-
"chrysler": {
|
1075
|
-
"_group": "afiliassrs",
|
1076
|
-
"_type": "newgtld",
|
1077
|
-
"host": "whois.afilias-srs.net"
|
1078
|
-
},
|
1079
1065
|
"church": {
|
1080
1066
|
"_group": "donuts",
|
1081
1067
|
"_type": "newgtld",
|
@@ -1694,11 +1680,6 @@
|
|
1694
1680
|
"_type": "newgtld",
|
1695
1681
|
"host": "whois.nic.doctor"
|
1696
1682
|
},
|
1697
|
-
"dodge": {
|
1698
|
-
"_group": "afiliassrs",
|
1699
|
-
"_type": "newgtld",
|
1700
|
-
"host": "whois.afilias-srs.net"
|
1701
|
-
},
|
1702
1683
|
"dog": {
|
1703
1684
|
"_group": "donuts",
|
1704
1685
|
"_type": "newgtld",
|
@@ -1744,10 +1725,6 @@
|
|
1744
1725
|
"_type": "newgtld",
|
1745
1726
|
"host": "whois.nic.dunlop"
|
1746
1727
|
},
|
1747
|
-
"duns": {
|
1748
|
-
"_type": "newgtld",
|
1749
|
-
"adapter": "none"
|
1750
|
-
},
|
1751
1728
|
"dupont": {
|
1752
1729
|
"_type": "newgtld",
|
1753
1730
|
"adapter": "none"
|
@@ -1900,10 +1877,6 @@
|
|
1900
1877
|
"_type": "newgtld",
|
1901
1878
|
"host": "whois.nic.events"
|
1902
1879
|
},
|
1903
|
-
"everbank": {
|
1904
|
-
"_type": "newgtld",
|
1905
|
-
"host": "whois.nic.everbank"
|
1906
|
-
},
|
1907
1880
|
"exchange": {
|
1908
1881
|
"_group": "donuts",
|
1909
1882
|
"_type": "newgtld",
|
@@ -2744,6 +2717,7 @@
|
|
2744
2717
|
"host": "whois.nic.hospital"
|
2745
2718
|
},
|
2746
2719
|
"host": {
|
2720
|
+
"_group": "centralnic",
|
2747
2721
|
"_type": "newgtld",
|
2748
2722
|
"host": "whois.nic.host"
|
2749
2723
|
},
|
@@ -2953,10 +2927,6 @@
|
|
2953
2927
|
"is": {
|
2954
2928
|
"host": "whois.isnic.is"
|
2955
2929
|
},
|
2956
|
-
"iselect": {
|
2957
|
-
"_type": "newgtld",
|
2958
|
-
"host": "whois.nic.iselect"
|
2959
|
-
},
|
2960
2930
|
"ismaili": {
|
2961
2931
|
"_group": "afiliassrs",
|
2962
2932
|
"_type": "newgtld",
|
@@ -3226,10 +3196,6 @@
|
|
3226
3196
|
"_type": "newgtld",
|
3227
3197
|
"host": "whois.nic.lacaixa"
|
3228
3198
|
},
|
3229
|
-
"ladbrokes": {
|
3230
|
-
"_type": "newgtld",
|
3231
|
-
"host": "whois.nic.ladbrokes"
|
3232
|
-
},
|
3233
3199
|
"lamborghini": {
|
3234
3200
|
"_group": "afiliassrs",
|
3235
3201
|
"_type": "newgtld",
|
@@ -3250,10 +3216,6 @@
|
|
3250
3216
|
"_type": "newgtld",
|
3251
3217
|
"host": "whois.afilias-srs.net"
|
3252
3218
|
},
|
3253
|
-
"lancome": {
|
3254
|
-
"_type": "newgtld",
|
3255
|
-
"host": "whois.nic.lancome"
|
3256
|
-
},
|
3257
3219
|
"land": {
|
3258
3220
|
"_group": "donuts",
|
3259
3221
|
"_type": "newgtld",
|
@@ -3343,10 +3305,6 @@
|
|
3343
3305
|
"li": {
|
3344
3306
|
"host": "whois.nic.li"
|
3345
3307
|
},
|
3346
|
-
"liaison": {
|
3347
|
-
"_type": "newgtld",
|
3348
|
-
"host": "whois.nic.liaison"
|
3349
|
-
},
|
3350
3308
|
"lidl": {
|
3351
3309
|
"_type": "newgtld",
|
3352
3310
|
"host": "whois.nic.lidl"
|
@@ -3742,10 +3700,6 @@
|
|
3742
3700
|
"_type": "newgtld",
|
3743
3701
|
"host": "whois.nic.mobile"
|
3744
3702
|
},
|
3745
|
-
"mobily": {
|
3746
|
-
"_type": "newgtld",
|
3747
|
-
"adapter": "none"
|
3748
|
-
},
|
3749
3703
|
"moda": {
|
3750
3704
|
"_group": "donuts",
|
3751
3705
|
"_type": "newgtld",
|
@@ -3783,11 +3737,6 @@
|
|
3783
3737
|
"_type": "newgtld",
|
3784
3738
|
"adapter": "none"
|
3785
3739
|
},
|
3786
|
-
"mopar": {
|
3787
|
-
"_group": "afiliassrs",
|
3788
|
-
"_type": "newgtld",
|
3789
|
-
"host": "whois.afilias-srs.net"
|
3790
|
-
},
|
3791
3740
|
"mormon": {
|
3792
3741
|
"_group": "afiliassrs",
|
3793
3742
|
"_type": "newgtld",
|
@@ -3821,11 +3770,6 @@
|
|
3821
3770
|
"_type": "newgtld",
|
3822
3771
|
"host": "whois.nic.movie"
|
3823
3772
|
},
|
3824
|
-
"movistar": {
|
3825
|
-
"_group": "knipp",
|
3826
|
-
"_type": "newgtld",
|
3827
|
-
"host": "whois-fe.movistar.tango.knipp.de"
|
3828
|
-
},
|
3829
3773
|
"mp": {
|
3830
3774
|
"adapter": "none"
|
3831
3775
|
},
|
@@ -4269,7 +4213,7 @@
|
|
4269
4213
|
"ovh": {
|
4270
4214
|
"_group": "nicfr",
|
4271
4215
|
"_type": "newgtld",
|
4272
|
-
"host": "whois
|
4216
|
+
"host": "whois.ovh.com"
|
4273
4217
|
},
|
4274
4218
|
"pa": {
|
4275
4219
|
"adapter": "web",
|
@@ -4383,10 +4327,6 @@
|
|
4383
4327
|
"_type": "newgtld",
|
4384
4328
|
"host": "whois.nic.physio"
|
4385
4329
|
},
|
4386
|
-
"piaget": {
|
4387
|
-
"_type": "newgtld",
|
4388
|
-
"adapter": "none"
|
4389
|
-
},
|
4390
4330
|
"pics": {
|
4391
4331
|
"_group": "uniregistry",
|
4392
4332
|
"_type": "newgtld",
|
@@ -5280,11 +5220,6 @@
|
|
5280
5220
|
"_type": "newgtld",
|
5281
5221
|
"host": "whois.afilias-srs.net"
|
5282
5222
|
},
|
5283
|
-
"srt": {
|
5284
|
-
"_group": "afiliassrs",
|
5285
|
-
"_type": "newgtld",
|
5286
|
-
"host": "whois.afilias-srs.net"
|
5287
|
-
},
|
5288
5223
|
"ss": {
|
5289
5224
|
"host": "whois.nic.ss"
|
5290
5225
|
},
|
@@ -5305,10 +5240,6 @@
|
|
5305
5240
|
"_type": "newgtld",
|
5306
5241
|
"host": "whois.nic.star"
|
5307
5242
|
},
|
5308
|
-
"starhub": {
|
5309
|
-
"_type": "newgtld",
|
5310
|
-
"host": "whois.nic.starhub"
|
5311
|
-
},
|
5312
5243
|
"statebank": {
|
5313
5244
|
"_group": "afiliassrs",
|
5314
5245
|
"_type": "newgtld",
|
@@ -5339,12 +5270,13 @@
|
|
5339
5270
|
"host": "whois.nic.storage"
|
5340
5271
|
},
|
5341
5272
|
"store": {
|
5273
|
+
"_group": "centralnic",
|
5342
5274
|
"_type": "newgtld",
|
5343
5275
|
"host": "whois.nic.store"
|
5344
5276
|
},
|
5345
5277
|
"stream": {
|
5346
5278
|
"_type": "newgtld",
|
5347
|
-
"
|
5279
|
+
"host": "whois.nic.stream"
|
5348
5280
|
},
|
5349
5281
|
"studio": {
|
5350
5282
|
"_group": "donuts",
|
@@ -5512,11 +5444,6 @@
|
|
5512
5444
|
"tel": {
|
5513
5445
|
"host": "whois.nic.tel"
|
5514
5446
|
},
|
5515
|
-
"telefonica": {
|
5516
|
-
"_group": "knipp",
|
5517
|
-
"_type": "newgtld",
|
5518
|
-
"host": "whois-fe.telefonica.tango.knipp.de"
|
5519
|
-
},
|
5520
5447
|
"temasek": {
|
5521
5448
|
"_group": "afiliassrs",
|
5522
5449
|
"_type": "newgtld",
|
@@ -5742,7 +5669,7 @@
|
|
5742
5669
|
"host": "whois.nic.tushu"
|
5743
5670
|
},
|
5744
5671
|
"tv": {
|
5745
|
-
"host": "
|
5672
|
+
"host": "whois.nic.tv",
|
5746
5673
|
"adapter": "verisign"
|
5747
5674
|
},
|
5748
5675
|
"tvs": {
|
@@ -5770,11 +5697,6 @@
|
|
5770
5697
|
"_type": "newgtld",
|
5771
5698
|
"host": "whois.nic.ubs"
|
5772
5699
|
},
|
5773
|
-
"uconnect": {
|
5774
|
-
"_group": "afiliassrs",
|
5775
|
-
"_type": "newgtld",
|
5776
|
-
"host": "whois.afilias-srs.net"
|
5777
|
-
},
|
5778
5700
|
"ug": {
|
5779
5701
|
"host": "whois.co.ug"
|
5780
5702
|
},
|
@@ -5824,8 +5746,9 @@
|
|
5824
5746
|
"host": "whois.nic.university"
|
5825
5747
|
},
|
5826
5748
|
"uno": {
|
5749
|
+
"_group": "centralnic",
|
5827
5750
|
"_type": "newgtld",
|
5828
|
-
"
|
5751
|
+
"host": "whois.nic.uno"
|
5829
5752
|
},
|
5830
5753
|
"uol": {
|
5831
5754
|
"_group": "nicbr",
|
@@ -5951,10 +5874,6 @@
|
|
5951
5874
|
"_type": "newgtld",
|
5952
5875
|
"host": "whois.nic.vision"
|
5953
5876
|
},
|
5954
|
-
"vistaprint": {
|
5955
|
-
"_type": "newgtld",
|
5956
|
-
"host": "whois.nic.vistaprint"
|
5957
|
-
},
|
5958
5877
|
"viva": {
|
5959
5878
|
"_group": "centralnic",
|
5960
5879
|
"_type": "newgtld",
|
@@ -6034,10 +5953,6 @@
|
|
6034
5953
|
"_type": "newgtld",
|
6035
5954
|
"host": "whois.nic.wanggou"
|
6036
5955
|
},
|
6037
|
-
"warman": {
|
6038
|
-
"_type": "newgtld",
|
6039
|
-
"host": "whois.nic.warman"
|
6040
|
-
},
|
6041
5956
|
"watch": {
|
6042
5957
|
"_group": "donuts",
|
6043
5958
|
"_type": "newgtld",
|
@@ -6064,6 +5979,7 @@
|
|
6064
5979
|
"host": "whois.nic.weber"
|
6065
5980
|
},
|
6066
5981
|
"website": {
|
5982
|
+
"_group": "centralnic",
|
6067
5983
|
"_type": "newgtld",
|
6068
5984
|
"host": "whois.nic.website"
|
6069
5985
|
},
|
@@ -6398,11 +6314,6 @@
|
|
6398
6314
|
"_type": "newgtld",
|
6399
6315
|
"host": "whois.nic.xn--efvy88h"
|
6400
6316
|
},
|
6401
|
-
"xn--estv75g": {
|
6402
|
-
"_group": "afiliassrs",
|
6403
|
-
"_type": "newgtld",
|
6404
|
-
"host": "whois.nic.xn--estv75g"
|
6405
|
-
},
|
6406
6317
|
"xn--fct429k": {
|
6407
6318
|
"_group": "amazonregistry",
|
6408
6319
|
"_type": "newgtld",
|
@@ -6577,10 +6488,6 @@
|
|
6577
6488
|
"adapter": "web",
|
6578
6489
|
"url": "http://idn.jo/whois_a.aspx"
|
6579
6490
|
},
|
6580
|
-
"xn--mgbb9fbpob": {
|
6581
|
-
"_type": "newgtld",
|
6582
|
-
"adapter": "none"
|
6583
|
-
},
|
6584
6491
|
"xn--mgbbh1a": {
|
6585
6492
|
"_type": "newgtld",
|
6586
6493
|
"host": "whois.registry.in"
|
@@ -6917,4 +6824,4 @@
|
|
6917
6824
|
"zw": {
|
6918
6825
|
"adapter": "none"
|
6919
6826
|
}
|
6920
|
-
}
|
6827
|
+
}
|
data/lib/whois/client.rb
CHANGED
@@ -1,9 +1,11 @@
|
|
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-
|
8
|
+
# Copyright (c) 2009-2022 Simone Carletti <weppos@weppos.net>
|
7
9
|
#++
|
8
10
|
|
9
11
|
|
@@ -88,7 +90,7 @@ module Whois
|
|
88
90
|
#
|
89
91
|
def lookup(object)
|
90
92
|
string = object.to_s.downcase
|
91
|
-
Timeout
|
93
|
+
Timeout.timeout(timeout) do
|
92
94
|
@server = Server.guess(string)
|
93
95
|
@server.configure(settings)
|
94
96
|
@server.lookup(string)
|
data/lib/whois/errors.rb
CHANGED
@@ -1,9 +1,11 @@
|
|
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-
|
8
|
+
# Copyright (c) 2009-2022 Simone Carletti <weppos@weppos.net>
|
7
9
|
#++
|
8
10
|
|
9
11
|
|
@@ -69,7 +71,7 @@ module Whois
|
|
69
71
|
|
70
72
|
# Raised when the class has found a server but it doesn't support the
|
71
73
|
# standard WHOIS interface via port 43. This is the case of some
|
72
|
-
# specific domains that only provide a web
|
74
|
+
# specific domains that only provide a web-based WHOIS interface. (\x01)
|
73
75
|
class WebInterfaceError < InterfaceNotSupported
|
74
76
|
|
75
77
|
# @return [String] The URL of the web-based WHOIS interface.
|
data/lib/whois/record/part.rb
CHANGED
@@ -1,9 +1,11 @@
|
|
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-
|
8
|
+
# Copyright (c) 2009-2022 Simone Carletti <weppos@weppos.net>
|
7
9
|
#++
|
8
10
|
|
9
11
|
|
@@ -20,12 +22,11 @@ module Whois
|
|
20
22
|
# @attr [String] body The body containing the WHOIS output.
|
21
23
|
# @attr [String] host The host which returned the body.
|
22
24
|
#
|
23
|
-
|
24
|
-
|
25
|
+
Part = Struct.new(:body, :host) do
|
25
26
|
def initialize(*args)
|
26
27
|
if args.first.is_a? Hash
|
27
28
|
initialize_with_hash(args.first)
|
28
|
-
elsif args.
|
29
|
+
elsif args.empty?
|
29
30
|
super
|
30
31
|
else
|
31
32
|
raise ArgumentError
|
data/lib/whois/record.rb
CHANGED
@@ -1,9 +1,11 @@
|
|
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-
|
8
|
+
# Copyright (c) 2009-2022 Simone Carletti <weppos@weppos.net>
|
7
9
|
#++
|
8
10
|
|
9
11
|
|
@@ -65,7 +67,7 @@ module Whois
|
|
65
67
|
end
|
66
68
|
end
|
67
69
|
|
68
|
-
|
70
|
+
alias eql? ==
|
69
71
|
|
70
72
|
|
71
73
|
# Invokes {#match} on record {#content}
|
@@ -1,9 +1,11 @@
|
|
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-
|
8
|
+
# Copyright (c) 2009-2022 Simone Carletti <weppos@weppos.net>
|
7
9
|
#++
|
8
10
|
|
9
11
|
|
@@ -40,6 +42,7 @@ module Whois
|
|
40
42
|
|
41
43
|
def extract_referral(response)
|
42
44
|
return unless (match = response.match(/Registrar WHOIS Server:(.+?)$/))
|
45
|
+
|
43
46
|
server = match[match.size - 1].strip
|
44
47
|
server.empty? ? nil : server
|
45
48
|
end
|
@@ -1,9 +1,11 @@
|
|
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-
|
8
|
+
# Copyright (c) 2009-2022 Simone Carletti <weppos@weppos.net>
|
7
9
|
#++
|
8
10
|
|
9
11
|
|
@@ -38,10 +40,11 @@ module Whois
|
|
38
40
|
private
|
39
41
|
|
40
42
|
def extract_referral(response)
|
41
|
-
return unless response =~
|
43
|
+
return unless response =~ %r{ReferralServer:\s*r?whois://([\w.-]+)(?::(\d+))?}
|
44
|
+
|
42
45
|
{
|
43
|
-
host:
|
44
|
-
port:
|
46
|
+
host: Regexp.last_match(1),
|
47
|
+
port: Regexp.last_match(2)&.to_i,
|
45
48
|
}
|
46
49
|
end
|
47
50
|
|
@@ -1,9 +1,11 @@
|
|
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-
|
8
|
+
# Copyright (c) 2009-2022 Simone Carletti <weppos@weppos.net>
|
7
9
|
#++
|
8
10
|
|
9
11
|
|
@@ -22,25 +24,24 @@ module Whois
|
|
22
24
|
|
23
25
|
private
|
24
26
|
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
27
|
+
# "127.1.168.192.in-addr.arpa" => "192.168.1.127"
|
28
|
+
# "1.168.192.in-addr.arpa" => "192.168.1.0"
|
29
|
+
# "168.192.in-addr.arpa" => "192.168.0.0"
|
30
|
+
# "192.in-addr.arpa" => "192.0.0.0"
|
31
|
+
# "in-addr.arpa" => "0.0.0.0"
|
32
|
+
def inaddr_to_ip(string)
|
33
|
+
raise ServerError, "Invalid .in-addr.arpa address" unless string.match?(/^([0-9]{1,3}\.?){0,4}in-addr\.arpa$/)
|
34
|
+
|
35
|
+
a, b, c, d = string.scan(/[0-9]{1,3}\./).reverse
|
36
|
+
[a, b, c, d].map do |token|
|
37
|
+
token = (token || 0).to_i
|
38
|
+
if token <= 255 && token >= 0
|
39
|
+
token
|
40
|
+
else
|
41
|
+
raise ServerError, "Invalid .in-addr.arpa token `#{token}'"
|
33
42
|
end
|
34
|
-
|
35
|
-
|
36
|
-
token = (token ||= 0).to_i
|
37
|
-
if token <= 255 && token >= 0
|
38
|
-
token
|
39
|
-
else
|
40
|
-
raise ServerError, "Invalid .in-addr.arpa token `#{token}'"
|
41
|
-
end
|
42
|
-
end.join(".")
|
43
|
-
end
|
43
|
+
end.join(".")
|
44
|
+
end
|
44
45
|
|
45
46
|
end
|
46
47
|
|