nicinfo 1.0.0 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (48) hide show
  1. checksums.yaml +4 -4
  2. data/bin/nicinfo +9 -6
  3. data/lib/{autnum.rb → nicinfo/autnum.rb} +7 -7
  4. data/lib/{bootstrap.rb → nicinfo/bootstrap.rb} +1 -1
  5. data/lib/{bsfiles → nicinfo/bsfiles}/dns.json +9 -0
  6. data/lib/{cache.rb → nicinfo/cache.rb} +1 -1
  7. data/lib/{common_json.rb → nicinfo/common_json.rb} +5 -5
  8. data/lib/{config.rb → nicinfo/config.rb} +39 -4
  9. data/lib/{constants.rb → nicinfo/constants.rb} +6 -12
  10. data/lib/{data_tree.rb → nicinfo/data_tree.rb} +4 -4
  11. data/lib/{demo → nicinfo/demo}/domain-dnr.json +1 -1
  12. data/lib/{demo → nicinfo/demo}/domain-rir.json +1 -1
  13. data/lib/{demo → nicinfo/demo}/domains.json +2 -2
  14. data/lib/{domain.rb → nicinfo/domain.rb} +10 -10
  15. data/lib/{ds_data.rb → nicinfo/ds_data.rb} +6 -6
  16. data/lib/{entity.rb → nicinfo/entity.rb} +6 -6
  17. data/lib/{error_code.rb → nicinfo/error_code.rb} +4 -4
  18. data/lib/{ip.rb → nicinfo/ip.rb} +7 -7
  19. data/lib/{key_data.rb → nicinfo/key_data.rb} +6 -6
  20. data/lib/{nicinfo_logger.rb → nicinfo/nicinfo_logger.rb} +1 -1
  21. data/lib/{nicinfo_main.rb → nicinfo/nicinfo_main.rb} +43 -17
  22. data/lib/{notices.rb → nicinfo/notices.rb} +4 -4
  23. data/lib/{ns.rb → nicinfo/ns.rb} +7 -7
  24. data/lib/{utils.rb → nicinfo/utils.rb} +2 -2
  25. data/lib/nicinfo.rb +1 -0
  26. metadata +46 -45
  27. /data/lib/{bsfiles → nicinfo/bsfiles}/asn.json +0 -0
  28. /data/lib/{bsfiles → nicinfo/bsfiles}/entity.json +0 -0
  29. /data/lib/{bsfiles → nicinfo/bsfiles}/ipv4.json +0 -0
  30. /data/lib/{bsfiles → nicinfo/bsfiles}/ipv6.json +0 -0
  31. /data/lib/{common_names.rb → nicinfo/common_names.rb} +0 -0
  32. /data/lib/{demo → nicinfo/demo}/autnum.json +0 -0
  33. /data/lib/{demo → nicinfo/demo}/entities.json +0 -0
  34. /data/lib/{demo → nicinfo/demo}/entity-dnr.json +0 -0
  35. /data/lib/{demo → nicinfo/demo}/entity-rir.json +0 -0
  36. /data/lib/{demo → nicinfo/demo}/error-code.json +0 -0
  37. /data/lib/{demo → nicinfo/demo}/help.json +0 -0
  38. /data/lib/{demo → nicinfo/demo}/ip.json +0 -0
  39. /data/lib/{demo → nicinfo/demo}/nameservers.json +0 -0
  40. /data/lib/{demo → nicinfo/demo}/ns-simple.json +0 -0
  41. /data/lib/{demo → nicinfo/demo}/ns-very-simple.json +0 -0
  42. /data/lib/{demo → nicinfo/demo}/ns.json +0 -0
  43. /data/lib/{demo → nicinfo/demo}/simple-ip.json +0 -0
  44. /data/lib/{demo → nicinfo/demo}/simple.json +0 -0
  45. /data/lib/{enum.rb → nicinfo/enum.rb} +0 -0
  46. /data/lib/{female-first-names.txt → nicinfo/female-first-names.txt} +0 -0
  47. /data/lib/{last-names.txt → nicinfo/last-names.txt} +0 -0
  48. /data/lib/{male-first-names.txt → nicinfo/male-first-names.txt} +0 -0
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 66278c672634e66e08d0b658d009235205e29779
4
- data.tar.gz: ea11d90c9b091cada9868bf819b43787fd957fec
3
+ metadata.gz: 778d92017bdfb9471a17bd39e6e070f67fed5abf
4
+ data.tar.gz: c3d6f2ed8d71926a9559d08007f203abb1673015
5
5
  SHA512:
