nicinfo 1.3.0 → 1.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/nicinfo/autnum.rb +1 -1
- data/lib/nicinfo/cache.rb +0 -30
- data/lib/nicinfo/common_json.rb +19 -0
- data/lib/nicinfo/constants.rb +17 -2
- data/lib/nicinfo/demo/error-code.json +29 -0
- data/lib/nicinfo/demo/nameservers.json +4 -3
- data/lib/nicinfo/demo/ns-simple.json +2 -2
- data/lib/nicinfo/demo/ns-very-simple.json +2 -2
- data/lib/nicinfo/demo/ns.json +3 -3
- data/lib/nicinfo/domain.rb +1 -1
- data/lib/nicinfo/entity.rb +15 -6
- data/lib/nicinfo/error_code.rb +3 -12
- data/lib/nicinfo/ip.rb +11 -3
- data/lib/nicinfo/jcr/rdap.jcr +807 -0
- data/lib/nicinfo/jcr/strict.jcr +238 -0
- data/lib/nicinfo/nicinfo_main.rb +114 -16
- data/lib/nicinfo/notices.rb +3 -16
- data/lib/nicinfo/ns.rb +1 -1
- data/lib/nicinfo/utils.rb +8 -2
- metadata +32 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cc53cf86fdc483ebfdeb1cf5830173051059064b
|
4
|
+
data.tar.gz: 1786695e0c763541c50e474cdd19c83138eb6795
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 85f41c0a8a3e6951d6753e982984f38d3f682f4f440563899d5ccc8aae6a68e9fa3c300831aec1706d5caa583d8f50e66f4ff1ed239f0455ecb21b7349442aa1
|
7
|
+
data.tar.gz: bfc5ed2d82280bc4d095d2c7a42b82beff0f631bcf936550e8e413d547c0d9148b634bd9c37fe8251ad4b1e2c6f31d2801f38df8228e46cd4f1729e6391d8d93
|
data/lib/nicinfo/autnum.rb
CHANGED
@@ -48,7 +48,7 @@ module NicInfo
|
|
48
48
|
@config.logger.start_data_item
|
49
49
|
@config.logger.data_title "[ AS NUMBER ]"
|
50
50
|
@config.logger.terse "Handle", NicInfo::get_handle( @objectclass ), NicInfo::AttentionType::SUCCESS
|
51
|
-
@config.logger.extra "Object Class Name", NicInfo::get_object_class_name( @objectclass )
|
51
|
+
@config.logger.extra "Object Class Name", NicInfo::get_object_class_name( @objectclass, "autnum", @config )
|
52
52
|
endNum = NicInfo.get_endAutnum @objectclass
|
53
53
|
startNum = NicInfo.get_startAutnum @objectclass
|
54
54
|
if endNum
|
data/lib/nicinfo/cache.rb
CHANGED
@@ -106,36 +106,6 @@ module NicInfo
|
|
106
106
|
return count
|
107
107
|
end
|
108
108
|
|
109
|
-
def get_last
|
110
|
-
cache_files = Dir::entries(@config.rdap_cache_dir)
|
111
|
-
last_file = nil
|
112
|
-
last_file_mtime = nil
|
113
|
-
cache_files.each do |file|
|
114
|
-
full_file_name = File.join(@config.rdap_cache_dir, file)
|
115
|
-
if !file.start_with?(".")
|
116
|
-
mtime = File.mtime(full_file_name)
|
117
|
-
if last_file == nil
|
118
|
-
last_file = full_file_name
|
119
|
-
last_file_mtime = mtime
|
120
|
-
elsif mtime > last_file_mtime
|
121
|
-
last_file = full_file_name
|
122
|
-
last_file_mtime = mtime
|
123
|
-
end
|
124
|
-
end
|
125
|
-
end
|
126
|
-
if last_file
|
127
|
-
f = File.open(last_file, "r")
|
128
|
-
data = ''
|
129
|
-
f.each_line do |line|
|
130
|
-
data += line
|
131
|
-
end
|
132
|
-
f.close
|
133
|
-
return [last_file, last_file_mtime, data]
|
134
|
-
end
|
135
|
-
#else
|
136
|
-
return nil
|
137
|
-
end
|
138
|
-
|
139
109
|
end
|
140
110
|
|
141
111
|
end
|
data/lib/nicinfo/common_json.rb
CHANGED
@@ -204,6 +204,25 @@ module NicInfo
|
|
204
204
|
end
|
205
205
|
end
|
206
206
|
|
207
|
+
def display_simple_links links
|
208
|
+
if links
|
209
|
+
if links.instance_of?( Array )
|
210
|
+
alternate = NicInfo.get_alternate_link links
|
211
|
+
@config.logger.prose NicInfo::DataAmount::NORMAL_DATA, "More", alternate, NicInfo::AttentionType::SECONDARY if alternate
|
212
|
+
about = NicInfo.get_about_link links
|
213
|
+
@config.logger.prose NicInfo::DataAmount::NORMAL_DATA, "About", about, NicInfo::AttentionType::SECONDARY if about
|
214
|
+
tos = NicInfo.get_tos_link links
|
215
|
+
@config.logger.prose NicInfo::DataAmount::NORMAL_DATA, "TOS", tos, NicInfo::AttentionType::SECONDARY if tos
|
216
|
+
copyright = NicInfo.get_copyright_link links
|
217
|
+
@config.logger.prose NicInfo::DataAmount::NORMAL_DATA, "(C)", copyright, NicInfo::AttentionType::SECONDARY if copyright
|
218
|
+
license = NicInfo.get_license_link links
|
219
|
+
@config.logger.prose NicInfo::DataAmount::NORMAL_DATA, "License", license, NicInfo::AttentionType::SECONDARY if license
|
220
|
+
else
|
221
|
+
@config.conf_msgs << "'links' is not an array."
|
222
|
+
end
|
223
|
+
end
|
224
|
+
end
|
225
|
+
|
207
226
|
end
|
208
227
|
|
209
228
|
class EventActor
|
data/lib/nicinfo/constants.rb
CHANGED
@@ -18,7 +18,7 @@
|
|
18
18
|
|
19
19
|
module NicInfo
|
20
20
|
|
21
|
-
VERSION = "1.
|
21
|
+
VERSION = "1.4.0"
|
22
22
|
VERSION_LABEL = "NicInfo v." + VERSION
|
23
23
|
COPYRIGHT = "Copyright (c) 2011-2017 American Registry for Internet Numbers (ARIN)"
|
24
24
|
CONFIG_VERSION = 4
|
@@ -43,7 +43,7 @@ module NicInfo
|
|
43
43
|
IPV6_REGEX = /\A(?:[0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}\z/
|
44
44
|
IPV6_HEXCOMPRESS_REGEX = /\A((?:[0-9A-Fa-f]{1,4}(?::[0-9A-Fa-f]{1,4})*)?)::((?:[0-9A-Fa-f]{1,4}(?::[0-9A-Fa-f]{1,4})*)?)\z/
|
45
45
|
|
46
|
-
#File Name Constants
|
46
|
+
# File Name Constants
|
47
47
|
LASTTREE_YAML = "lasttree.yaml"
|
48
48
|
DEMO_DIR = "demo"
|
49
49
|
BOOTSTRAP_FILE_DIR = "bsfiles"
|
@@ -53,6 +53,21 @@ module NicInfo
|
|
53
53
|
IPV4_BOOTSTRAP = "ipv4.json"
|
54
54
|
IPV6_BOOTSTRAP = "ipv6.json"
|
55
55
|
|
56
|
+
# JCR Constants
|
57
|
+
JCR_DIR = "jcr"
|
58
|
+
RDAP_JCR = "rdap.jcr"
|
59
|
+
STRICT_RDAP_JCR = "strict.jcr"
|
60
|
+
JCR_ROOT_ENTITY = "entity_response"
|
61
|
+
JCR_ROOT_NAMESERVER = "nameserver_response"
|
62
|
+
JCR_ROOT_DOMAIN = "domain_response"
|
63
|
+
JCR_ROOT_NETWORK = "network_response"
|
64
|
+
JCR_ROOT_AUTNUM = "autnum_response"
|
65
|
+
JCR_ROOT_ERROR = "error_response"
|
66
|
+
JCR_ROOT_HELP = "help_response"
|
67
|
+
JCR_ROOT_DOMAIN_SEARCH = "domainSearch_response"
|
68
|
+
JCR_ROOT_NAMESERVER_SEARCH = "nameserverSearch_response"
|
69
|
+
JCR_ROOT_ENTITY_SEARCH = "entitySearch_response"
|
70
|
+
|
56
71
|
# Config constants
|
57
72
|
OUTPUT = "output"
|
58
73
|
MESSAGES = "messages"
|
@@ -20,6 +20,35 @@
|
|
20
20
|
"href":"http://www.example.com/tos.html"
|
21
21
|
}
|
22
22
|
]
|
23
|
+
},
|
24
|
+
{
|
25
|
+
"title":"Copyright",
|
26
|
+
"description":[
|
27
|
+
"This test data is Copyright (C) 2015-2018 ARIN."
|
28
|
+
],
|
29
|
+
"links":[
|
30
|
+
{
|
31
|
+
"value":"https://rdap.arin.net/bootstrap/entity/restricted",
|
32
|
+
"rel":"copyright",
|
33
|
+
"type":"text/html",
|
34
|
+
"href":"http://www.example.com/copyright.html"
|
35
|
+
}
|
36
|
+
]
|
37
|
+
},
|
38
|
+
{
|
39
|
+
"title":"About",
|
40
|
+
"description":[
|
41
|
+
"Questions regarding ARIN's RDAP service should be sent to arin-tech-discuss@arin.net.",
|
42
|
+
"See our mailing list for more info."
|
43
|
+
],
|
44
|
+
"links":[
|
45
|
+
{
|
46
|
+
"value":"https://rdap.arin.net/bootstrap/entity/restricted",
|
47
|
+
"rel":"about",
|
48
|
+
"type":"text/html",
|
49
|
+
"href":"https://lists.arin.net/mailman/listinfo/arin-tech-discuss"
|
50
|
+
}
|
51
|
+
]
|
23
52
|
}
|
24
53
|
],
|
25
54
|
"errorCode":418,
|
@@ -27,8 +27,9 @@
|
|
27
27
|
"nameserverSearchResults": [
|
28
28
|
{
|
29
29
|
"handle":"XXXX",
|
30
|
+
"objectClassName" : "nameserver",
|
30
31
|
"ldhName":"ns1.xn--fo-5ja.example",
|
31
|
-
"unicodeName":"foo.example",
|
32
|
+
"unicodeName":"ns1.foo.example",
|
32
33
|
"status":[ "active" ],
|
33
34
|
"ipAddresses":{
|
34
35
|
"v4":[ "192.0.2.1", "192.0.2.2" ],
|
@@ -229,9 +230,9 @@
|
|
229
230
|
},
|
230
231
|
{
|
231
232
|
"handle":"XXXX2",
|
232
|
-
"objectClassName":"
|
233
|
+
"objectClassName":"nameserver",
|
233
234
|
"ldhName":"ns1.xn--fo-5ja.example",
|
234
|
-
"unicodeName":"foo.example",
|
235
|
+
"unicodeName":"ns1.foo.example",
|
235
236
|
"status":[ "active" ],
|
236
237
|
"ipAddresses":{
|
237
238
|
"v4":[ "192.0.2.1", "192.0.2.2" ],
|
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
|
-
"nicInfo_demoUrl" : "https://rdap.arin.net/registry/nameserver/ns2.example.
|
3
|
-
"nicInfo_demoHint" : "nicinfo ns2.example.
|
2
|
+
"nicInfo_demoUrl" : "https://rdap.arin.net/registry/nameserver/ns2.example.example",
|
3
|
+
"nicInfo_demoHint" : "nicinfo ns2.example.example",
|
4
4
|
"rdapConformance":[
|
5
5
|
"rdap_level_0"
|
6
6
|
],
|
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
|
-
"nicInfo_demoUrl" : "https://rdap.arin.net/registry/nameserver/ns1.example.
|
3
|
-
"nicInfo_demoHint" : "nicinfo ns1.example.
|
2
|
+
"nicInfo_demoUrl" : "https://rdap.arin.net/registry/nameserver/ns1.example.example",
|
3
|
+
"nicInfo_demoHint" : "nicinfo ns1.example.example",
|
4
4
|
"rdapConformance":[
|
5
5
|
"rdap_level_0"
|
6
6
|
],
|
data/lib/nicinfo/demo/ns.json
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
{
|
2
|
-
"nicInfo_demoUrl" : "https://rdap.arin.net/
|
2
|
+
"nicInfo_demoUrl" : "https://rdap.arin.net/registry/nameserver/ns1.xn--fo-5ja.example",
|
3
3
|
"nicInfo_demoHint" : "nicinfo ns1.xn--fo-5ja.example",
|
4
4
|
"rdapConformance":[
|
5
5
|
"rdap_level_0"
|
@@ -25,9 +25,9 @@
|
|
25
25
|
}
|
26
26
|
],
|
27
27
|
"handle":"XXXX",
|
28
|
-
"objectClassName":"
|
28
|
+
"objectClassName":"nameserver",
|
29
29
|
"ldhName":"ns1.xn--fo-5ja.example",
|
30
|
-
"unicodeName":"foo.example",
|
30
|
+
"unicodeName":"ns1.foo.example",
|
31
31
|
"status":[ "active" ],
|
32
32
|
"ipAddresses":{
|
33
33
|
"v4":[ "192.0.2.1", "192.0.2.2" ],
|
data/lib/nicinfo/domain.rb
CHANGED
@@ -141,7 +141,7 @@ module NicInfo
|
|
141
141
|
@config.logger.start_data_item
|
142
142
|
@config.logger.data_title "[ DOMAIN ]"
|
143
143
|
@config.logger.terse "Handle", NicInfo::get_handle( @objectclass ), NicInfo::AttentionType::SUCCESS
|
144
|
-
@config.logger.extra "Object Class Name", NicInfo::get_object_class_name( @objectclass )
|
144
|
+
@config.logger.extra "Object Class Name", NicInfo::get_object_class_name( @objectclass, "domain", @config )
|
145
145
|
@config.logger.terse "Domain Name", NicInfo::get_ldhName( @objectclass ), NicInfo::AttentionType::SUCCESS
|
146
146
|
@config.logger.datum "I18N Domain Name", NicInfo::get_unicodeName( @objectclass ), NicInfo::AttentionType::SUCCESS
|
147
147
|
variants = @objectclass[ "variants" ]
|
data/lib/nicinfo/entity.rb
CHANGED
@@ -112,7 +112,8 @@ module NicInfo
|
|
112
112
|
|
113
113
|
attr_accessor :fns, :names, :phones, :emails, :adrs, :kind, :titles, :roles, :orgs
|
114
114
|
|
115
|
-
def initialize
|
115
|
+
def initialize( config )
|
116
|
+
@config = config
|
116
117
|
@fns = Array.new
|
117
118
|
@names = Array.new
|
118
119
|
@phones = Array.new
|
@@ -130,6 +131,11 @@ module NicInfo
|
|
130
131
|
def process entity
|
131
132
|
if ( vcard = get_vcard( entity ) ) != nil
|
132
133
|
vcardElements = vcard[ 1 ]
|
134
|
+
if vcardElements.size == 0
|
135
|
+
@config.conf_msgs << "jCard (vCard) is empty."
|
136
|
+
elsif vcardElements[ 0 ][ 0 ] != "version"
|
137
|
+
@config.conf_msgs << "jCard (vCard) does not have required version first element."
|
138
|
+
end
|
133
139
|
vcardElements.each do |element|
|
134
140
|
if element[ 0 ] == "fn"
|
135
141
|
@fns << element[ 3 ]
|
@@ -151,7 +157,7 @@ module NicInfo
|
|
151
157
|
if element[ 3 ][ -2 ].instance_of? Array
|
152
158
|
name << " " << element[ 3 ][ -2 ].join( ' ' )
|
153
159
|
end
|
154
|
-
@names << name
|
160
|
+
@names << name.strip
|
155
161
|
end
|
156
162
|
if element[ 0 ] == "tel"
|
157
163
|
tel = Tel.new
|
@@ -217,6 +223,9 @@ module NicInfo
|
|
217
223
|
@orgs << org
|
218
224
|
end
|
219
225
|
end
|
226
|
+
if @fns.empty?
|
227
|
+
@config.conf_msgs << "jCard (vCard) has no required 'fn' property."
|
228
|
+
end
|
220
229
|
end
|
221
230
|
return self
|
222
231
|
end
|
@@ -232,7 +241,7 @@ module NicInfo
|
|
232
241
|
|
233
242
|
def initialize config
|
234
243
|
@config = config
|
235
|
-
@jcard = JCard.new
|
244
|
+
@jcard = JCard.new( config )
|
236
245
|
@common = CommonJson.new config
|
237
246
|
@entity = nil
|
238
247
|
@asEvents = Array.new
|
@@ -283,12 +292,12 @@ module NicInfo
|
|
283
292
|
@config.logger.start_data_item
|
284
293
|
@config.logger.data_title "[ ENTITY ]"
|
285
294
|
@config.logger.terse "Handle", NicInfo::get_handle( @objectclass ), NicInfo::AttentionType::SUCCESS
|
286
|
-
@config.logger.extra "Object Class Name", NicInfo::get_object_class_name( @objectclass )
|
295
|
+
@config.logger.extra "Object Class Name", NicInfo::get_object_class_name( @objectclass, "entity", @config )
|
287
296
|
@jcard.fns.each do |fn|
|
288
|
-
@config.logger.terse "Name", fn, NicInfo::AttentionType::SUCCESS
|
297
|
+
@config.logger.terse "Common Name", fn, NicInfo::AttentionType::SUCCESS
|
289
298
|
end
|
290
299
|
@jcard.names.each do |n|
|
291
|
-
@config.logger.extra "Name", n, NicInfo::AttentionType::SUCCESS
|
300
|
+
@config.logger.extra "Formal Name", n, NicInfo::AttentionType::SUCCESS
|
292
301
|
end
|
293
302
|
@jcard.orgs.each do |org|
|
294
303
|
item_value = org.names.join( ", " )
|
data/lib/nicinfo/error_code.rb
CHANGED
@@ -15,6 +15,7 @@
|
|
15
15
|
require 'nicinfo/config'
|
16
16
|
require 'nicinfo/nicinfo_logger'
|
17
17
|
require 'nicinfo/utils'
|
18
|
+
require 'nicinfo/common_json'
|
18
19
|
|
19
20
|
module NicInfo
|
20
21
|
|
@@ -25,6 +26,7 @@ module NicInfo
|
|
25
26
|
|
26
27
|
def initialize( config )
|
27
28
|
@config = config
|
29
|
+
@common = CommonJson.new( config )
|
28
30
|
end
|
29
31
|
|
30
32
|
def display_error_code ec
|
@@ -42,18 +44,7 @@ module NicInfo
|
|
42
44
|
i = i + 1
|
43
45
|
end
|
44
46
|
links = ec[ "links" ]
|
45
|
-
|
46
|
-
alternate = NicInfo.get_alternate_link links
|
47
|
-
@config.logger.prose NicInfo::DataAmount::NORMAL_DATA, "More", alternate if alternate
|
48
|
-
about = NicInfo.get_about_link links
|
49
|
-
@config.logger.prose NicInfo::DataAmount::NORMAL_DATA, "About", about if about
|
50
|
-
tos = NicInfo.get_tos_link links
|
51
|
-
@config.logger.prose NicInfo::DataAmount::NORMAL_DATA, "TOS", tos if tos
|
52
|
-
copyright = NicInfo.get_copyright_link links
|
53
|
-
@config.logger.prose NicInfo::DataAmount::NORMAL_DATA, "(C)", copyright if copyright
|
54
|
-
license = NicInfo.get_license_link links
|
55
|
-
@config.logger.prose NicInfo::DataAmount::NORMAL_DATA, "License", license if license
|
56
|
-
end
|
47
|
+
@common.display_simple_links( links )
|
57
48
|
@config.logger.end_data_item
|
58
49
|
end
|
59
50
|
|
data/lib/nicinfo/ip.rb
CHANGED
@@ -51,9 +51,17 @@ module NicInfo
|
|
51
51
|
@config.logger.start_data_item
|
52
52
|
@config.logger.data_title "[ IP NETWORK ]"
|
53
53
|
@config.logger.terse "Handle", NicInfo::get_handle( @objectclass ), NicInfo::AttentionType::SUCCESS
|
54
|
-
@config.logger.extra "Object Class Name", NicInfo::get_object_class_name( @objectclass )
|
55
|
-
|
56
|
-
|
54
|
+
@config.logger.extra "Object Class Name", NicInfo::get_object_class_name( @objectclass, "ip network", @config )
|
55
|
+
start_addr = NicInfo.get_startAddress( @objectclass )
|
56
|
+
if start_addr.include?( '/' )
|
57
|
+
@config.conf_msgs << "start IP #{start_addr} is not an IP address (possibly a CIDR)"
|
58
|
+
end
|
59
|
+
@config.logger.terse "Start Address", start_addr , NicInfo::AttentionType::SUCCESS
|
60
|
+
end_addr = NicInfo.get_endAddress( @objectclass )
|
61
|
+
if end_addr.include?( '/' )
|
62
|
+
@config.conf_msgs << "end IP #{end_addr} is not an IP address (possibly a CIDR)"
|
63
|
+
end
|
64
|
+
@config.logger.terse "End Address", end_addr, NicInfo::AttentionType::SUCCESS
|
57
65
|
@config.logger.terse "CIDRs", get_CIDRs
|
58
66
|
@config.logger.datum "IP Version", @objectclass[ "ipVersion" ]
|
59
67
|
@config.logger.extra "Name", NicInfo.get_name( @objectclass )
|