whois 2.4.0 → 2.5.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.rspec +0 -1
- data/Rakefile +25 -1
- data/lib/whois/definitions/tlds.rb +1 -1
- data/lib/whois/record/parser/base.rb +1 -1
- data/lib/whois/record/parser/base_afilias.rb +2 -2
- data/lib/whois/record/parser/jobswhois.verisign-grs.com.rb +1 -1
- data/lib/whois/record/parser/whois.audns.net.au.rb +81 -16
- data/lib/whois/record/parser/whois.biz.rb +1 -1
- data/lib/whois/record/parser/whois.cctld.by.rb +107 -0
- data/lib/whois/record/parser/whois.centralnic.com.rb +1 -1
- data/lib/whois/record/parser/whois.cira.ca.rb +103 -51
- data/lib/whois/record/parser/whois.cnnic.cn.rb +1 -1
- data/lib/whois/record/parser/whois.crsnic.net.rb +1 -1
- data/lib/whois/record/parser/whois.denic.de.rb +1 -1
- data/lib/whois/record/parser/whois.dns.hr.rb +2 -2
- data/lib/whois/record/parser/whois.domainregistry.ie.rb +77 -21
- data/lib/whois/record/parser/whois.domainregistry.my.rb +5 -8
- data/lib/whois/record/parser/whois.dreamhost.com.rb +1 -1
- data/lib/whois/record/parser/whois.enom.com.rb +124 -0
- data/lib/whois/record/parser/whois.fi.rb +1 -1
- data/lib/whois/record/parser/whois.iana.org.rb +1 -1
- data/lib/whois/record/parser/whois.nc.rb +2 -2
- data/lib/whois/record/parser/whois.nic.cc.rb +1 -1
- data/lib/whois/record/parser/whois.nic.hu.rb +1 -1
- data/lib/whois/record/parser/whois.nic.it.rb +1 -1
- data/lib/whois/record/parser/whois.nic.lk.rb +1 -1
- data/lib/whois/record/parser/whois.nic.tv.rb +1 -1
- data/lib/whois/record/parser/whois.registry.qa.rb +1 -1
- data/lib/whois/record/parser/whois.rnids.rs.rb +4 -4
- data/lib/whois/record/parser/whois.smallregistry.net.rb +1 -1
- data/lib/whois/record/parser/whois.tld.ee.rb +1 -1
- data/lib/whois/record/parser/whois.ua.rb +1 -1
- data/lib/whois/record/scanners/afilias.rb +60 -0
- data/lib/whois/record/scanners/ast.rb +67 -0
- data/lib/whois/record/scanners/base.rb +102 -0
- data/lib/whois/record/scanners/iana.rb +101 -0
- data/lib/whois/record/scanners/verisign.rb +112 -0
- data/lib/whois/record/scanners/whois.audns.net.au.rb +39 -0
- data/lib/whois/record/scanners/whois.biz.rb +47 -0
- data/lib/whois/record/scanners/whois.cctld.by.rb +46 -0
- data/lib/whois/record/scanners/whois.centralnic.com.rb +46 -0
- data/lib/whois/record/scanners/whois.cira.ca.rb +87 -0
- data/lib/whois/record/scanners/whois.cnnic.cn.rb +44 -0
- data/lib/whois/record/scanners/whois.denic.de.rb +122 -0
- data/lib/whois/record/scanners/whois.dns.hr.rb +39 -0
- data/lib/whois/record/scanners/whois.domainregistry.ie.rb +50 -0
- data/lib/whois/record/scanners/whois.nc.rb +46 -0
- data/lib/whois/record/scanners/whois.nic.hu.rb +178 -0
- data/lib/whois/record/scanners/whois.nic.it.rb +104 -0
- data/lib/whois/record/scanners/whois.registry.qa.rb +39 -0
- data/lib/whois/record/scanners/whois.rnids.rs.rb +75 -0
- data/lib/whois/record/scanners/whois.smallregistry.net.rb +61 -0
- data/lib/whois/record/scanners/whois.tld.ee.rb +50 -0
- data/lib/whois/version.rb +1 -1
- data/spec/fixtures/responses/whois.audns.net.au/status_available.expected +33 -0
- data/spec/fixtures/responses/whois.audns.net.au/status_registered.expected +53 -0
- data/spec/fixtures/responses/whois.cctld.by/status_available.expected +54 -0
- data/spec/fixtures/responses/whois.cctld.by/status_available.txt +1 -0
- data/spec/fixtures/responses/whois.cctld.by/status_registered.expected +64 -0
- data/spec/fixtures/responses/whois.cctld.by/status_registered.txt +11 -0
- data/spec/fixtures/responses/whois.cira.ca/{schema-2/property_status_autorenew_grace.expected → property_status_autorenew_grace.expected} +0 -0
- data/spec/fixtures/responses/whois.cira.ca/{schema-2/property_status_autorenew_grace.txt → property_status_autorenew_grace.txt} +0 -0
- data/spec/fixtures/responses/whois.cira.ca/{schema-2/property_status_available.expected → property_status_available.expected} +0 -0
- data/spec/fixtures/responses/whois.cira.ca/{schema-2/property_status_available.txt → property_status_available.txt} +0 -0
- data/spec/fixtures/responses/whois.cira.ca/{schema-2/property_status_redemption.expected → property_status_redemption.expected} +0 -0
- data/spec/fixtures/responses/whois.cira.ca/{schema-2/property_status_redemption.txt → property_status_redemption.txt} +0 -0
- data/spec/fixtures/responses/whois.cira.ca/{schema-2/property_status_registered.expected → property_status_registered.expected} +0 -0
- data/spec/fixtures/responses/whois.cira.ca/{schema-2/property_status_registered.txt → property_status_registered.txt} +0 -0
- data/spec/fixtures/responses/whois.cira.ca/{schema-2/property_status_tobereleased.expected → property_status_tobereleased.expected} +0 -0
- data/spec/fixtures/responses/whois.cira.ca/{schema-2/property_status_tobereleased.txt → property_status_tobereleased.txt} +0 -0
- data/spec/fixtures/responses/whois.cira.ca/{schema-2/property_status_unavailable.txt → property_status_unavailable.txt} +0 -0
- data/spec/fixtures/responses/whois.cira.ca/status_available.expected +64 -0
- data/spec/fixtures/responses/whois.cira.ca/{schema-2/status_available.txt → status_available.txt} +0 -0
- data/spec/fixtures/responses/whois.cira.ca/{schema-2/status_invalid.expected → status_invalid.expected} +0 -0
- data/spec/fixtures/responses/whois.cira.ca/{schema-2/status_invalid.txt → status_invalid.txt} +0 -0
- data/spec/fixtures/responses/whois.cira.ca/status_registered.expected +118 -0
- data/spec/fixtures/responses/whois.cira.ca/{schema-2/status_registered.txt → status_registered.txt} +11 -10
- data/spec/fixtures/responses/whois.domainregistry.ie/status_available.expected +34 -0
- data/spec/fixtures/responses/whois.domainregistry.ie/status_available.txt +2 -4
- data/spec/fixtures/responses/whois.domainregistry.ie/status_registered.expected +47 -1
- data/spec/fixtures/responses/whois.domainregistry.ie/status_registered.txt +5 -6
- data/spec/fixtures/responses/whois.enom.com/property_contacts_almost_empty.expected +31 -0
- data/spec/fixtures/responses/whois.enom.com/property_contacts_almost_empty.txt +61 -0
- data/spec/fixtures/responses/whois.enom.com/property_contacts_long_address.expected +15 -0
- data/spec/fixtures/responses/whois.enom.com/property_contacts_long_address.txt +67 -0
- data/spec/fixtures/responses/whois.enom.com/status_registered.expected +97 -0
- data/spec/fixtures/responses/whois.enom.com/status_registered.txt +68 -0
- data/spec/fixtures/responses/whois.nic.it/status_registered.expected +25 -25
- data/spec/whois/record/parser/responses/whois.audns.net.au/status_available_spec.rb +47 -0
- data/spec/whois/record/parser/responses/whois.audns.net.au/status_registered_spec.rb +67 -0
- data/spec/whois/record/parser/responses/whois.cctld.by/status_available_spec.rb +105 -0
- data/spec/whois/record/parser/responses/whois.cctld.by/status_registered_spec.rb +115 -0
- data/spec/whois/record/parser/responses/whois.cira.ca/{schema-2/property_status_autorenew_grace_spec.rb → property_status_autorenew_grace_spec.rb} +2 -2
- data/spec/whois/record/parser/responses/whois.cira.ca/{schema-2/property_status_available_spec.rb → property_status_available_spec.rb} +2 -2
- data/spec/whois/record/parser/responses/whois.cira.ca/{schema-2/property_status_redemption_spec.rb → property_status_redemption_spec.rb} +2 -2
- data/spec/whois/record/parser/responses/whois.cira.ca/{schema-2/property_status_registered_spec.rb → property_status_registered_spec.rb} +2 -2
- data/spec/whois/record/parser/responses/whois.cira.ca/{schema-2/property_status_tobereleased_spec.rb → property_status_tobereleased_spec.rb} +2 -2
- data/spec/whois/record/parser/responses/whois.cira.ca/{schema-2/status_available_spec.rb → status_available_spec.rb} +45 -2
- data/spec/whois/record/parser/responses/whois.cira.ca/{schema-2/status_invalid_spec.rb → status_invalid_spec.rb} +2 -2
- data/spec/whois/record/parser/responses/whois.cira.ca/status_registered_spec.rb +172 -0
- data/spec/whois/record/parser/responses/whois.domainregistry.ie/status_available_spec.rb +48 -0
- data/spec/whois/record/parser/responses/whois.domainregistry.ie/status_registered_spec.rb +61 -1
- data/spec/whois/record/parser/responses/whois.enom.com/property_contacts_almost_empty_spec.rb +60 -0
- data/spec/whois/record/parser/responses/whois.enom.com/property_contacts_long_address_spec.rb +42 -0
- data/spec/whois/record/parser/responses/whois.enom.com/status_registered_spec.rb +140 -0
- data/spec/whois/record/parser/responses/whois.nic.it/status_registered_spec.rb +25 -25
- data/whois.gemspec +8 -7
- metadata +101 -61
- data/lib/whois/record/parser/scanners/afilias.rb +0 -66
- data/lib/whois/record/parser/scanners/ast.rb +0 -69
- data/lib/whois/record/parser/scanners/base.rb +0 -85
- data/lib/whois/record/parser/scanners/iana.rb +0 -108
- data/lib/whois/record/parser/scanners/verisign.rb +0 -122
- data/lib/whois/record/parser/scanners/whois.biz.rb +0 -49
- data/lib/whois/record/parser/scanners/whois.centralnic.com.rb +0 -52
- data/lib/whois/record/parser/scanners/whois.cnnic.cn.rb +0 -46
- data/lib/whois/record/parser/scanners/whois.denic.de.rb +0 -124
- data/lib/whois/record/parser/scanners/whois.dns.hr.rb +0 -41
- data/lib/whois/record/parser/scanners/whois.nc.rb +0 -48
- data/lib/whois/record/parser/scanners/whois.nic.hu.rb +0 -180
- data/lib/whois/record/parser/scanners/whois.nic.it.rb +0 -111
- data/lib/whois/record/parser/scanners/whois.registry.qa.rb +0 -41
- data/lib/whois/record/parser/scanners/whois.rnids.rs.rb +0 -78
- data/lib/whois/record/parser/scanners/whois.smallregistry.net.rb +0 -62
- data/lib/whois/record/parser/scanners/whois.tld.ee.rb +0 -52
- data/spec/fixtures/responses/whois.cira.ca/schema-1/status_available.expected +0 -27
- data/spec/fixtures/responses/whois.cira.ca/schema-1/status_available.txt +0 -9
- data/spec/fixtures/responses/whois.cira.ca/schema-1/status_registered.expected +0 -46
- data/spec/fixtures/responses/whois.cira.ca/schema-1/status_registered.txt +0 -47
- data/spec/fixtures/responses/whois.cira.ca/schema-2/status_available.expected +0 -34
- data/spec/fixtures/responses/whois.cira.ca/schema-2/status_registered.expected +0 -48
- data/spec/whois/record/parser/responses/whois.cira.ca/schema-1/status_available_spec.rb +0 -65
- data/spec/whois/record/parser/responses/whois.cira.ca/schema-1/status_registered_spec.rb +0 -84
- data/spec/whois/record/parser/responses/whois.cira.ca/schema-2/status_registered_spec.rb +0 -89
@@ -0,0 +1,101 @@
|
|
1
|
+
#--
|
2
|
+
# Ruby Whois
|
3
|
+
#
|
4
|
+
# An intelligent pure Ruby WHOIS client and parser.
|
5
|
+
#
|
6
|
+
# Copyright (c) 2009-2012 Simone Carletti <weppos@weppos.net>
|
7
|
+
#++
|
8
|
+
|
9
|
+
|
10
|
+
require 'whois/record/scanners/base'
|
11
|
+
|
12
|
+
|
13
|
+
module Whois
|
14
|
+
class Record
|
15
|
+
module Scanners
|
16
|
+
|
17
|
+
class Iana < Base
|
18
|
+
|
19
|
+
self.tokenizers += [
|
20
|
+
:skip_empty_line,
|
21
|
+
:scan_disclaimer,
|
22
|
+
:scan_section,
|
23
|
+
]
|
24
|
+
|
25
|
+
|
26
|
+
tokenizer :scan_disclaimer do
|
27
|
+
if @input.match?(/^\%(.*?)\n/)
|
28
|
+
@ast["Disclaimer"] = _scan_lines_to_array(/\%(.*?)\n/).select { |line| line =~ /\w+/ }.join(" ")
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
tokenizer :scan_section do
|
33
|
+
if @input.scan(/^(.+):(.+)\n/)
|
34
|
+
|
35
|
+
# Adapt the section's name depending on the first line
|
36
|
+
section = case @input[1].strip
|
37
|
+
when 'contact'
|
38
|
+
@input[2].strip # use the contact type name as identifier
|
39
|
+
when 'created', 'changed'
|
40
|
+
'dates'
|
41
|
+
when 'nserver'
|
42
|
+
'nameservers'
|
43
|
+
else
|
44
|
+
@input[1].strip # Default name is the first label found
|
45
|
+
end
|
46
|
+
|
47
|
+
content = parse_section_pairs
|
48
|
+
@input.match?(/\n+/) || error("Unexpected end of section")
|
49
|
+
@ast[section] = content
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
|
54
|
+
private
|
55
|
+
|
56
|
+
def parse_section_pairs
|
57
|
+
# Sets by default the firsts values found in the section parsing bellow
|
58
|
+
section_name, section_value = @input[1].strip, @input[2].strip
|
59
|
+
#contents = {section_name => section_value}
|
60
|
+
|
61
|
+
contents = {}
|
62
|
+
|
63
|
+
while content = parse_section_pair
|
64
|
+
contents.merge!(content)
|
65
|
+
end
|
66
|
+
|
67
|
+
if contents.has_key? section_name
|
68
|
+
contents[section_name].insert(0, "#{section_value}\n")
|
69
|
+
else
|
70
|
+
contents[section_name] = section_value
|
71
|
+
end
|
72
|
+
|
73
|
+
if !contents.empty?
|
74
|
+
contents
|
75
|
+
else
|
76
|
+
false
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
def parse_section_pair
|
81
|
+
if @input.scan(/^(.+):\s*(.+)\n/)
|
82
|
+
key = @input[1].strip
|
83
|
+
values = [@input[2].strip]
|
84
|
+
|
85
|
+
while value = parse_section_pair_newlinevalue(key)
|
86
|
+
values << value
|
87
|
+
end
|
88
|
+
{ key => values.join("\n") }
|
89
|
+
end
|
90
|
+
end
|
91
|
+
|
92
|
+
def parse_section_pair_newlinevalue(key)
|
93
|
+
if @input.scan(/^#{key}:\s*(.+)\n/)
|
94
|
+
@input[1].strip
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|
98
|
+
end
|
99
|
+
end
|
100
|
+
end
|
101
|
+
end
|
@@ -0,0 +1,112 @@
|
|
1
|
+
#--
|
2
|
+
# Ruby Whois
|
3
|
+
#
|
4
|
+
# An intelligent pure Ruby WHOIS client and parser.
|
5
|
+
#
|
6
|
+
# Copyright (c) 2009-2012 Simone Carletti <weppos@weppos.net>
|
7
|
+
#++
|
8
|
+
|
9
|
+
|
10
|
+
require 'whois/record/scanners/base'
|
11
|
+
|
12
|
+
|
13
|
+
module Whois
|
14
|
+
class Record
|
15
|
+
module Scanners
|
16
|
+
|
17
|
+
class Verisign < Base
|
18
|
+
|
19
|
+
self.tokenizers += [
|
20
|
+
:skip_empty_line,
|
21
|
+
:scan_response_unavailable,
|
22
|
+
:scan_available,
|
23
|
+
:scan_disclaimer,
|
24
|
+
:scan_notice,
|
25
|
+
:scan_keyvalue_indented,
|
26
|
+
:skip_ianaservice,
|
27
|
+
:skip_lastupdate,
|
28
|
+
:skip_fuffa,
|
29
|
+
]
|
30
|
+
|
31
|
+
|
32
|
+
tokenizer :scan_response_unavailable do
|
33
|
+
# Check if the string starts with /*
|
34
|
+
# If it does, match until the end of all /* lines
|
35
|
+
# or the end of the file and check for the content.
|
36
|
+
#
|
37
|
+
# Flag the block as visited to force the scanner to ignore this tokenizer
|
38
|
+
# if already used and the content didn't match the unavailable message.
|
39
|
+
if @input.match?(/^\*\n/) && !visited?
|
40
|
+
p = /^[^\*]|\z/
|
41
|
+
y = @input.check_until(p) =~ /^\* Sorry, the Whois database is currently down/
|
42
|
+
|
43
|
+
if y
|
44
|
+
@input.skip_until(p)
|
45
|
+
@ast["response:unavailable"] = true
|
46
|
+
else
|
47
|
+
visited!
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
tokenizer :scan_available do
|
53
|
+
if @input.scan(/No match for "(.+?)"\.\n/)
|
54
|
+
@ast["Domain Name"] = @input[1].strip
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
tokenizer :scan_disclaimer do
|
59
|
+
if @input.match?(/^TERMS OF USE:/)
|
60
|
+
@ast["Disclaimer"] = _scan_lines_to_array(/(.+)\n/).join(" ")
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
tokenizer :scan_notice do
|
65
|
+
if @input.match?(/^NOTICE:/)
|
66
|
+
@ast["Notice"] = _scan_lines_to_array(/(.+)\n/).join(" ")
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
tokenizer :scan_keyvalue_indented do
|
71
|
+
if @input.scan(/\s+(.+?):(.*?)\n/)
|
72
|
+
key, value = @input[1].strip, @input[2].strip
|
73
|
+
if @ast[key].nil?
|
74
|
+
@ast[key] = value
|
75
|
+
else
|
76
|
+
@ast[key] = [@ast[key]] unless @ast[key].is_a?(Array)
|
77
|
+
@ast[key] << value
|
78
|
+
end
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
tokenizer :skip_lastupdate do
|
83
|
+
@input.skip(/>>>(.+?)<<<\n/)
|
84
|
+
end
|
85
|
+
|
86
|
+
tokenizer :skip_fuffa do
|
87
|
+
@input.scan(/^\S(.+)(?:\n|\z)/)
|
88
|
+
end
|
89
|
+
|
90
|
+
tokenizer :skip_ianaservice do
|
91
|
+
if @input.match?(/IANA Whois Service/)
|
92
|
+
@ast["IANA"] = true
|
93
|
+
@input.terminate
|
94
|
+
end
|
95
|
+
end
|
96
|
+
|
97
|
+
private
|
98
|
+
|
99
|
+
def visited?
|
100
|
+
!!@tmp["visited:#{@input.pos}"]
|
101
|
+
end
|
102
|
+
|
103
|
+
def visited!
|
104
|
+
@tmp["visited:#{@input.pos}"] = true
|
105
|
+
nil
|
106
|
+
end
|
107
|
+
|
108
|
+
end
|
109
|
+
|
110
|
+
end
|
111
|
+
end
|
112
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
#--
|
2
|
+
# Ruby Whois
|
3
|
+
#
|
4
|
+
# An intelligent pure Ruby WHOIS client and parser.
|
5
|
+
#
|
6
|
+
# Copyright (c) 2009-2012 Simone Carletti <weppos@weppos.net>
|
7
|
+
#++
|
8
|
+
|
9
|
+
|
10
|
+
require 'whois/record/scanners/base'
|
11
|
+
|
12
|
+
|
13
|
+
module Whois
|
14
|
+
class Record
|
15
|
+
module Scanners
|
16
|
+
|
17
|
+
# Scanner for the whois.audns.net.au record.
|
18
|
+
#
|
19
|
+
# @since 2.5.0
|
20
|
+
class WhoisAudnsNetAu < Base
|
21
|
+
|
22
|
+
self.tokenizers += [
|
23
|
+
:skip_empty_line,
|
24
|
+
:scan_available,
|
25
|
+
:scan_keyvalue,
|
26
|
+
]
|
27
|
+
|
28
|
+
|
29
|
+
tokenizer :scan_available do
|
30
|
+
if @input.skip(/^No Data Found\n/)
|
31
|
+
@ast["status:available"] = true
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
end
|
36
|
+
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
#--
|
2
|
+
# Ruby Whois
|
3
|
+
#
|
4
|
+
# An intelligent pure Ruby WHOIS client and parser.
|
5
|
+
#
|
6
|
+
# Copyright (c) 2009-2012 Simone Carletti <weppos@weppos.net>
|
7
|
+
#++
|
8
|
+
|
9
|
+
|
10
|
+
require 'whois/record/scanners/base'
|
11
|
+
|
12
|
+
|
13
|
+
module Whois
|
14
|
+
class Record
|
15
|
+
module Scanners
|
16
|
+
|
17
|
+
class WhoisBiz < Base
|
18
|
+
|
19
|
+
self.tokenizers += [
|
20
|
+
:skip_empty_line,
|
21
|
+
:scan_available,
|
22
|
+
:scan_keyvalue,
|
23
|
+
:skip_lastupdate,
|
24
|
+
:skip_fuffa,
|
25
|
+
]
|
26
|
+
|
27
|
+
|
28
|
+
tokenizer :scan_available do
|
29
|
+
if @input.scan(/^Not found: (.+)\n/)
|
30
|
+
@ast["Domain Name"] = @input[1]
|
31
|
+
@ast["status:available"] = true
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
tokenizer :skip_lastupdate do
|
36
|
+
@input.skip(/>>>(.+?)<<<\n/)
|
37
|
+
end
|
38
|
+
|
39
|
+
tokenizer :skip_fuffa do
|
40
|
+
@input.scan(/^\S(.+)\n/)
|
41
|
+
end
|
42
|
+
|
43
|
+
end
|
44
|
+
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
#--
|
2
|
+
# Ruby Whois
|
3
|
+
#
|
4
|
+
# An intelligent pure Ruby WHOIS client and parser.
|
5
|
+
#
|
6
|
+
# Copyright (c) 2009-2012 Simone Carletti <weppos@weppos.net>
|
7
|
+
#++
|
8
|
+
|
9
|
+
require 'whois/record/scanners/base'
|
10
|
+
|
11
|
+
module Whois
|
12
|
+
class Record
|
13
|
+
module Scanners
|
14
|
+
|
15
|
+
# Scanner for the whois.cctld.by server.
|
16
|
+
#
|
17
|
+
# @author Aliaksei Kliuchnikau <aliaksei.kliuchnikau@gmail.com>
|
18
|
+
# @since 2.5.0
|
19
|
+
class WhoisCctldBy < Base
|
20
|
+
|
21
|
+
self.tokenizers += [
|
22
|
+
:skip_empty_line,
|
23
|
+
:skip_dash_line,
|
24
|
+
:scan_available,
|
25
|
+
:scan_keyvalue,
|
26
|
+
:skip_provider_signature,
|
27
|
+
]
|
28
|
+
|
29
|
+
tokenizer :scan_available do
|
30
|
+
if @input.skip(/^Object does not exist/)
|
31
|
+
@ast["status:available"] = true
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
tokenizer :skip_dash_line do
|
36
|
+
@input.skip(/^-+\n/)
|
37
|
+
end
|
38
|
+
|
39
|
+
tokenizer :skip_provider_signature do
|
40
|
+
@input.scan(/^(.+)\n/)
|
41
|
+
end
|
42
|
+
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
#--
|
2
|
+
# Ruby Whois
|
3
|
+
#
|
4
|
+
# An intelligent pure Ruby WHOIS client and parser.
|
5
|
+
#
|
6
|
+
# Copyright (c) 2009-2012 Simone Carletti <weppos@weppos.net>
|
7
|
+
#++
|
8
|
+
|
9
|
+
|
10
|
+
require 'whois/record/scanners/base'
|
11
|
+
|
12
|
+
|
13
|
+
module Whois
|
14
|
+
class Record
|
15
|
+
module Scanners
|
16
|
+
|
17
|
+
# Scanner for the whois.centralnic.com record.
|
18
|
+
#
|
19
|
+
# @since 2.3.0
|
20
|
+
class WhoisCentralnicCom < Base
|
21
|
+
|
22
|
+
self.tokenizers += [
|
23
|
+
:skip_empty_line,
|
24
|
+
:scan_available,
|
25
|
+
:scan_disclaimer,
|
26
|
+
:scan_keyvalue,
|
27
|
+
]
|
28
|
+
|
29
|
+
|
30
|
+
tokenizer :scan_available do
|
31
|
+
if @input.skip(/^DOMAIN NOT FOUND\n/)
|
32
|
+
@ast["status:available"] = true
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
tokenizer :scan_disclaimer do
|
37
|
+
if @input.match?(/^\S([^:]+)\n/)
|
38
|
+
@ast["field:disclaimer"] = _scan_lines_to_array(/(.+)\n/).join(" ")
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
end
|
43
|
+
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
@@ -0,0 +1,87 @@
|
|
1
|
+
#--
|
2
|
+
# Ruby Whois
|
3
|
+
#
|
4
|
+
# An intelligent pure Ruby WHOIS client and parser.
|
5
|
+
#
|
6
|
+
# Copyright (c) 2009-2012 Simone Carletti <weppos@weppos.net>
|
7
|
+
#++
|
8
|
+
|
9
|
+
|
10
|
+
require 'whois/record/scanners/base'
|
11
|
+
|
12
|
+
|
13
|
+
module Whois
|
14
|
+
class Record
|
15
|
+
module Scanners
|
16
|
+
|
17
|
+
# Scanner for the whois.cira.ca record.
|
18
|
+
#
|
19
|
+
# @since 2.5.0
|
20
|
+
class WhoisCiraCa < Base
|
21
|
+
|
22
|
+
self.tokenizers += [
|
23
|
+
:skip_empty_line,
|
24
|
+
:scan_disclaimer,
|
25
|
+
:skip_comment,
|
26
|
+
:scan_header,
|
27
|
+
:scan_keyvalue,
|
28
|
+
:scan_nameserver,
|
29
|
+
]
|
30
|
+
|
31
|
+
|
32
|
+
|
33
|
+
tokenizer :scan_disclaimer do
|
34
|
+
if @input.match?(/^% Use of CIRA/)
|
35
|
+
@ast["field:disclaimer"] = _scan_lines_to_array(/^%(.*)\n/).join("\n")
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
tokenizer :scan_header do
|
40
|
+
if @input.scan(/^(.+?):\n/)
|
41
|
+
@tmp["group"] = @input[1]
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
tokenizer :scan_keyvalue do
|
46
|
+
if @input.scan(/^(.+?):(.*?)\n/)
|
47
|
+
start = @input[1]
|
48
|
+
key, value = start.strip, @input[2].strip
|
49
|
+
|
50
|
+
# This is a nested key
|
51
|
+
target = if start.index(" ") == 0
|
52
|
+
error!("Expected group.") if @tmp["group"].nil?
|
53
|
+
@ast[@tmp["group"]] ||= {}
|
54
|
+
@ast[@tmp["group"]]
|
55
|
+
else
|
56
|
+
@tmp.delete("group")
|
57
|
+
@ast
|
58
|
+
end
|
59
|
+
|
60
|
+
more = _scan_lines_to_array(/^\s{#{start.size}}(.+)\n/)
|
61
|
+
value = more.unshift(value).join("\n") unless more.empty?
|
62
|
+
|
63
|
+
if target[key].nil?
|
64
|
+
target[key] = value
|
65
|
+
else
|
66
|
+
target[key] = Array.wrap(target[key])
|
67
|
+
target[key] << value
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
tokenizer :scan_nameserver do
|
73
|
+
if @input.scan(/^\s+(.+?)\n/) && @tmp["group"] == "Name servers"
|
74
|
+
@ast["field:nameservers"] ||= []
|
75
|
+
@ast["field:nameservers"] << @input[1].strip
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
79
|
+
tokenizer :skip_comment do
|
80
|
+
@input.skip(/^%.*\n/)
|
81
|
+
end
|
82
|
+
|
83
|
+
end
|
84
|
+
|
85
|
+
end
|
86
|
+
end
|
87
|
+
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
#--
|
2
|
+
# Ruby Whois
|
3
|
+
#
|
4
|
+
# An intelligent pure Ruby WHOIS client and parser.
|
5
|
+
#
|
6
|
+
# Copyright (c) 2009-2012 Simone Carletti <weppos@weppos.net>
|
7
|
+
#++
|
8
|
+
|
9
|
+
|
10
|
+
require 'whois/record/scanners/base'
|
11
|
+
|
12
|
+
|
13
|
+
module Whois
|
14
|
+
class Record
|
15
|
+
module Scanners
|
16
|
+
|
17
|
+
# Scanner for the whois.cnnic.cn record.
|
18
|
+
class WhoisCnnicCn < Base
|
19
|
+
|
20
|
+
self.tokenizers += [
|
21
|
+
:skip_empty_line,
|
22
|
+
:scan_reserved,
|
23
|
+
:scan_available,
|
24
|
+
:scan_keyvalue,
|
25
|
+
]
|
26
|
+
|
27
|
+
|
28
|
+
tokenizer :scan_available do
|
29
|
+
if @input.scan(/^no matching record/)
|
30
|
+
@ast["status:available"] = true
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
tokenizer :scan_reserved do
|
35
|
+
if @input.scan(/^the domain you want to register is reserved/)
|
36
|
+
@ast["status:reserved"] = true
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
end
|
41
|
+
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
@@ -0,0 +1,122 @@
|
|
1
|
+
#--
|
2
|
+
# Ruby Whois
|
3
|
+
#
|
4
|
+
# An intelligent pure Ruby WHOIS client and parser.
|
5
|
+
#
|
6
|
+
# Copyright (c) 2009-2012 Simone Carletti <weppos@weppos.net>
|
7
|
+
#++
|
8
|
+
|
9
|
+
|
10
|
+
require 'whois/record/scanners/base'
|
11
|
+
|
12
|
+
|
13
|
+
module Whois
|
14
|
+
class Record
|
15
|
+
module Scanners
|
16
|
+
|
17
|
+
class WhoisDenicDe < Base
|
18
|
+
|
19
|
+
self.tokenizers += [
|
20
|
+
:skip_empty_line,
|
21
|
+
:scan_response_throttled,
|
22
|
+
:scan_disclaimer,
|
23
|
+
:scan_invalid,
|
24
|
+
:scan_available,
|
25
|
+
:scan_pair,
|
26
|
+
:scan_contact,
|
27
|
+
:skip_db_time,
|
28
|
+
]
|
29
|
+
|
30
|
+
|
31
|
+
# Version 1.11.0, 1.10.0
|
32
|
+
tokenizer :scan_available do
|
33
|
+
if @input.match?(/% Object ".+" not found in database\n/)
|
34
|
+
while @input.skip(/%(.*)\n/)
|
35
|
+
end
|
36
|
+
@ast["status:available"] = true
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
# Version 1.11.0, 1.10.0
|
41
|
+
tokenizer :scan_invalid do
|
42
|
+
if @input.match?(/% ".+" is not a valid domain name\n/)
|
43
|
+
@input.scan(/% "(.+?)" is not a valid domain name\n/)
|
44
|
+
@ast["Domain"] = @input[1]
|
45
|
+
@ast["status:invalid"] = true
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
tokenizer :scan_response_throttled do
|
50
|
+
if @input.match?(/^% Error: 55000000002/)
|
51
|
+
@ast["response:throttled"] = true
|
52
|
+
@input.skip(/^.+\n/)
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
tokenizer :scan_disclaimer do
|
57
|
+
if @input.match?(/% Copyright \(c\) *\d{4} by DENIC\n/)
|
58
|
+
@input.scan_until(/% Terms and Conditions of Use\n/)
|
59
|
+
lines = []
|
60
|
+
while @input.match?(/%/) && @input.scan(/%(.*)\n/)
|
61
|
+
lines << @input[1].strip unless @input[1].strip == ""
|
62
|
+
end
|
63
|
+
@ast["Disclaimer"] = lines.join(" ")
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
tokenizer :scan_pair do
|
68
|
+
parse_pair(@ast)
|
69
|
+
end
|
70
|
+
|
71
|
+
tokenizer :scan_contact do
|
72
|
+
if @input.scan(/\[(.*)\]\n/)
|
73
|
+
contact_name = @input[1]
|
74
|
+
contact = {}
|
75
|
+
while parse_pair(contact)
|
76
|
+
end
|
77
|
+
@ast[contact_name] = {
|
78
|
+
"id" => nil,
|
79
|
+
"name" => contact['Name'],
|
80
|
+
"organization" => contact['Organisation'],
|
81
|
+
"address" => contact['Address'],
|
82
|
+
"city" => contact['City'],
|
83
|
+
# 1.10.0, 1.11.0 || 2.0
|
84
|
+
"zip" => contact['Pcode'] || contact['PostalCode'],
|
85
|
+
"state" => nil,
|
86
|
+
"country" => contact['Country'],
|
87
|
+
"country_code" => contact['CountryCode'],
|
88
|
+
"phone" => contact['Phone'],
|
89
|
+
"fax" => contact['Fax'],
|
90
|
+
"email" => contact['Email'],
|
91
|
+
"created_on" => nil,
|
92
|
+
"updated_on" => contact['Changed']
|
93
|
+
}
|
94
|
+
end
|
95
|
+
end
|
96
|
+
|
97
|
+
# Version 2.0
|
98
|
+
tokenizer :skip_db_time do
|
99
|
+
@input.skip(/^% DB time is (.+)\n/)
|
100
|
+
end
|
101
|
+
|
102
|
+
|
103
|
+
private
|
104
|
+
|
105
|
+
def parse_pair(store)
|
106
|
+
if @input.scan(/([^ \[]*):(.*)\n/)
|
107
|
+
key, value = @input[1].strip, @input[2].strip
|
108
|
+
if store[key].nil?
|
109
|
+
store[key] = value
|
110
|
+
else
|
111
|
+
store[key].is_a?(Array) || store[key] = [store[key]]
|
112
|
+
store[key] << value
|
113
|
+
end
|
114
|
+
store
|
115
|
+
end
|
116
|
+
end
|
117
|
+
|
118
|
+
end
|
119
|
+
|
120
|
+
end
|
121
|
+
end
|
122
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
#--
|
2
|
+
# Ruby Whois
|
3
|
+
#
|
4
|
+
# An intelligent pure Ruby WHOIS client and parser.
|
5
|
+
#
|
6
|
+
# Copyright (c) 2009-2012 Simone Carletti <weppos@weppos.net>
|
7
|
+
#++
|
8
|
+
|
9
|
+
|
10
|
+
require 'whois/record/scanners/base'
|
11
|
+
|
12
|
+
|
13
|
+
module Whois
|
14
|
+
class Record
|
15
|
+
module Scanners
|
16
|
+
|
17
|
+
# Scanner for the whois.dns.hr record.
|
18
|
+
#
|
19
|
+
# @since 2.4.0
|
20
|
+
class WhoisDnsHr < Base
|
21
|
+
|
22
|
+
self.tokenizers += [
|
23
|
+
:skip_empty_line,
|
24
|
+
:scan_available,
|
25
|
+
:scan_keyvalue,
|
26
|
+
]
|
27
|
+
|
28
|
+
|
29
|
+
tokenizer :scan_available do
|
30
|
+
if @input.skip(/^%ERROR: no entries found\n/)
|
31
|
+
@ast["status:available"] = true
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
end
|
36
|
+
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|