6
- metadata.gz: 37a795b43acb2f945d631b9c6d89467946a85e0658ae4393d34e3035de1708dffd91525dabdec3e4a13a27e7dc98d688a674e7f7a23809b6fab3e1dc7825b066
7
- data.tar.gz: 1c778ecbc6045a9b4e8b41f89a6d7e14166007f2d1d3a75130818be45031497ba8475bd17a38b1bb5b6978ea77f31a43d2cef8fcef5bc6e1afed10d8b7887f16
6
+ metadata.gz: 974f82679f0e019163d0a50ccff2ff0eed0209e27d44b7d7ac1de3929e9c3d0ab10a59de3ece6f448cc0cc6862e835447ac0c83fca3692c8f8b838bae2a3b5ff
7
+ data.tar.gz: a9c0b8309167c87e314fc3a8e22e30c4ef11bdd59155cb2717abac4e5e36ceb0595e9f6daea927c663651fe4094a7931777bafa6bf4fdacacc79a90aeceda15a
data/bin/nicinfo CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
- # Copyright (c) 2011,2012,2013 American Registry for Internet Numbers
2
+ # Copyright (c) 2011-2015 American Registry for Internet Numbers
3
3
  #
4
4
  # Permission to use, copy, modify, and/or distribute this software for any
5
5
  # purpose with or without fee is hereby granted, provided that the above
@@ -13,10 +13,13 @@
13
13
  # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
14
14
  # IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15
15
 
16
- $LOAD_PATH << File.join( File.dirname( File.expand_path(File.dirname(__FILE__) ) ), 'lib' )
17
-
18
- require 'nicinfo_main'
16
+ require 'rubygems'
17
+ begin
18
+ require 'nicinfo'
19
+ rescue LoadError
20
+ lib = File.expand_path("../lib",File.dirname(__FILE__))
21
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
22
+ require 'nicinfo'
23
+ end
19
24
  app = NicInfo::Main.new( ARGV )
20
25
  app.run()
21
-
22
-
@@ -12,12 +12,12 @@
12
12
  # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
13
13
  # IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
14
14
 
15
- require 'config'
16
- require 'nicinfo_logger'
17
- require 'utils'
18
- require 'common_json'
19
- require 'entity'
20
- require 'data_tree'
15
+ require 'nicinfo/config'
16
+ require 'nicinfo/nicinfo_logger'
17
+ require 'nicinfo/utils'
18
+ require 'nicinfo/common_json'
19
+ require 'nicinfo/entity'
20
+ require 'nicinfo/data_tree'
21
21
 
22
22
  module NicInfo
23
23
 
@@ -87,4 +87,4 @@ module NicInfo
87
87
 
88
88
  end
89
89
 
90
- end
90
+ end
@@ -13,7 +13,7 @@
13
13
  # IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
14
14
 
15
15
  require 'rexml/document'
16
- require 'constants'
16
+ require 'nicinfo/constants'
17
17
  require 'ipaddr'
18
18
  require 'json'
19
19
 
@@ -19,6 +19,15 @@
19
19
  "https://rdap.restfulwhois.org",
20
20
  "http://rdap.restfulwhois.org"
21
21
  ]
22
+ ],
23
+ [
24
+ [
25
+ "br"
26
+ ],
27
+ [
28
+ "https://rdap.beta.registro.br",
29
+ "http://rdap.beta.registro.br"
30
+ ]
22
31
  ]
