nicinfo 1.3.0 → 1.4.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,238 @@
1
+ ; all_parts strict_all.jcr
2
+ ;
3
+ ; Override rules for strict RDAP checking.
4
+ ;
5
+
6
+ ;
7
+ ; Object class response
8
+ ;
9
+
10
+ ; start_part strict_object_classes.jcr
11
+ @{root} $entity_response = {
12
+ $response_mixin,
13
+ $entity_mixin,
14
+ @{not} $error_mixin,
15
+ @{not} $search_results
16
+ }
17
+
18
+ @{root} $nameserver_response = {
19
+ $response_mixin,
20
+ $nameserver_mixin,
21
+ @{not} $error_mixin,
22
+ @{not} $search_results
23
+ }
24
+
25
+ @{root} $domain_response = {
26
+ $response_mixin,
27
+ $domain_mixin,
28
+ @{not} $error_mixin,
29
+ @{not} $search_results
30
+ }
31
+
32
+ @{root} $network_response = {
33
+ $response_mixin,
34
+ $network_mixin,
35
+ @{not} $error_mixin,
36
+ @{not} $search_results
37
+ }
38
+
39
+ @{root} $autnum_response = {
40
+ $response_mixin,
41
+ $autnum_mixin,
42
+ @{not} $error_mixin,
43
+ @{not} $search_results
44
+ }
45
+ ; end_part
46
+ ;
47
+ ; Help and error response
48
+ ;
49
+
50
+ ; start_part strict_help_and_error.jcr
51
+ @{root} $error_response = {
52
+ $response_mixin,
53
+ $error_mixin,
54
+ @{not} $object_class,
55
+ @{not} $search_results
56
+ }
57
+
58
+ @{root} $help_response = {
59
+ $response_mixin,
60
+ $lang ?,
61
+ @{not} $error_mixin,
62
+ @{not} $object_class,
63
+ @{not} $search_results
64
+ }
65
+ ; end_part
66
+ ;
67
+ ; Search responses
68
+ ;
69
+
70
+ ; start_part strict_search_responses.jcr
71
+ @{root} $domainSearch_response = {
72
+ $response_mixin,
73
+ $lang ?,
74
+ $domainSearchResult,
75
+ @{not} $error_mixin,
76
+ @{not} $object_class
77
+ }
78
+
79
+ @{root} $nameserverSearch_response = {
80
+ $response_mixin,
81
+ $lang ?,
82
+ $nameserverSearchResult,
83
+ @{not} $error_mixin,
84
+ @{not} $object_class
85
+ }
86
+
87
+ @{root} $entitySearch_response = {
88
+ $response_mixin,
89
+ $lang ?,
90
+ $entitySearchResult,
91
+ @{not} $error_mixin,
92
+ @{not} $object_class
93
+ }
94
+ ; end_part
95
+ ;
96
+ ; Object class mixins
97
+ ;
98
+
99
+ ; start_part strict_object_class_mixins.jcr
100
+ $object_class = (
101
+ $entity_mixin |
102
+ $nameserver_mixin |
103
+ $domain_mixin |
104
+ $network_mixin |
105
+ $autnum_mixin
106
+ )
107
+ ; end_part
108
+ ;
109
+ ; All search results
110
+ ;
111
+
112
+ ; start_part strict_searches.jcr
113
+ $search_results = (
114
+ $domainSearchResult |
115
+ $nameserverSearchResult |
116
+ $entitySearchResult
117
+ )
118
+ ; end_part
119
+ ;
120
+ ; IANA Status Values
121
+ ;
122
+
123
+ ; start_part strict_iana_status_values.jcr
124
+ $status = "status" : [ $status_values * ]
125
+
126
+ $status_values = (
127
+ "validated" |
128
+ "renew prohibited" |
129
+ "update prohibited" |
130
+ "transfer prohibited" |
131
+ "delete prohibited" |
132
+ "proxy" |
133
+ "private" |
134
+ "removed" |
135
+ "obscured" |
136
+ "associated" |
137
+ "active" |
138
+ "inactive" |
139
+ "locked" |
140
+ "pending create" |
141
+ "pending renew" |
142
+ "pending transfer" |
143
+ "pending update" |
144
+ "pending delete" |
145
+ "add period" |
146
+ "auto renew period" |
147
+ "client delete prohibited" |
148
+ "client hold" |
149
+ "client renew prohibited" |
150
+ "client transfer prohibited" |
151
+ "client update prohibited" |
152
+ "pending restore" |
153
+ "redemption period" |
154
+ "renew period" |
155
+ "server delete prohibited" |
156
+ "server renew prohibited" |
157
+ "server transfer prohibited" |
158
+ "server update prohibited" |
159
+ "server hold" |
160
+ "transfer period"
161
+ )
162
+ ; end_part
163
+ ;
164
+ ; IANA Notice and Remark Types
165
+ ;
166
+
167
+ ; start_part strict_iana_notice_remark_types.jcr
168
+ $noticeRemarkType = "type" : $noticeRemarkType_values
169
+
170
+ $noticeRemarkType_values = (
171
+ "result set truncated due to authorization" |
172
+ "result set truncated due to excessive load" |
173
+ "result set truncated due to unexplainable reasons" |
174
+ "object truncated due to authorization" |
175
+ "object truncated due to excessive load" |
176
+ "object truncated due to unexplainable reasons"
177
+ )
178
+ ; end_part
179
+ ;
180
+ ; IANA Roles
181
+ ;
182
+
183
+ ; start_part strict_iana_roles.jcr
184
+ $roles = "roles" : [ $role_values * ]
185
+
186
+ $role_values = (
187
+ "registrant" |
188
+ "technical" |
189
+ "administrative" |
190
+ "abuse" |
191
+ "billing" |
192
+ "registrar" |
193
+ "reseller" |
194
+ "sponsor" |
195
+ "proxy" |
196
+ "notifications" |
197
+ "noc"
198
+ )
199
+
200
+ ; end_part
201
+ ;
202
+ ; IANA Domain Variant Relations
203
+ ;
204
+
205
+ ; start_part strict_iana_domain_variant_relations.jcr
206
+ $variantRelation = "relation" : [ $variantRelation_values * ]
207
+
208
+ $variantRelation_values = (
209
+ "registered" |
210
+ "unregistered" |
211
+ "registration restricted" |
212
+ "open registration" |
213
+ "conjoined"
214
+ )
215
+ ; end_part
216
+ ;
217
+ ; IANA Event Actions
218
+ ;
219
+
220
+ ; start_part strict_iana_event_actions.jcr
221
+ $eventAction = "eventAction" : $eventAction_values
222
+
223
+ $eventAction_values = (
224
+ "registration" |
225
+ "reregistration" |
226
+ "last changed" |
227
+ "expiration" |
228
+ "deletion" |
229
+ "reinstantiation" |
230
+ "transfer" |
231
+ "locked" |
232
+ "unlocked" |
233
+ "last update of RDAP database" |
234
+ "registrar expiration" |
235
+ "enum validation expiration"
236
+ )
237
+ ; end_part
238
+
@@ -17,6 +17,7 @@ require 'optparse'
17
17
  require 'net/http'
