ssh_scan 0.0.38.pre → 0.0.38

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/bin/ssh_scan +13 -28
  3. data/lib/ssh_scan/version.rb +1 -1
  4. metadata +3 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 58aac2fcecc90ba9f2ad0c148f10e7596a700e6d07257f0ba97808ec6b222ae2
4
- data.tar.gz: 75c59e14931ddc0d849136ae371f83093eddf429b3919df6d5677b0af4104da8
3
+ metadata.gz: 2256af6879617ca3c773dfe970eb2614923210c5e12c4a0e0195b07de6bd5dd6
4
+ data.tar.gz: 33e2317b550a08fd59baf2a6d8f6472cef671422552aca00453a612b72c12bae
5
5
  SHA512:
6
- metadata.gz: 5554e8a633d3a5aac0330956b6bcc0cbeee2f5b340bd6db874088f6120eaa1aad40634120937659df10092fb61878f819878b151715d7bec395d56d488e61f47
7
- data.tar.gz: c7af58d84e3f90d21c6a47ad9e35c623b8f64443527a705011d75a54403c2d256eccd59998a24e6dfe1d62bba2245e4cbfbfa3fea0314f8d28dfd6b894c661b4
6
+ metadata.gz: aa9c2bcc2ba4a8b959a2518e74dc55851d6e631f260de76d711acc350e32ecd8e10746ea8792661276d10d40e8651b9203cea533a8ec02e241a39f8577c225e4
7
+ data.tar.gz: 9319c177d2cf3eaca666f54c29367293ff525be8d9e6f04d17529b9488905529a01994a6c9ef4c37901a918b8aec72b0d3f2675458fc786ad0b7a8ceac0f8cd9
@@ -8,6 +8,7 @@ require 'netaddr'
8
8
  require 'optparse'
9
9
  require 'ssh_scan'
10
10
  require 'logger'
11
+ require 'yaml'
11
12
 
12
13
  #Default options
13
14
  options = {
@@ -18,7 +19,8 @@ options = {
18
19
  "threads" => 5,
19
20
  "verbosity" => nil,
20
21
  "logger" => Logger.new(STDERR),
21
- "fingerprint_database" => ENV['HOME']+'/.ssh_scan_fingerprints.yml'
22
+ "fingerprint_database" => ENV['HOME']+'/.ssh_scan_fingerprints.yml',
23
+ "output_type" => "json"
22
24
  }
23
25
 
24
26
  # Reorder arguments before parsing
@@ -107,6 +109,11 @@ scan") do |file|
107
109
  $stdout.reopen(file, "w")
108
110
  end
109
111
 
112
+ opts.on("--output-type [json, yaml]",
113
+ "Format to write stdout to json or yaml") do |output_type|
114
+ options["output_type"] = output_type
115
+ end
116
+
110
117
  opts.on("-p", "--port [PORT]", Array,
111
118
  "Port (Default: 22)") do |ports|
112
119
  temp = []
@@ -225,39 +232,17 @@ unless File.exist?(options["policy"])
225
232
  exit 1
226
233
  end
227
234
 
228
- # Check to see if we're running the latest released version
229
- #if !options["suppress_update_status"]
230
- # update = SSHScan::Update.new
231
- # if update.newer_gem_available?
232
- # options["logger"].warn(
233
- # "You're NOT using the latest version of ssh_scan, try 'gem update \
234
- #ssh_scan' to get the latest"
235
- # )
236
- # else
237
- # if update.errors.any?
238
- # update.errors.each do |error|
239
- # options["logger"].error(error)
240
- # end
241
- # else
242
- # options["logger"].info(
243
- # "You're using the latest version of ssh_scan #{SSHScan::VERSION}"
244
- # )
245
- # end
246
- # end
247
- #end
248
-
249
- # Limit scope of fingerprints DB to (per scan)
250
- # if options["fingerprint_database"] && File.exists?(options["fingerprint_database"])
251
- # File.unlink(options["fingerprint_database"])
252
- # end
253
-
254
235
  options["policy_file"] = SSHScan::Policy.from_file(options["policy"])
255
236
 
256
237
  # Perform scan and get results
257
238
  scan_engine = SSHScan::ScanEngine.new()
258
239
  results = scan_engine.scan(options)
259
240
 
260
- puts JSON.pretty_generate(results)
241
+ if options["output_type"] == "yaml"
242
+ puts YAML.dump(results)
243
+ elsif options["output_type"] == "json"
244
+ puts JSON.pretty_generate(results)
245
+ end
261
246
 
262
247
  if options["unit_test"] == true
263
248
  results.each do |result|
@@ -1,3 +1,3 @@
1
1
  module SSHScan
2
- VERSION = '0.0.38.pre'
2
+ VERSION = '0.0.38'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ssh_scan
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.38.pre
4
+ version: 0.0.38
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jonathan Claudius
@@ -228,9 +228,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
228
228
  version: '0'
229
229
  required_rubygems_version: !ruby/object:Gem::Requirement
230
230
  requirements:
231
- - - ">"
231
+ - - ">="
232
232
  - !ruby/object:Gem::Version
233
- version: 1.3.1
233
+ version: '0'
234
234
  requirements: []
235
235
  rubygems_version: 3.0.2
236
236
  signing_key: