nicinfo 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/bin/nicinfo +22 -0
- data/lib/autnum.rb +90 -0
- data/lib/bootstrap.rb +198 -0
- data/lib/bsfiles/asn.json +2326 -0
- data/lib/bsfiles/dns.json +25 -0
- data/lib/bsfiles/entity.json +52 -0
- data/lib/bsfiles/ipv4.json +244 -0
- data/lib/bsfiles/ipv6.json +97 -0
- data/lib/cache.rb +141 -0
- data/lib/common_json.rb +263 -0
- data/lib/common_names.rb +49 -0
- data/lib/config.rb +260 -0
- data/lib/constants.rb +113 -0
- data/lib/data_tree.rb +205 -0
- data/lib/demo/autnum.json +228 -0
- data/lib/demo/domain-dnr.json +695 -0
- data/lib/demo/domain-rir.json +569 -0
- data/lib/demo/domains.json +625 -0
- data/lib/demo/entities.json +545 -0
- data/lib/demo/entity-dnr.json +143 -0
- data/lib/demo/entity-rir.json +394 -0
- data/lib/demo/error-code.json +31 -0
- data/lib/demo/help.json +58 -0
- data/lib/demo/ip.json +306 -0
- data/lib/demo/nameservers.json +434 -0
- data/lib/demo/ns-simple.json +210 -0
- data/lib/demo/ns-very-simple.json +41 -0
- data/lib/demo/ns.json +63 -0
- data/lib/demo/simple-ip.json +41 -0
- data/lib/demo/simple.json +13 -0
- data/lib/domain.rb +203 -0
- data/lib/ds_data.rb +70 -0
- data/lib/entity.rb +372 -0
- data/lib/enum.rb +47 -0
- data/lib/error_code.rb +56 -0
- data/lib/female-first-names.txt +4275 -0
- data/lib/ip.rb +86 -0
- data/lib/key_data.rb +70 -0
- data/lib/last-names.txt +88799 -0
- data/lib/male-first-names.txt +1219 -0
- data/lib/nicinfo_logger.rb +370 -0
- data/lib/nicinfo_main.rb +1013 -0
- data/lib/notices.rb +110 -0
- data/lib/ns.rb +108 -0
- data/lib/utils.rb +189 -0
- metadata +90 -0
data/lib/ip.rb
ADDED
@@ -0,0 +1,86 @@
|
|
1
|
+
# Copyright (C) 2011,2012,2013,2014 American Registry for Internet Numbers
|
2
|
+
#
|
3
|
+
# Permission to use, copy, modify, and/or distribute this software for any
|
4
|
+
# purpose with or without fee is hereby granted, provided that the above
|
5
|
+
# copyright notice and this permission notice appear in all copies.
|
6
|
+
#
|
7
|
+
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
8
|
+
# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
9
|
+
# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
10
|
+
# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
11
|
+
# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
12
|
+
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
|
13
|
+
# IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
14
|
+
|
15
|
+
require 'config'
|
16
|
+
require 'nicinfo_logger'
|
17
|
+
require 'utils'
|
18
|
+
require 'common_json'
|
19
|
+
require 'entity'
|
20
|
+
require 'data_tree'
|
21
|
+
|
22
|
+
module NicInfo
|
23
|
+
|
24
|
+
def NicInfo.display_ip json_data, config, data_tree
|
25
|
+
ip = Ip.new( config ).process( json_data )
|
26
|
+
NicInfo::display_object_with_entities( ip, config, data_tree )
|
27
|
+
end
|
28
|
+
|
29
|
+
# deals with RDAP IP network structures
|
30
|
+
class Ip
|
31
|
+
|
32
|
+
attr_accessor :entities, :objectclass, :asEventActors
|
33
|
+
|
34
|
+
def initialize config
|
35
|
+
@config = config
|
36
|
+
@common = CommonJson.new config
|
37
|
+
@entities = Array.new
|
38
|
+
@asEventActors = Array.new
|
39
|
+
end
|
40
|
+
|
41
|
+
def process json_data
|
42
|
+
@objectclass = json_data
|
43
|
+
@entities = @common.process_entities @objectclass
|
44
|
+
return self
|
45
|
+
end
|
46
|
+
|
47
|
+
def display
|
48
|
+
@config.logger.start_data_item
|
49
|
+
@config.logger.data_title "[ IP NETWORK ]"
|
50
|
+
@config.logger.terse "Handle", NicInfo::get_handle( @objectclass )
|
51
|
+
@config.logger.extra "Object Class Name", NicInfo::get_object_class_name( @objectclass )
|
52
|
+
@config.logger.terse "Start Address", NicInfo.get_startAddress( @objectclass )
|
53
|
+
@config.logger.terse "End Address", NicInfo.get_endAddress( @objectclass )
|
54
|
+
@config.logger.datum "IP Version", @objectclass[ "ipVersion" ]
|
55
|
+
@config.logger.extra "Name", NicInfo.get_name( @objectclass )
|
56
|
+
@config.logger.terse "Country", NicInfo.get_country( @objectclass )
|
57
|
+
@config.logger.datum "Type", NicInfo.get_type( @objectclass )
|
58
|
+
@config.logger.extra "Parent Handle", @objectclass[ "parentHandle" ]
|
59
|
+
@common.display_status @objectclass
|
60
|
+
@common.display_events @objectclass
|
61
|
+
@common.display_as_events_actors @asEventActors
|
62
|
+
@common.display_remarks @objectclass
|
63
|
+
@common.display_links( get_cn, @objectclass )
|
64
|
+
@config.logger.end_data_item
|
65
|
+
end
|
66
|
+
|
67
|
+
def get_cn
|
68
|
+
handle = NicInfo::get_handle @objectclass
|
69
|
+
if !handle
|
70
|
+
startAddress = NicInfo.get_startAddress @objectclass
|
71
|
+
handle << startAddress if startAddress
|
72
|
+
endAddress = NicInfo.get_endAddress @objectclass
|
73
|
+
handle << " - " if startAddress and endAddress
|
74
|
+
handle << endAddress if endAddress
|
75
|
+
end
|
76
|
+
return handle if handle
|
77
|
+
return "(unidentifiable network #{object_id})"
|
78
|
+
end
|
79
|
+
|
80
|
+
def to_node
|
81
|
+
DataNode.new( get_cn, nil, NicInfo::get_self_link( NicInfo::get_links( @objectclass, @config ) ) )
|
82
|
+
end
|
83
|
+
|
84
|
+
end
|
85
|
+
|
86
|
+
end
|
data/lib/key_data.rb
ADDED
@@ -0,0 +1,70 @@
|
|
1
|
+
# Copyright (C) 2011,2012,2013,2014 American Registry for Internet Numbers
|
2
|
+
#
|
3
|
+
# Permission to use, copy, modify, and/or distribute this software for any
|
4
|
+
# purpose with or without fee is hereby granted, provided that the above
|
5
|
+
# copyright notice and this permission notice appear in all copies.
|
6
|
+
#
|
7
|
+
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
8
|
+
# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
9
|
+
# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
10
|
+
# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
11
|
+
# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
12
|
+
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
|
13
|
+
# IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
14
|
+
|
15
|
+
require 'config'
|
16
|
+
require 'nicinfo_logger'
|
17
|
+
require 'utils'
|
18
|
+
require 'common_json'
|
19
|
+
require 'data_tree'
|
20
|
+
|
21
|
+
module NicInfo
|
22
|
+
|
23
|
+
def NicInfo.display_key_data json_data, config, data_node
|
24
|
+
key_data = KeyData.new( config ).process( json_data ).display
|
25
|
+
end
|
26
|
+
|
27
|
+
# deals with RDAP key data structures
|
28
|
+
class KeyData
|
29
|
+
|
30
|
+
attr_accessor :objectclass, :asEventActors
|
31
|
+
|
32
|
+
def initialize config
|
33
|
+
@config = config
|
34
|
+
@common = CommonJson.new config
|
35
|
+
@asEventActors = Array.new
|
36
|
+
end
|
37
|
+
|
38
|
+
def process json_data
|
39
|
+
@objectclass = json_data
|
40
|
+
return self
|
41
|
+
end
|
42
|
+
|
43
|
+
def display
|
44
|
+
@config.logger.start_data_item
|
45
|
+
@config.logger.data_title "[ KEY DATA ]"
|
46
|
+
@config.logger.terse "Algorithm", NicInfo::get_algorithm( @objectclass )
|
47
|
+
@config.logger.terse "Flags", @objectclass[ "flags" ]
|
48
|
+
@config.logger.terse "Protocol", @objectclass[ "protocol" ]
|
49
|
+
@config.logger.terse "Public Key", @objectclass[ "publicKey" ]
|
50
|
+
@common.display_events @objectclass
|
51
|
+
@common.display_as_events_actors @asEventActors
|
52
|
+
@config.logger.end_data_item
|
53
|
+
end
|
54
|
+
|
55
|
+
def get_cn
|
56
|
+
algorithm = NicInfo::DNSSEC_ALGORITHMS[ NicInfo::get_algorithm( @objectclass ) ]
|
57
|
+
algorithm = algorithm + " Key Data" if algorithm
|
58
|
+
algorithm = "(unidentifiable key data #{object_id})" if !algorithm
|
59
|
+
return algorithm
|
60
|
+
end
|
61
|
+
|
62
|
+
def to_node
|
63
|
+
node = DataNode.new( get_cn, nil, NicInfo::get_self_link( NicInfo::get_links( @objectclass, @config ) ) )
|
64
|
+
node.data_type=self.class.name
|
65
|
+
return node
|
66
|
+
end
|
67
|
+
|
68
|
+
end
|
69
|
+
|
70
|
+
end
|