18
18
  require 'net/https'
19
19
  require 'uri'
20
+ require 'jcr'
20
21
  require 'nicinfo/config'
21
22
  require 'nicinfo/constants'
22
23
  require 'nicinfo/cache'
@@ -68,9 +69,17 @@ module NicInfo
68
69
 
69
70
  end
70
71
 
72
+ class JcrMode < NicInfo::Enum
73
+ JcrMode.add_item :NO_VALIDATION, "NONE"
74
+ JcrMode.add_item :STANDARD_VALIDATION, "STANDARD"
75
+ JcrMode.add_item :STRICT_VALIDATION, "STRICT"
76
+ end
77
+
71
78
  # The main class for the nicinfo command.
72
79
  class Main
73
80
 
81
+ attr_accessor :config, :cache, :jcr_context, :jcr_strict_context
82
+
74
83
  def initialize args, config = nil
75
84
 
76
85
  if config
@@ -80,6 +89,7 @@ module NicInfo
80
89
  end
81
90
 
82
91
  @config.options.require_query = true
92
+ @config.options.jcr = JcrMode::NO_VALIDATION
83
93
 
84
94
  @opts = OptionParser.new do |opts|
85
95
 
@@ -265,6 +275,15 @@ module NicInfo
265
275
  @config.options.require_query = false
266
276
  end
267
277
 
278
+ opts.on( "--jcr STANDARD|STRICT",
279
+ "Validate RDAP response with JCR") do |mode|
280
+ upmode = mode.upcase
281
+ raise OptionParser::InvalidArgument, type.to_s unless JcrMode.has_value?(upmode)
282
+ @config.options.jcr = upmode
283
+ get_jcr_context if upmode == JcrMode::STANDARD_VALIDATION
284
+ get_jcr_strict_context if upmode == JcrMode::STRICT_VALIDATION
285
+ end
286
+
268
287
  end
269
288
 
270
289
  begin
@@ -435,7 +454,7 @@ module NicInfo
435
454
 
436
455
  if @config.options.argv == nil || @config.options.argv == [] && !@config.options.query_type
437
456
  unless @config.options.require_query
438
- exit
457
+ return
439
458
  else
440
459
  help
441
460
  end
@@ -449,7 +468,7 @@ module NicInfo
449
468
  if json_data["data"] == nil || json_data["data"]["ip"] == nil
450
469
  @config.logger.mesg("Server repsonded with unknown JSON")
451
470
  @config.logger.mesg("Unable to determine your IP Address. You must specify it.")
452
- exit
471
+ return
453
472
  elsif
454
473
  @config.logger.mesg("Your IP address is " + json_data["data"]["ip"], NicInfo::AttentionType::SUCCESS )
455
474
  @config.options.argv[0] = json_data["data"]["ip"]
@@ -481,7 +500,7 @@ module NicInfo
481
500
  end
482
501
  else
483
502
  @config.logger.mesg( "#{@config.options.argv[0]} is not retrievable.")
484
- exit
503
+ return
485
504
  end
486
505
  elsif @config.options.query_type == QueryType::BY_URL
487
506
  @config.options.url = @config.options.argv[0]
@@ -491,7 +510,7 @@ module NicInfo
491
510
  end
492
511
  if @config.options.query_type == nil
493
512
  @config.logger.mesg("Unable to guess type of query. You must specify it.")
494
- exit
513
+ return
495
514
  else
496
515
  @config.logger.trace("Assuming query value is " + @config.options.query_type)
497
516
  end
@@ -626,7 +645,10 @@ module NicInfo
626
645
  handle_error_response e.response
627
646
  end
628
647
  @config.logger.trace("Server response code was " + e.response.code)
648
+ rescue Net::HTTPRetriableError => e
649
+ @config.logger.mesg("Too many redirections, retries, or a redirect loop has been detected." )
629
650
  end
651
+
630
652
  return retval
631
653
  end
632
654
 
@@ -655,42 +677,59 @@ module NicInfo
655
677
  case @config.options.query_type
656
678
  when QueryType::BY_IP4_ADDR
657
679
  NicInfo::display_ip( json_data, @config, data_tree )
680
+ do_jcr( json_data, NicInfo::JCR_ROOT_NETWORK )
658
681
  when QueryType::BY_IP6_ADDR
659
682
  NicInfo::display_ip( json_data, @config, data_tree )
683
+ do_jcr( json_data, NicInfo::JCR_ROOT_NETWORK )
660
684
  when QueryType::BY_IP4_CIDR
661
685
  NicInfo::display_ip( json_data, @config, data_tree )
686
+ do_jcr( json_data, NicInfo::JCR_ROOT_NETWORK )
662
687
  when QueryType::BY_IP6_CIDR