23
32
  ]
24
33
  }
@@ -15,7 +15,7 @@
15
15
 
16
16
  require 'time'
17
17
  require 'uri'
18
- require 'utils'
18
+ require 'nicinfo/utils'
19
19
 
20
20
  module NicInfo
21
21
 
@@ -12,11 +12,11 @@
12
12
  # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
13
13
  # IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
14
14
 
15
- require 'config'
16
- require 'nicinfo_logger'
17
- require 'utils'
15
+ require 'nicinfo/config'
16
+ require 'nicinfo/nicinfo_logger'
17
+ require 'nicinfo/utils'
18
18
  require 'time'
19
- require 'entity'
19
+ require 'nicinfo/entity'
20
20
 
21
21
  module NicInfo
22
22
 
@@ -260,4 +260,4 @@ module NicInfo
260
260
 
261
261
  end
262
262
 
263
- end
263
+ end
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2011,2012,2013,2014 American Registry for Internet Numbers
1
+ # Copyright (C) 2011,2012,2013,2014,2015 American Registry for Internet Numbers
2
2
  #
3
3
  # Permission to use, copy, modify, and/or distribute this software for any
4
4
  # purpose with or without fee is hereby granted, provided that the above
@@ -14,10 +14,10 @@
14
14
 
15
15
 
16
16
  require 'fileutils'
17
- require 'nicinfo_logger'
17
+ require 'nicinfo/nicinfo_logger'
18
18
  require 'yaml'
19
19
  require 'ostruct'
20
- require 'constants'
20
+ require 'nicinfo/constants'
21
21
 
22
22
  module NicInfo
23
23
 
@@ -38,12 +38,13 @@ module NicInfo
38
38
 
39
39
  config_file_name = Config.formulate_config_file_name( @app_data )
40
40
  if File.exist?( config_file_name )
41
- @config = YAML.load( File.open( config_file_name ) )
41
+ @config = load_config( config_file_name )
42
42
  else
43
43
  @config = YAML.load( @@yaml_config )
44
44
  end
45
45
 
46
46
  configure_logger()
47
+
47
48
  end
48
49
 
49
50
  # Setups work space for the application and lays down default config
@@ -88,6 +89,31 @@ module NicInfo
88
89
 
89
90
  end
90
91
 
92
+ def check_config_version
93
+ # check to see if the configuration is old
94
+ config_section = @config[NicInfo::CONFIG]
95
+ if config_section != nil
96
+ config_version = config_section[NicInfo::VERSION_CONFIG]
97
+ end
98
+ if config_version == nil || config_version < NicInfo::CONFIG_VERSION
99
+ # if a reset hasn't been asked for
100
+ if !@options.reset_config
101
+ @logger.mesg( "Your configuration is old. Use --reset to create a new one.")
102
+ end
103
+ end
104
+ end
105
+
106
+ def load_config config_file_name
107
+ @config = YAML.load( @@yaml_config )
108
+ @config[NicInfo::CONFIG].delete(NicInfo::VERSION_CONFIG)
109
+ merger = proc do |key, v1, v2|
110
+ Hash === v1 && Hash === v2 ? v1.merge(v2, &merger) :
111
+ Array === v1 && Array === v2 ? v1 | v2 :
112
+ [:undefined, nil, :nil].include?(v2) ? v1 : v2
113
+ end
114
+ @config.merge!( YAML.load( File.open( config_file_name ) ), &merger )
115
+ end
116
+
91
117
  def copy_bsfiles
92
118
  src_dir = File.join( File.dirname( __FILE__ ), NicInfo::BOOTSTRAP_FILE_DIR )
93
119
  FileUtils::cp_r( src_dir, @rdap_bootstrap_dir )
@@ -253,6 +279,15 @@ search:
253
279
  # NOT YET USED
254
280
  substring: true
255
281
 
