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.
Files changed (47) hide show
  1. checksums.yaml +7 -0
  2. data/bin/nicinfo +22 -0
  3. data/lib/autnum.rb +90 -0
  4. data/lib/bootstrap.rb +198 -0
  5. data/lib/bsfiles/asn.json +2326 -0
  6. data/lib/bsfiles/dns.json +25 -0
  7. data/lib/bsfiles/entity.json +52 -0
  8. data/lib/bsfiles/ipv4.json +244 -0
  9. data/lib/bsfiles/ipv6.json +97 -0
  10. data/lib/cache.rb +141 -0
  11. data/lib/common_json.rb +263 -0
  12. data/lib/common_names.rb +49 -0
  13. data/lib/config.rb +260 -0
  14. data/lib/constants.rb +113 -0
  15. data/lib/data_tree.rb +205 -0
  16. data/lib/demo/autnum.json +228 -0
  17. data/lib/demo/domain-dnr.json +695 -0
  18. data/lib/demo/domain-rir.json +569 -0
  19. data/lib/demo/domains.json +625 -0
  20. data/lib/demo/entities.json +545 -0
  21. data/lib/demo/entity-dnr.json +143 -0
  22. data/lib/demo/entity-rir.json +394 -0
  23. data/lib/demo/error-code.json +31 -0
  24. data/lib/demo/help.json +58 -0
  25. data/lib/demo/ip.json +306 -0
  26. data/lib/demo/nameservers.json +434 -0
  27. data/lib/demo/ns-simple.json +210 -0
  28. data/lib/demo/ns-very-simple.json +41 -0
  29. data/lib/demo/ns.json +63 -0
  30. data/lib/demo/simple-ip.json +41 -0
  31. data/lib/demo/simple.json +13 -0
  32. data/lib/domain.rb +203 -0
  33. data/lib/ds_data.rb +70 -0
  34. data/lib/entity.rb +372 -0
  35. data/lib/enum.rb +47 -0
  36. data/lib/error_code.rb +56 -0
  37. data/lib/female-first-names.txt +4275 -0
  38. data/lib/ip.rb +86 -0
  39. data/lib/key_data.rb +70 -0
  40. data/lib/last-names.txt +88799 -0
  41. data/lib/male-first-names.txt +1219 -0
  42. data/lib/nicinfo_logger.rb +370 -0
  43. data/lib/nicinfo_main.rb +1013 -0
  44. data/lib/notices.rb +110 -0
  45. data/lib/ns.rb +108 -0
  46. data/lib/utils.rb +189 -0
  47. 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