663
688
  NicInfo::display_ip( json_data, @config, data_tree )
689
+ do_jcr( json_data, NicInfo::JCR_ROOT_NETWORK )
664
690
  when QueryType::BY_IP
665
691
  NicInfo::display_ip( json_data, @config, data_tree )
692
+ do_jcr( json_data, NicInfo::JCR_ROOT_NETWORK )
666
693
  when QueryType::BY_AS_NUMBER
667
694
  NicInfo::display_autnum( json_data, @config, data_tree )
695
+ do_jcr( json_data, NicInfo::JCR_ROOT_AUTNUM )
668
696
  when "NicInfo::DsData"
669
697
  NicInfo::display_ds_data( json_data, @config, data_tree )
670
698
  when "NicInfo::KeyData"
671
699
  NicInfo::display_key_data( json_data, @config, data_tree )
672
700
  when QueryType::BY_DOMAIN
673
701
  NicInfo::display_domain( json_data, @config, data_tree )
702
+ do_jcr( json_data, NicInfo::JCR_ROOT_DOMAIN )
674
703
  when QueryType::BY_NAMESERVER
675
704
  NicInfo::display_ns( json_data, @config, data_tree )
705
+ do_jcr( json_data, NicInfo::JCR_ROOT_NAMESERVER )
676
706
  when QueryType::BY_ENTITY_HANDLE
677
707
  NicInfo::display_entity( json_data, @config, data_tree )
708
+ do_jcr( json_data, NicInfo::JCR_ROOT_ENTITY )
678
709
  when QueryType::SRCH_DOMAINS
679
710
  NicInfo::display_domains( json_data, @config, data_tree )
711
+ do_jcr( json_data, NicInfo::JCR_ROOT_DOMAIN_SEARCH )
680
712
  when QueryType::SRCH_DOMAIN_BY_NAME
681
713
  NicInfo::display_domains( json_data, @config, data_tree )
714
+ do_jcr( json_data, NicInfo::JCR_ROOT_DOMAIN_SEARCH )
682
715
  when QueryType::SRCH_DOMAIN_BY_NSNAME
683
716
  NicInfo::display_domains( json_data, @config, data_tree )
717
+ do_jcr( json_data, NicInfo::JCR_ROOT_DOMAIN_SEARCH )
684
718
  when QueryType::SRCH_DOMAIN_BY_NSIP
685
719
  NicInfo::display_domains( json_data, @config, data_tree )
720
+ do_jcr( json_data, NicInfo::JCR_ROOT_DOMAIN_SEARCH )
686
721
  when QueryType::SRCH_ENTITY_BY_NAME
687
722
  NicInfo::display_entities( json_data, @config, data_tree )
723
+ do_jcr( json_data, NicInfo::JCR_ROOT_ENTITY_SEARCH )
688
724
  when QueryType::SRCH_NS
689
725
  NicInfo::display_nameservers( json_data, @config, data_tree )
726
+ do_jcr( json_data, NicInfo::JCR_ROOT_NAMESERVER_SEARCH )
690
727
  when QueryType::SRCH_NS_BY_NAME
691
728
  NicInfo::display_nameservers( json_data, @config, data_tree )
729
+ do_jcr( json_data, NicInfo::JCR_ROOT_NAMESERVER_SEARCH )
692
730
  when QueryType::SRCH_NS_BY_IP
693
731
  NicInfo::display_nameservers( json_data, @config, data_tree )
732
+ do_jcr( json_data, NicInfo::JCR_ROOT_NAMESERVER_SEARCH )
694
733
  end
695
734
  @config.save_as_yaml( NicInfo::LASTTREE_YAML, data_tree ) if !data_tree.empty?
696
735
  show_search_results_truncated json_data
@@ -721,6 +760,53 @@ module NicInfo
721
760
  end
722
761
  end
723
762
 