282
+ security:
283
+
284
+ # if HTTPS cannot be established, try HTTP
285
+ try_insecure: true
286
+
287
+ config:
288
+ # This should not be altered.
289
+ version: 3
290
+
256
291
  YAML_CONFIG
257
292
 
258
293
  end
@@ -18,9 +18,10 @@
18
18
 
19
19
  module NicInfo
20
20
 
21
- VERSION = "1.0.0"
21
+ VERSION = "1.1.0"
22
22
  VERSION_LABEL = "NicInfo v." + VERSION
23
23
  COPYRIGHT = "Copyright (c) 2011,2012,2013,2014,2015 American Registry for Internet Numbers (ARIN)"
24
+ CONFIG_VERSION = 3
24
25
 
25
26
  # regular expressions
26
27
  NET_HANDLE_REGEX = /^NET-.*/i
@@ -74,19 +75,12 @@ module NicInfo
74
75
  IP_ROOT_URL = "ip_root_url"
75
76
  AS_ROOT_URL = "as_root_url"
76
77
  DOMAIN_ROOT_URL = "domain_root_url"
77
- NS_ROOT_URL = "ns_root_url"
78
- ARIN_URL = "arin_url"
79
- RIPE_URL = "ripe_url"
80
- LACNIC_URL = "lacnic_url"
81
- APNIC_URL = "apnic_url"
82
- AFRINIC_URL = "afrinic_url"
83
- COM_URL = "com_url"
84
- NET_URL = "net_url"
85
- ORG_URL = "org_url"
86
- INFO_URL = "info_url"
87
- BIZ_URL = "biz_url"
88
78
  SEARCH = "search"
89
79
  SUBSTRING = "substring"
80
+ CONFIG = "config"
81
+ VERSION_CONFIG = "version"
82
+ SECURITY = "security"
83
+ TRY_INSECURE = "try_insecure"
90
84
 
91
85
  # NicInfo values
92
86
  NICINFO_DEMO_URL = "nicInfo_demoUrl"
@@ -14,7 +14,7 @@
14
14
 
15
15
 
16
16
  require 'yaml'
17
- require 'nicinfo_logger'
17
+ require 'nicinfo/nicinfo_logger'
18
18
 
19
19
  module NicInfo
20
20
 
@@ -143,9 +143,9 @@ module NicInfo
143
143
  print_tree = true unless root.children.empty?
144
144
  end
145
145
  num_count = 1
146
+ @logger.start_data_item if print_tree
147
+ @logger.prose( @data_amount, "[ RESPONSE DATA ]", " ")
146
148
  @roots.each do |root|
147
- @logger.start_data_item if print_tree
148
- @logger.prose( @data_amount, "[ RESPONSE DATA ]", " ")
149
149
  if annotate
150
150
  if root.alert
151
151
  s = format( " # %s", root.to_s )
@@ -170,8 +170,8 @@ module NicInfo
170
170
  child_num += 1 if child_num > 0
171
171
  end if root.children() != nil
172
172
  num_count += 1
173
- @logger.end_data_item
174
173
  end if print_tree
174
+ @logger.end_data_item if print_tree
175
175
  return retval
176
176
  end
177
177
 
@@ -57,7 +57,7 @@
57
57
  "identifier" : "1"
58
58
  }
59
59
  ],
