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,50 @@
|
|
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.domainregistry.ie server.
|
16
|
+
#
|
17
|
+
# @since 2.5.0
|
18
|
+
class WhoisDomainregistryIe < Base
|
19
|
+
|
20
|
+
self.tokenizers += [
|
21
|
+
:skip_empty_line,
|
22
|
+
:scan_disclaimer,
|
23
|
+
:scan_contact,
|
24
|
+
:scan_keyvalue,
|
25
|
+
:scan_available,
|
26
|
+
]
|
27
|
+
|
28
|
+
tokenizer :scan_available do
|
29
|
+
if @input.skip(/^% Not Registered - .+\n/)
|
30
|
+
@ast["status:available"] = true
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
tokenizer :scan_disclaimer do
|
35
|
+
if @input.match?(/^% Rights restricted by copyright/)
|
36
|
+
@ast["field:disclaimer"] = _scan_lines_to_array(/^%(.+)\n/).join("\n")
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
tokenizer :scan_contact do
|
41
|
+
if @input.match?(/^person:/)
|
42
|
+
lines = _scan_lines_to_hash(/(.+?):(.*?)\n/)
|
43
|
+
@ast["field:#{lines['nic-hdl']}"] = lines
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
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.nc record.
|
18
|
+
#
|
19
|
+
# @since 2.4.0
|
20
|
+
class WhoisNc < Base
|
21
|
+
|
22
|
+
self.tokenizers += [
|
23
|
+
:skip_empty_line,
|
24
|
+
:skip_more,
|
25
|
+
:scan_available,
|
26
|
+
:scan_keyvalue,
|
27
|
+
]
|
28
|
+
|
29
|
+
|
30
|
+
MORES = ['Whois \.NC', 'more details on']
|
31
|
+
|
32
|
+
tokenizer :scan_available do
|
33
|
+
if @input.skip(/^No entries found .+\n/)
|
34
|
+
@ast["status:available"] = true
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
tokenizer :skip_more do
|
39
|
+
MORES.any? { |more| @input.skip(/^#{more}.*\n/) }
|
40
|
+
end
|
41
|
+
|
42
|
+
end
|
43
|
+
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
@@ -0,0 +1,178 @@
|
|
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 WhoisNicHu < Base
|
18
|
+
|
19
|
+
self.tokenizers += [
|
20
|
+
:scan_version,
|
21
|
+
:scan_disclaimer,
|
22
|
+
:scan_domain,
|
23
|
+
:scan_available,
|
24
|
+
:scan_in_progress,
|
25
|
+
|
26
|
+
# v2.0
|
27
|
+
:scan_moreinfo,
|
28
|
+
|
29
|
+
# v1.99
|
30
|
+
:scan_domain_data,
|
31
|
+
:scan_contacts,
|
32
|
+
|
33
|
+
:skip_empty_line,
|
34
|
+
]
|
35
|
+
|
36
|
+
|
37
|
+
# FIXME: Requires UTF-8 Encoding (see #11)
|
38
|
+
tokenizer :scan_available do
|
39
|
+
if @input.match?(/Nincs (.*?) \/ No match\n/)
|
40
|
+
@input.skip(/Nincs (.*?) \/ No match\n/)
|
41
|
+
@ast["status:available"] = true
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
# FIXME: Requires UTF-8 Encoding (see #11)
|
46
|
+
tokenizer :scan_in_progress do
|
47
|
+
if @input.match?(/(.*?) folyamatban \/ Registration in progress\n/)
|
48
|
+
@input.skip(/(.*?) folyamatban \/ Registration in progress\n/)
|
49
|
+
@ast["status:inprogress"] = true
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
tokenizer :scan_disclaimer do
|
54
|
+
if @input.match?(/^Rights.*\n/)
|
55
|
+
lines = @input.scan_until(/^\n/)
|
56
|
+
@ast["field:disclaimer"] = lines.strip
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
tokenizer :scan_domain do
|
61
|
+
if @input.match?(/^domain:\s+(.*)\n/) && @input.scan(/^domain:\s+(.*?)\n/)
|
62
|
+
@ast["field:domain"] = @input[1].strip
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
# FIXME: Requires UTF-8 Encoding (see #11)
|
67
|
+
tokenizer :scan_moreinfo do
|
68
|
+
if @input.match?(/Tov.* ld\.:\n/)
|
69
|
+
@ast["field:moreinfo"] = @input.scan_until(/^\n/)
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
tokenizer :scan_version do
|
74
|
+
if @input.match?(/% Whois server .*\n/)
|
75
|
+
@input.scan(/% Whois server ([\w\d\.]*).*?\n/)
|
76
|
+
@ast["field:version"] = @input[1]
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
tokenizer :scan_domain_data do
|
81
|
+
if @input.match?(/(.+?):\s+(.*)\n/)
|
82
|
+
while @input.scan(/(.+?):\s+(.*)\n/)
|
83
|
+
key, value = @input[1].strip, @input[2].strip
|
84
|
+
if key == 'person'
|
85
|
+
@ast['name'] = value
|
86
|
+
elsif key == 'org'
|
87
|
+
if value =~ /org_name_hun:\s+(.*)\Z/
|
88
|
+
@ast['name'] = $1
|
89
|
+
elsif value =~ /org_name_eng:\s+(.*)\Z/
|
90
|
+
@ast['org'] = $1
|
91
|
+
elsif value != 'Private person'
|
92
|
+
contact['org'] = value
|
93
|
+
end
|
94
|
+
elsif @ast[key].nil?
|
95
|
+
@ast[key] = value
|
96
|
+
elsif @ast[key].is_a? Array
|
97
|
+
@ast[key] << value
|
98
|
+
else
|
99
|
+
@ast[key] = [@ast[key], value].flatten
|
100
|
+
end
|
101
|
+
end
|
102
|
+
true
|
103
|
+
end
|
104
|
+
end
|
105
|
+
|
106
|
+
tokenizer :scan_contacts do
|
107
|
+
if @input.match?(/\n(person|org):/)
|
108
|
+
@input.scan(/\n/)
|
109
|
+
while @input.match?(/(.+?):\s+(.*)\n/)
|
110
|
+
parse_contact
|
111
|
+
end
|
112
|
+
true
|
113
|
+
end
|
114
|
+
end
|
115
|
+
|
116
|
+
|
117
|
+
private
|
118
|
+
|
119
|
+
def parse_contact
|
120
|
+
contact ||= {}
|
121
|
+
while @input.scan(/(.+?):\s+(.*)\n/)
|
122
|
+
key, value = @input[1].strip, @input[2].strip
|
123
|
+
if key == 'hun-id'
|
124
|
+
a1 = contact['address'][1].split(/\s/)
|
125
|
+
zip = a1.shift
|
126
|
+
city = a1.join(' ')
|
127
|
+
# we should keep the old values if this is an already
|
128
|
+
# defined contact
|
129
|
+
if @ast[value].nil?
|
130
|
+
@ast[value] = {
|
131
|
+
"id" => value,
|
132
|
+
"name" => contact['name'],
|
133
|
+
"organization" => contact['org'],
|
134
|
+
"address" => contact['address'][0],
|
135
|
+
"city" => city,
|
136
|
+
"zip" => zip,
|
137
|
+
"country_code" => contact['address'][2],
|
138
|
+
"phone" => contact['phone'],
|
139
|
+
"fax" => contact['fax-no'],
|
140
|
+
"email" => contact['e-mail']
|
141
|
+
}
|
142
|
+
else
|
143
|
+
@ast[value]["id"] ||= value
|
144
|
+
@ast[value]["name"] ||= contact['name']
|
145
|
+
@ast[value]["organization"] ||= contact['org']
|
146
|
+
@ast[value]["address"] ||= contact['address'][0]
|
147
|
+
@ast[value]["city"] ||= city
|
148
|
+
@ast[value]["zip"] ||= zip
|
149
|
+
@ast[value]["country_code"] ||= contact['address'][2]
|
150
|
+
@ast[value]["phone"] ||= contact['phone']
|
151
|
+
@ast[value]["fax"] ||= contact['fax-no']
|
152
|
+
@ast[value]["email"] ||= contact['e-mail']
|
153
|
+
end
|
154
|
+
contact = {}
|
155
|
+
elsif key == 'person'
|
156
|
+
contact['name'] = value
|
157
|
+
elsif key == 'org'
|
158
|
+
if value =~ /org_name_hun:\s+(.*)\Z/
|
159
|
+
contact['name'] = $1
|
160
|
+
elsif value =~ /org_name_eng:\s+(.*)\Z/
|
161
|
+
contact['org'] = $1
|
162
|
+
else
|
163
|
+
contact['org'] = value
|
164
|
+
end
|
165
|
+
elsif key == 'address' && !contact['address'].nil?
|
166
|
+
contact['address'] = [contact['address'], value].flatten
|
167
|
+
else
|
168
|
+
contact[key] = value
|
169
|
+
end
|
170
|
+
end
|
171
|
+
true
|
172
|
+
end
|
173
|
+
|
174
|
+
end
|
175
|
+
|
176
|
+
end
|
177
|
+
end
|
178
|
+
end
|
@@ -0,0 +1,104 @@
|
|
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 WhoisNicIt < Base
|
18
|
+
|
19
|
+
self.tokenizers += [
|
20
|
+
:skip_empty_line,
|
21
|
+
:scan_response_unavailable,
|
22
|
+
:scan_disclaimer,
|
23
|
+
:scan_keyvalue,
|
24
|
+
:scan_section,
|
25
|
+
]
|
26
|
+
|
27
|
+
|
28
|
+
tokenizer :scan_response_unavailable do
|
29
|
+
if @input.scan(/Service temporarily unavailable\.\n/)
|
30
|
+
@ast["response:unavailable"] = true
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
tokenizer :scan_disclaimer do
|
35
|
+
if @input.match?(/\*(.*?)\*\n/)
|
36
|
+
@ast["Disclaimer"] = _scan_lines_to_array(/\*(.*?)\*\n/).select { |line| line =~ /\w+/ }.join(" ")
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
tokenizer :scan_section do
|
41
|
+
if @input.scan(/([^:]+?)\n/)
|
42
|
+
section = @input[1].strip
|
43
|
+
content = parse_section_pairs ||
|
44
|
+
parse_section_items
|
45
|
+
@input.match?(/\n+/) || error!("Unexpected end of section")
|
46
|
+
@ast[section] = content
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
|
51
|
+
private
|
52
|
+
|
53
|
+
def parse_section_items
|
54
|
+
if @input.match?(/(\s+)([^:]+?)\n/)
|
55
|
+
items = []
|
56
|
+
indentation = @input[1].length
|
57
|
+
while item = parse_section_items_item(indentation)
|
58
|
+
items << item
|
59
|
+
end
|
60
|
+
items
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
def parse_section_items_item(indentation)
|
65
|
+
if @input.scan(/\s{#{indentation}}(.+)\n/)
|
66
|
+
@input[1]
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
def parse_section_pairs
|
71
|
+
contents = {}
|
72
|
+
while content = parse_section_pair
|
73
|
+
contents.merge!(content)
|
74
|
+
end
|
75
|
+
if !contents.empty?
|
76
|
+
contents
|
77
|
+
else
|
78
|
+
false
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
def parse_section_pair
|
83
|
+
if @input.scan(/(\s+)(.+?):(\s+)(.*?)\n/)
|
84
|
+
key = @input[2].strip
|
85
|
+
values = [@input[4].strip]
|
86
|
+
indentation = @input[1].length + @input[2].length + 1 + @input[3].length
|
87
|
+
while value = parse_section_pair_newlinevalue(indentation)
|
88
|
+
values << value
|
89
|
+
end
|
90
|
+
{ key => values.join("\n") }
|
91
|
+
end
|
92
|
+
end
|
93
|
+
|
94
|
+
def parse_section_pair_newlinevalue(indentation)
|
95
|
+
if @input.scan(/\s{#{indentation}}(.+)\n/)
|
96
|
+
@input[1]
|
97
|
+
end
|
98
|
+
end
|
99
|
+
|
100
|
+
end
|
101
|
+
|
102
|
+
end
|
103
|
+
end
|
104
|
+
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.registry.qa record.
|
18
|
+
#
|
19
|
+
# @since 2.1.0
|
20
|
+
class WhoisRegistryQa < 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.scan(/^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,75 @@
|
|
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.rnids.rs record.
|
18
|
+
#
|
19
|
+
# @since 2.4.0
|
20
|
+
class WhoisRnidsRs < Base
|
21
|
+
|
22
|
+
self.tokenizers += [
|
23
|
+
:scan_available,
|
24
|
+
:skip_comment,
|
25
|
+
:flag_group_start,
|
26
|
+
:scan_group_keyvalue,
|
27
|
+
:flag_group_end,
|
28
|
+
:skip_empty_line,
|
29
|
+
]
|
30
|
+
|
31
|
+
|
32
|
+
GROUPS = ["Owner", "Administrative contact", "Technical contact"]
|
33
|
+
|
34
|
+
tokenizer :scan_available do
|
35
|
+
if @input.scan(/^%ERROR:103: Domain is not registered/)
|
36
|
+
@ast["status:available"] = true
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
tokenizer :flag_group_start do
|
41
|
+
if GROUPS.any? { |group| @input.check(/^(#{group}):/) }
|
42
|
+
@tmp["group"] = @input[1]
|
43
|
+
end
|
44
|
+
false
|
45
|
+
end
|
46
|
+
|
47
|
+
tokenizer :flag_group_end do
|
48
|
+
if @input.match?(/^\n/)
|
49
|
+
@tmp.delete("group")
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
tokenizer :scan_group_keyvalue do
|
54
|
+
if @input.scan(/(.+?):(.*?)\n/)
|
55
|
+
key, value = @input[1].strip, @input[2].strip
|
56
|
+
target = @tmp["group"] ? (@ast[@tmp["group"]] ||= {}) : @ast
|
57
|
+
|
58
|
+
if target[key].nil?
|
59
|
+
target[key] = value
|
60
|
+
else
|
61
|
+
target[key] = Array.wrap(target[key])
|
62
|
+
target[key] << value
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
tokenizer :skip_comment do
|
68
|
+
@input.skip(/^%.*\n/)
|
69
|
+
end
|
70
|
+
|
71
|
+
end
|
72
|
+
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
@@ -0,0 +1,61 @@
|
|
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.smallregistry.net record.
|
18
|
+
class WhoisSmallregistryNet < Base
|
19
|
+
|
20
|
+
self.tokenizers += [
|
21
|
+
:scan_yaml_header,
|
22
|
+
:scan_disclaimer,
|
23
|
+
:scan_request_time,
|
24
|
+
:scan_available,
|
25
|
+
:scan_body,
|
26
|
+
]
|
27
|
+
|
28
|
+
tokenizer :scan_yaml_header do
|
29
|
+
# skip the YAML prelude
|
30
|
+
@input.scan(/^---.*\n/)
|
31
|
+
end
|
32
|
+
|
33
|
+
tokenizer :scan_disclaimer do
|
34
|
+
if @input.match?(/^#/) && disclaimer = @input.scan_until(/^#\n/)
|
35
|
+
@ast["field:disclaimer"] = disclaimer
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
tokenizer :scan_request_time do
|
40
|
+
if @input.scan(/^# (\d+-\d+-\d+T.*)\n/)
|
41
|
+
@ast["field:request_time"] = @input[1].strip
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
tokenizer :scan_available do
|
46
|
+
if @input.scan(/^# Object not found.*\n/)
|
47
|
+
@ast["status:available"] = true
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
tokenizer :scan_body do
|
52
|
+
str = @input.rest
|
53
|
+
str.gsub!(/ (![\w]+) \n/, " \n") # remove custom types
|
54
|
+
@ast.merge! YAML.load(str)
|
55
|
+
@input.terminate
|
56
|
+
end
|
57
|
+
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
@@ -0,0 +1,50 @@
|
|
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.tld.ee record.
|
18
|
+
#
|
19
|
+
# @todo This is an incomplete scanner, it skips all the properties
|
20
|
+
# except contacts.
|
21
|
+
class WhoisTldEe < Base
|
22
|
+
|
23
|
+
self.tokenizers += [
|
24
|
+
:scan_contact,
|
25
|
+
:todo_content,
|
26
|
+
]
|
27
|
+
|
28
|
+
|
29
|
+
tokenizer :scan_contact do
|
30
|
+
if @input.scan(/contact:\s+(.*)\n/)
|
31
|
+
section = @input[1].strip
|
32
|
+
content = {}
|
33
|
+
|
34
|
+
while @input.scan(/(.*?):\s+(.*?)\n/)
|
35
|
+
content[@input[1]] = @input[2]
|
36
|
+
end
|
37
|
+
|
38
|
+
@ast[section] = content
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
tokenizer :todo_content do
|
43
|
+
@input.scan(/(.*)\n/)
|
44
|
+
end
|
45
|
+
|
46
|
+
end
|
47
|
+
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
data/lib/whois/version.rb
CHANGED
@@ -1,3 +1,21 @@
|
|
1
|
+
#disclaimer
|
2
|
+
should: %s raise_error(Whois::PropertyNotSupported)
|
3
|
+
|
4
|
+
|
5
|
+
#domain
|
6
|
+
should: %s == nil
|
7
|
+
|
8
|
+
#domain_id
|
9
|
+
should: %s raise_error(Whois::PropertyNotSupported)
|
10
|
+
|
11
|
+
|
12
|
+
#referral_url
|
13
|
+
should: %s raise_error(Whois::PropertyNotSupported)
|
14
|
+
|
15
|
+
#referral_whois
|
16
|
+
should: %s raise_error(Whois::PropertyNotSupported)
|
17
|
+
|
18
|
+
|
1
19
|
#status
|
2
20
|
should: %s == []
|
3
21
|
|
@@ -18,6 +36,21 @@
|
|
18
36
|
should: %s raise_error(Whois::PropertyNotSupported)
|
19
37
|
|
20
38
|
|
39
|
+
#registrar
|
40
|
+
should: %s == nil
|
41
|
+
|
42
|
+
#registrant_contacts
|
43
|
+
should: %s CLASS(array)
|
44
|
+
should: %s == []
|
45
|
+
|
46
|
+
#admin_contacts
|
47
|
+
should: %s raise_error(Whois::PropertyNotSupported)
|
48
|
+
|
49
|
+
#technical_contacts
|
50
|
+
should: %s CLASS(array)
|
51
|
+
should: %s == []
|
52
|
+
|
53
|
+
|
21
54
|
#nameservers
|
22
55
|
should: %s CLASS(array)
|
23
56
|
should: %s == []
|