763
+ def get_jcr_context
764
+ if @jcr_context != nil
765
+ return @jcr_context
766
+ end
767
+ #else
768
+ ruleset_file = File.join( File.dirname( __FILE__ ), NicInfo::JCR_DIR, NicInfo::RDAP_JCR )
769
+ ruleset = File.open( ruleset_file ).read
770
+ @jcr_context = JCR::Context.new(ruleset, false )
771
+ return @jcr_context
772
+ end
773
+
774
+ def get_jcr_strict_context
775
+ if @jcr_strict_context != nil
776
+ return @jcr_strict_context
777
+ end
778
+ #else
779
+ strict_file = File.join( File.dirname( __FILE__ ), NicInfo::JCR_DIR, NicInfo::STRICT_RDAP_JCR )
780
+ strict = File.open( strict_file ).read
781
+ rdap_context = get_jcr_context()
782
+ @jcr_strict_context = rdap_context.override(strict )
783
+ return @jcr_strict_context
784
+ end
785
+
786
+ def do_jcr( json_data, root_name )
787
+
788
+ jcr_context = nil
789
+ if config.options.jcr == JcrMode::STANDARD_VALIDATION
790
+ config.logger.trace( "Standard JSON Content Rules validation mode enabled.")
791
+ jcr_context = get_jcr_context()
792
+ elsif config.options.jcr == JcrMode::STRICT_VALIDATION
793
+ config.logger.trace( "Strict JSON Content Rules validation mode enabled.")
794
+ jcr_context = get_jcr_strict_context()
795
+ else
796
+ return
797
+ end
798
+
799
+ e1 = jcr_context.evaluate( json_data, root_name )
800
+
801
+ unless e1.success
802
+ jcr_context.failure_report.each do |line|
803
+ config.conf_msgs << line
804
+ end
805
+ else
806
+ config.logger.trace( "JSON Content Rules validation was successful." )
807
+ end
808
+ end
809
+
724
810
  def help
725
811
 
726
812
  puts NicInfo::VERSION_LABEL
@@ -978,8 +1064,9 @@ HELP_SUMMARY
978
1064
  return if @config.conf_msgs.size == 0
979
1065
  @config.logger.mesg( "** WARNING: There are problems in the response that might cause some data to discarded. **", NicInfo::AttentionType::ERROR )
980
1066
  i = 1
1067
+ pad = @config.conf_msgs.length.to_s.length
981
1068
  @config.conf_msgs.each do |msg|
982
- @config.logger.trace( "#{i} : #{msg}", NicInfo::AttentionType::ERROR )
1069
+ @config.logger.trace( "#{i.to_s.rjust(pad," ")} : #{msg}", NicInfo::AttentionType::ERROR )
983
1070
  i = i + 1
984
1071
  end
985
1072
  end
@@ -1032,7 +1119,7 @@ HELP_SUMMARY
1032
1119
 
1033
1120
  QUERIES
1034
1121
  For most query values, the query type is inferred. However, some types of queries
1035
- cannot be inferred and so the -t option must be used. The domain search by name
1122
+ cannot be inferred and so the -t parameter must be used. The domain search by name
1036
1123
  (dsbyname) and entity search by name (esbyname) queries can take wildcards ('*'),
1037
1124
  but these must be quoted or escaped to avoid processing by the invoking OS shell
1038
1125
  on Unix-like operating systems.
@@ -1054,11 +1141,11 @@ CONFIGURATION
1054
1141
 
1055
1142
  CACHING
1056
1143
  This program will write query responses to a cache. By default, answers are pulled
1057
- from the cache if present. This can be turned on or off with the --cache option or
1144
+ from the cache if present. This can be turned on or off with the --cache parameter or
1058
1145
  using the cache/use_cache value in the configuration file.
1059
1146
 
1060
1147
  Expiration of items in the cache and eviction of items from the cache can also be
1061
- controlled. The cache can be manually emptied using the --empty-cache option.
1148
+ controlled. The cache can be manually emptied using the --empty-cache parameter.
1062
1149
 
1063
1150
  BOOTSTRAPPING
1064
1151
  Bootstrapping is the process of finding an appropriate RDAP server in which to send
@@ -1079,15 +1166,15 @@ BOOTSTRAPPING
1079
1166
  configuration file).
1080
1167
 
1081
1168
  USAGE FOR SCRIPTING
1082
- For usage with shell scripting, there are a couple of useful command line switches.
1169
+ For usage with shell scripting, there are a couple of useful command line parameters.
1083
1170
 
1084
- The --json option suppresses the human-readable output and instead emits the JSON
1171
+ The --json parameter suppresses the human-readable output and instead emits the JSON
1085
1172
  returned by the server. When not writing to an output file, this options should be
1086
1173
  used with the -Q option to suppress the pager and program runtime messages so that
1087
1174
  the JSON maybe run through a JSON parser.
1088
1175
 
1089
- The --jv option instructs this program to parse the JSON and emit specific JSON
1090
- values. This option is also useful in combination with the -Q option to feed the
1176
+ The --jv parameter instructs this program to parse the JSON and emit specific JSON
1177
+ values. This parameter is also useful in combination with the -Q option to feed the
1091
1178
  JSON values into other programs. The syntax for specifying a JSON value is a
1092
1179
  list of JSON object member names or integers signifying JSON array indexes separated
1093
1180
  by a period, such as name1.name2.3.name4.5. For example, "entities.0.handle" would
@@ -1095,16 +1182,27 @@ USAGE FOR SCRIPTING
1095
1182
 
1096
1183
  { "entities" : [ { "handle": "foo" } ] }
1097
1184
 
1098
- Multiple --jv options may be specified.
1185
+ Multiple --jv parameters may be specified.
1099
1186
 
1100
1187
  DEMONSTRATION QUERIES
1101
1188
  There are several built-in demonstration queries that may be exercised to show the
1102
- utility of RDAP. To use these queries, the --demo option must be used to populate
1189
+ utility of RDAP. To use these queries, the --demo parameter must be used to populate
1103
1190
  the query answers into the cache. If the cache is already populated with items, it
1104
- may be necessary to clean the cache using the --empty-cache option.
1191
+ may be necessary to clean the cache using the --empty-cache parameter.
1105
1192
 
1106
- When the --demo option is given, the list of demonstration queries will be printed
1193
+ When the --demo parameter is given, the list of demonstration queries will be printed
1107
1194
  out.
1195
+
1196
+ RDAP VALIDATION
1197
+ This program has built-in checks for verifying the validity of RDAP responses.
1198
+ Beyond these normal built-in checks, it can also JSON Content Rules to check
1199
+ the validity of the responses using the --jcr parameter, which requires either
1200
+ the standard (i.e. --jcr standard) or strict (i.e. --jcr strict) parameter
1201
+ options.
1202
+
1203
+ MORE INFORMATION
1204
+ More information about this program may be found at
1205
+ https://github.com/arineng/nicinfo/wiki
1108
1206
  EXTENDED_HELP
1109
1207
 
1110
1208
  end
@@ -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 is_excessive_notice notices
@@ -92,22 +94,7 @@ module NicInfo
92
94
  @config.conf_msgs << "'description' in 'notice' is not an array."
93
95
  end
94
96
  links = notice[ "links" ]
95
- if links
96
- if links.instance_of?( Array )
97
- alternate = NicInfo.get_alternate_link links
98
- @config.logger.prose NicInfo::DataAmount::NORMAL_DATA, "More", alternate, NicInfo::AttentionType::SECONDARY if alternate
99
- about = NicInfo.get_about_link links
100
- @config.logger.prose NicInfo::DataAmount::NORMAL_DATA, "About", about, NicInfo::AttentionType::SECONDARY if about
101
- tos = NicInfo.get_tos_link links
102
- @config.logger.prose NicInfo::DataAmount::NORMAL_DATA, "TOS", tos, NicInfo::AttentionType::SECONDARY if tos
103
- copyright = NicInfo.get_copyright_link links
104
- @config.logger.prose NicInfo::DataAmount::NORMAL_DATA, "(C)", copyright, NicInfo::AttentionType::SECONDARY if copyright
105
- license = NicInfo.get_license_link links
106
- @config.logger.prose NicInfo::DataAmount::NORMAL_DATA, "License", license, NicInfo::AttentionType::SECONDARY if license
107
- else
108
- @config.conf_msgs << "'links' is not an array."
109
- end
110
- end
97
+ @common.display_simple_links( links )
111
98
  @config.logger.end_data_item
112
99
  end
113
100
 
data/lib/nicinfo/ns.rb CHANGED
@@ -66,7 +66,7 @@ module NicInfo
66
66
  @config.logger.start_data_item
67
67
  @config.logger.data_title "[ NAME SERVER ]"
68
68
  @config.logger.terse "Handle", NicInfo::get_handle( @objectclass ), NicInfo::AttentionType::SUCCESS
69
- @config.logger.extra "Object Class Name", NicInfo::get_object_class_name( @objectclass )
69
+ @config.logger.extra "Object Class Name", NicInfo::get_object_class_name( @objectclass, "nameserver", @config )
70
70
  @config.logger.terse "Host Name", NicInfo::get_ldhName( @objectclass ), NicInfo::AttentionType::SUCCESS
71
71
  @config.logger.terse "IDN Host Name", NicInfo::get_unicodeName( @objectclass ), NicInfo::AttentionType::SUCCESS
72
72
  ipAddrs = @objectclass[ "ipAddresses" ]
data/lib/nicinfo/utils.rb CHANGED
@@ -55,8 +55,14 @@ module NicInfo
55
55
  return json_data[ "handle" ]
56
56
  end
57
57
 
58
- def NicInfo.get_object_class_name json_data
59
- return json_data[ "objectClassName" ]
58
+ def NicInfo.get_object_class_name json_data, expected, config
59
+ objectClassName = json_data[ "objectClassName" ]
60
+ if objectClassName == nil
61
+ config.conf_msgs << "Expected 'objectClassName' is not present."
62
+ elsif objectClassName != expected
63
+ config.conf_msgs << "Expected 'objectClassName' to be '#{expected}' but it is '#{objectClassName}'."
64
+ end
65
+ return objectClassName
60
66
  end
61
67
 
62
68
  def NicInfo.get_ldhName json_data
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nicinfo
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.0
4
+ version: 1.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Newton
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-12-27 00:00:00.000000000 Z
11
+ date: 2018-01-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: netaddr
@@ -30,6 +30,34 @@ dependencies:
30
30
  - - ">="
31
31
  - !ruby/object:Gem::Version
32
32
  version: 1.5.1
33
+ - !ruby/object:Gem::Dependency
34
+ name: rainbow
35
+ requirement: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - "~>"
38
+ - !ruby/object:Gem::Version
39
+ version: '3.0'
40
+ type: :runtime
41
+ prerelease: false
42
+ version_requirements: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - "~>"
45
+ - !ruby/object:Gem::Version
46
+ version: '3.0'
47
+ - !ruby/object:Gem::Dependency
48
+ name: jcrvalidator
49
+ requirement: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - '='
52
+ - !ruby/object:Gem::Version
53
+ version: 0.8.3
54
+ type: :runtime
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - '='
59
+ - !ruby/object:Gem::Version
60
+ version: 0.8.3
33
61
  description: A command-line RDAP client.
34
62
  email: andy@arin.net
35
63
  executables:
@@ -77,6 +105,8 @@ files:
77
105
  - lib/nicinfo/factory.rb
78
106
  - lib/nicinfo/female-first-names.txt
79
107
  - lib/nicinfo/ip.rb
108
+ - lib/nicinfo/jcr/rdap.jcr
109
+ - lib/nicinfo/jcr/strict.jcr
80
110
  - lib/nicinfo/key_data.rb
81
111
  - lib/nicinfo/last-names.txt
82
112
  - lib/nicinfo/male-first-names.txt