60
- "nameServers":[
60
+ "nameservers":[
61
61
  {
62
62
  "handle":"ns1.example.com-001",
63
63
  "objectClassName":"nameserver",
@@ -23,7 +23,7 @@
23
23
  "handle":"192.in-addr.arpa-001",
24
24
  "objectClassName":"domain",
25
25
  "ldhName":"192.in-addr.arpa",
26
- "nameServers":[
26
+ "nameservers":[
27
27
  {
28
28
  "ldhName":"ns1.rir.example"
29
29
  },
@@ -43,7 +43,7 @@
43
43
  "handle":"192.in-addr.arpa-001",
44
44
  "objectClassName":"domain",
45
45
  "ldhName":"192.in-addr.arpa",
46
- "nameServers":[
46
+ "nameservers":[
47
47
  {
48
48
  "ldhName":"ns1.rir.example"
49
49
  },
@@ -334,7 +334,7 @@
334
334
  "handle":"199.in-addr.arpa-001",
335
335
  "objectClassName":"domain",
336
336
  "ldhName":"199.in-addr.arpa",
337
- "nameServers":[
337
+ "nameservers":[
338
338
  {
339
339
  "ldhName":"ns1.rir.example"
340
340
  },
@@ -12,15 +12,15 @@
12
12
  # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
13
13
  # IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
14
14
 
15
- require 'config'
16
- require 'nicinfo_logger'
17
- require 'utils'
18
- require 'common_json'
19
- require 'entity'
20
- require 'ns'
21
- require 'ds_data'
22
- require 'key_data'
23
- require 'data_tree'
15
+ require 'nicinfo/config'
16
+ require 'nicinfo/nicinfo_logger'
17
+ require 'nicinfo/utils'
18
+ require 'nicinfo/common_json'
19
+ require 'nicinfo/entity'
20
+ require 'nicinfo/ns'
21
+ require 'nicinfo/ds_data'
22
+ require 'nicinfo/key_data'
23
+ require 'nicinfo/data_tree'
24
24
 
25
25
  module NicInfo
26
26
 
@@ -200,4 +200,4 @@ module NicInfo
200
200
 
201
201
  end
202
202
 
203
- end
203
+ end
@@ -12,11 +12,11 @@
12
12
  # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
13
13
  # IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
14
14
 
15
- require 'config'
16
- require 'nicinfo_logger'
17
- require 'utils'
18
- require 'common_json'
19
- require 'data_tree'
15
+ require 'nicinfo/config'
16
+ require 'nicinfo/nicinfo_logger'
17
+ require 'nicinfo/utils'
18
+ require 'nicinfo/common_json'
19
+ require 'nicinfo/data_tree'
20
20
 
21
21
  module NicInfo
22
22
 
@@ -67,4 +67,4 @@ module NicInfo
67
67
 
68
68
  end
69
69
 
70
- end
70
+ end
@@ -12,11 +12,11 @@
12
12
  # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
13
13
  # IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
14
14
 
15
- require 'config'
16
- require 'nicinfo_logger'
17
- require 'utils'
18
- require 'common_json'
19
- require 'data_tree'
15
+ require 'nicinfo/config'
16
+ require 'nicinfo/nicinfo_logger'
17
+ require 'nicinfo/utils'
18
+ require 'nicinfo/common_json'
19
+ require 'nicinfo/data_tree'
20
20
 
21
21
  module NicInfo
22
22
 
@@ -369,4 +369,4 @@ module NicInfo
369
369
 
370
370
  end
371
371
 
372
- end
372
+ end
@@ -12,9 +12,9 @@
12
12
  # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
13
13
  # IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
14
14
 
15
- require 'config'
16
- require 'nicinfo_logger'
17
- require 'utils'
15
+ require 'nicinfo/config'
16
+ require 'nicinfo/nicinfo_logger'
17
+ require 'nicinfo/utils'
18
18
 
19
19
  module NicInfo
20
20
 
@@ -53,4 +53,4 @@ module NicInfo
53
53
 
54
54
  end
55
55
 
56
- end
56
+ end
@@ -12,12 +12,12 @@
12
12
  # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
13
13
  # IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
14
14
 
15
- require 'config'
16
- require 'nicinfo_logger'
17
- require 'utils'
18
- require 'common_json'
19
- require 'entity'
20
- require 'data_tree'
15
+ require 'nicinfo/config'
16
+ require 'nicinfo/nicinfo_logger'
17
+ require 'nicinfo/utils'
18
+ require 'nicinfo/common_json'
19
+ require 'nicinfo/entity'
20
+ require 'nicinfo/data_tree'
21
21
 
22
22
  module NicInfo
23
23
 
@@ -83,4 +83,4 @@ module NicInfo
83
83
 
84
84
  end
85
85
 
86
- end
86
+ end
@@ -12,11 +12,11 @@
12
12
  # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
13
13
  # IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
14
14
 
15
- require 'config'
16
- require 'nicinfo_logger'
17
- require 'utils'
18
- require 'common_json'
19
- require 'data_tree'
15
+ require 'nicinfo/config'
16
+ require 'nicinfo/nicinfo_logger'
17
+ require 'nicinfo/utils'
18
+ require 'nicinfo/common_json'
19
+ require 'nicinfo/data_tree'
20
20
 
21
21
  module NicInfo
22
22
 
@@ -67,4 +67,4 @@ module NicInfo
67
67
 
68
68
  end
69
69
 
70
- end
70
+ end
@@ -15,7 +15,7 @@
15
15
  # The run_pager code came from http://nex-3.com/posts/73-git-style-automatic-paging-in-ruby
16
16
  # and is credited to Nathan Weizenbaum
17
17
 
18
- require 'enum'
18
+ require 'nicinfo/enum'
19
19
 
20
20
  module NicInfo
21
21
 
@@ -17,21 +17,21 @@ require 'optparse'
17
17
  require 'net/http'
18
18
  require 'net/https'
19
19
  require 'uri'
20
- require 'config'
21
- require 'constants'
22
- require 'cache'
23
- require 'enum'
24
- require 'common_names'
25
- require 'bootstrap'
26
- require 'notices'
27
- require 'entity'
28
- require 'ip'
29
- require 'ns'
30
- require 'domain'
31
- require 'autnum'
32
- require 'error_code'
20
+ require 'nicinfo/config'
21
+ require 'nicinfo/constants'
22
+ require 'nicinfo/cache'
23
+ require 'nicinfo/enum'
24
+ require 'nicinfo/common_names'
25
+ require 'nicinfo/bootstrap'
26
+ require 'nicinfo/notices'
27
+ require 'nicinfo/entity'
28
+ require 'nicinfo/ip'
29
+ require 'nicinfo/ns'
30
+ require 'nicinfo/domain'
31
+ require 'nicinfo/autnum'
32
+ require 'nicinfo/error_code'
33
33
  require 'ipaddr'
34
- require 'data_tree'
34
+ require 'nicinfo/data_tree'
35
35
  begin
36
36
  require 'json'
37
37
  rescue LoadError
@@ -82,7 +82,7 @@ module NicInfo
82
82
  @opts = OptionParser.new do |opts|
83
83
 
84
84
  opts.banner = "Usage: nicinfo [options] QUERY_VALUE"
85
- opts.version = NicInfo::VERSION_LABEL
85
+ opts.version = NicInfo::VERSION
86
86
 
87
87
  opts.separator ""
88
88
  opts.separator "Query Options:"
@@ -222,6 +222,16 @@ module NicInfo
222
222
  @config.options.json_values << value
223
223
  end
224
224
 
225
+ opts.separator ""
226
+ opts.separator "Security Options:"
227
+
228
+ opts.on( "--try-insecure YES|NO|TRUE|FALSE",
229
+ "Try HTTP if HTTPS fails" ) do |try_insecure|
230
+ @config.config[ NicInfo::SECURITY ][ NicInfo::TRY_INSECURE ] = false if try_insecure =~ /no|false/i
231
+ @config.config[ NicInfo::SECURITY ][ NicInfo::TRY_INSECURE ] = true if try_insecure =~ /yes|true/i
232
+ raise OptionsParser::InvalidArgument, try_insecure.to_s unless try_insecure =~/yes|no|true|false/i
233
+ end
234
+
225
235
  opts.separator ""
226
236
  opts.separator "General Options:"
227
237
 
@@ -255,6 +265,10 @@ module NicInfo
255
265
  puts e.message
256
266
  puts "use -h for help"
257
267
  exit
268
+ rescue
269
+ puts "Unable to parse command line options"
270
+ puts "use -h for help"
271
+ exit
258
272
  end
259
273
  @config.options.argv = args
260
274
 
@@ -284,8 +298,19 @@ module NicInfo
284
298
  http.use_ssl=true
285
299
  http.verify_mode=OpenSSL::SSL::VERIFY_NONE
286
300
  end
287
- res = http.start do |http_req|
288
- http_req.request(req)
301
+
302
+ begin
303
+ res = http.start do |http_req|
304
+ http_req.request(req)
305
+ end
306
+ rescue OpenSSL::SSL::SSLError => e
307
+ if @config.config[ NicInfo::SECURITY ][ NicInfo::TRY_INSECURE ]
308
+ @config.logger.mesg( "Secure connection failed. Trying insecure connection." )
309
+ uri.scheme = "http"
310
+ return get( uri.to_s, try )
311
+ else
312
+ raise e
313
+ end
289
314
  end
290
315
 
291
316
  case res
@@ -351,6 +376,7 @@ module NicInfo
351
376
  @config.logger.run_pager
352
377
  @config.logger.mesg(NicInfo::VERSION_LABEL)
353
378
  @config.setup_workspace
379
+ @config.check_config_version
354
380
  @cache = Cache.new(@config)
355
381
  @cache.clean if @config.config[ NicInfo::CACHE ][ NicInfo::CLEAN_CACHE ]
356
382
 
@@ -12,9 +12,9 @@
12
12
  # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
13
13
  # IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
14
14
 
15
- require 'config'
16
- require 'nicinfo_logger'
17
- require 'utils'
15
+ require 'nicinfo/config'
16
+ require 'nicinfo/nicinfo_logger'
17
+ require 'nicinfo/utils'
18
18
 
19
19
  module NicInfo
20
20
 
@@ -107,4 +107,4 @@ module NicInfo
107
107
 
108
108
  end
109
109
 
110
- end
110
+ end
@@ -12,12 +12,12 @@
12
12
  # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
13
13
  # IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
14
14
 
15
- require 'config'
16
- require 'nicinfo_logger'
17
- require 'utils'
18
- require 'common_json'
19
- require 'entity'
20
- require 'data_tree'
15
+ require 'nicinfo/config'
16
+ require 'nicinfo/nicinfo_logger'
17
+ require 'nicinfo/utils'
18
+ require 'nicinfo/common_json'
19
+ require 'nicinfo/entity'
20
+ require 'nicinfo/data_tree'
21
21
 
22
22
  module NicInfo
23
23
 
@@ -105,4 +105,4 @@ module NicInfo
105
105
 
106
106
  end
107
107
 
108
- end
108
+ end
@@ -15,7 +15,7 @@
15
15
 
16
16
  require 'stringio'
17
17
  require 'uri'
18
- require 'config'
18
+ require 'nicinfo/config'
19
19
 
20
20
  module NicInfo
21
21
 
@@ -99,7 +99,7 @@ module NicInfo
99
99
  end
100
100
 
101
101
  def NicInfo.get_nameservers json_data
102
- return json_data[ "nameServers" ]
102
+ return json_data[ "nameservers" ]
103
103
  end
104
104
 
105
105
  def NicInfo.get_startAddress json_data
data/lib/nicinfo.rb ADDED
@@ -0,0 +1 @@
1
+ require 'nicinfo/nicinfo_main'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nicinfo
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Newton
@@ -18,50 +18,51 @@ extensions: []
18
18
  extra_rdoc_files: []
19
19
  files:
20
20
  - bin/nicinfo
21
- - lib/autnum.rb
22
- - lib/bootstrap.rb
23
- - lib/bsfiles/asn.json
24
- - lib/bsfiles/dns.json
25
- - lib/bsfiles/entity.json
26
- - lib/bsfiles/ipv4.json
27
- - lib/bsfiles/ipv6.json
28
- - lib/cache.rb
29
- - lib/common_json.rb
30
- - lib/common_names.rb
31
- - lib/config.rb
32
- - lib/constants.rb
33
- - lib/data_tree.rb
34
- - lib/demo/autnum.json
35
- - lib/demo/domain-dnr.json
36
- - lib/demo/domain-rir.json
37
- - lib/demo/domains.json
38
- - lib/demo/entities.json
39
- - lib/demo/entity-dnr.json
40
- - lib/demo/entity-rir.json
41
- - lib/demo/error-code.json
42
- - lib/demo/help.json
43
- - lib/demo/ip.json
44
- - lib/demo/nameservers.json
45
- - lib/demo/ns-simple.json
46
- - lib/demo/ns-very-simple.json
47
- - lib/demo/ns.json
48
- - lib/demo/simple-ip.json
49
- - lib/demo/simple.json
50
- - lib/domain.rb
51
- - lib/ds_data.rb
52
- - lib/entity.rb
53
- - lib/enum.rb
54
- - lib/error_code.rb
55
- - lib/female-first-names.txt
56
- - lib/ip.rb
57
- - lib/key_data.rb
58
- - lib/last-names.txt
59
- - lib/male-first-names.txt
60
- - lib/nicinfo_logger.rb
61
- - lib/nicinfo_main.rb
62
- - lib/notices.rb
63
- - lib/ns.rb
64
- - lib/utils.rb
21
+ - lib/nicinfo.rb
22
+ - lib/nicinfo/autnum.rb
23
+ - lib/nicinfo/bootstrap.rb
24
+ - lib/nicinfo/bsfiles/asn.json
25
+ - lib/nicinfo/bsfiles/dns.json
26
+ - lib/nicinfo/bsfiles/entity.json
27
+ - lib/nicinfo/bsfiles/ipv4.json
28
+ - lib/nicinfo/bsfiles/ipv6.json
29
+ - lib/nicinfo/cache.rb
30
+ - lib/nicinfo/common_json.rb
31
+ - lib/nicinfo/common_names.rb
32
+ - lib/nicinfo/config.rb
33
+ - lib/nicinfo/constants.rb
34
+ - lib/nicinfo/data_tree.rb
35
+ - lib/nicinfo/demo/autnum.json
36
+ - lib/nicinfo/demo/domain-dnr.json
37
+ - lib/nicinfo/demo/domain-rir.json
38
+ - lib/nicinfo/demo/domains.json
39
+ - lib/nicinfo/demo/entities.json
40
+ - lib/nicinfo/demo/entity-dnr.json
41
+ - lib/nicinfo/demo/entity-rir.json
42
+ - lib/nicinfo/demo/error-code.json
43
+ - lib/nicinfo/demo/help.json
44
+ - lib/nicinfo/demo/ip.json
45
+ - lib/nicinfo/demo/nameservers.json
46
+ - lib/nicinfo/demo/ns-simple.json
47
+ - lib/nicinfo/demo/ns-very-simple.json
48
+ - lib/nicinfo/demo/ns.json
49
+ - lib/nicinfo/demo/simple-ip.json
50
+ - lib/nicinfo/demo/simple.json
51
+ - lib/nicinfo/domain.rb
52
+ - lib/nicinfo/ds_data.rb
53
+ - lib/nicinfo/entity.rb
54
+ - lib/nicinfo/enum.rb
55
+ - lib/nicinfo/error_code.rb
56
+ - lib/nicinfo/female-first-names.txt
57
+ - lib/nicinfo/ip.rb
58
+ - lib/nicinfo/key_data.rb
59
+ - lib/nicinfo/last-names.txt
60
+ - lib/nicinfo/male-first-names.txt
61
+ - lib/nicinfo/nicinfo_logger.rb
62
+ - lib/nicinfo/nicinfo_main.rb
63
+ - lib/nicinfo/notices.rb
64
+ - lib/nicinfo/ns.rb
65
+ - lib/nicinfo/utils.rb
65
66
  homepage: https://github.com/arinlabs/nicinfo
66
67
  licenses:
67
68
  - ISC
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes