norad_cli 0.2.0 → 0.2.1
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 +4 -4
- data/lib/norad_cli/cli/sectest.rb +16 -2
- data/lib/norad_cli/support/manifest_spec.rb +3 -1
- data/lib/norad_cli/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3e3063cd4907e612894a79f1355b7fd550ecc25c
|
4
|
+
data.tar.gz: 960742bba7ea52a70b425d9c46af4aa35ed5cad7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 176111f240083608fcfa4e9906bf054d0d6de427c73d215752388aebc56eecc9284ec5025def2d7389abdb3d5180dcfad7b8eb0a7e04695d55f8592695ceeacc
|
7
|
+
data.tar.gz: d8f0a0bc199330a03a43c39c0503a3939e90dede9b30747f8163b9d2128ba2d937f28c60964acd767b2a9740b52ba1eb7b22b2e21545ba7f6c4de4bcbb3eba77
|
@@ -67,6 +67,9 @@ class Sectest < Thor
|
|
67
67
|
# Correct set default registry and version
|
68
68
|
load_manifest(ARGV[2])
|
69
69
|
|
70
|
+
# Used to prevent JSON::ParserError when parsing the output stream
|
71
|
+
Docker.options[:chunk_size] = 1
|
72
|
+
|
70
73
|
desc 'scaffold TESTNAME', 'Create a new security test with standard files + testing'
|
71
74
|
option :test_type, aliases: '-t', default: 'whole_host', desc: 'The security test type, Options: [authenticated|web_application|brute_force|ssl_crypto|ssh_crypto|whole_host]'
|
72
75
|
option :registry, aliases: '-r', default: @@sectest_manifest['registry'], desc: 'The Docker registry to store docker images'
|
@@ -153,7 +156,7 @@ class Sectest < Thor
|
|
153
156
|
imgs_to_build.keys.reverse_each do |img_dir|
|
154
157
|
say("Building image #{img_dir}...", :green)
|
155
158
|
Docker::Image.build_from_dir(img_dir, t: imgs_to_build[img_dir]) do |v|
|
156
|
-
|
159
|
+
parse_json v if options[:debug]
|
157
160
|
end
|
158
161
|
end
|
159
162
|
end
|
@@ -179,7 +182,7 @@ class Sectest < Thor
|
|
179
182
|
docker_file = img_dir.split('/')[-1]
|
180
183
|
nocache = docker_file['no-cache'] ? true : false
|
181
184
|
Docker::Image.build_from_dir(img_dir.gsub(docker_file, ''), dockerfile: docker_file, t: imgs_to_build[img_dir], nocache: nocache) do |v|
|
182
|
-
|
185
|
+
parse_json v if options[:debug]
|
183
186
|
end
|
184
187
|
end
|
185
188
|
|
@@ -371,4 +374,15 @@ class Sectest < Thor
|
|
371
374
|
exit(codes.detect(-> { 0 }, &:nonzero?))
|
372
375
|
end
|
373
376
|
end
|
377
|
+
|
378
|
+
private
|
379
|
+
|
380
|
+
def parse_json(stream)
|
381
|
+
stream.split(/\r\n/).each do |string|
|
382
|
+
parsed = JSON.parse(string)
|
383
|
+
$stdout.print(parsed['stream']) if parsed.is_a?(Hash)
|
384
|
+
end
|
385
|
+
rescue JSON::ParserError
|
386
|
+
$stdout.print stream
|
387
|
+
end
|
374
388
|
end
|
@@ -1,5 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
# rubocop:disable Style/FormatStringToken
|
3
4
|
require 'safe_yaml'
|
4
5
|
SafeYAML::OPTIONS[:default_mode] = :safe
|
5
6
|
|
@@ -79,7 +80,7 @@ describe Manifest do
|
|
79
80
|
expect(manifest.values['prog_args']).to_not eq(nil)
|
80
81
|
expect(manifest.values['prog_args'].scan('%{target}').length).to eq(1)
|
81
82
|
category = manifest.values['category']
|
82
|
-
assert false unless
|
83
|
+
assert false unless %w[whitebox blackbox].include? category
|
83
84
|
if category == 'blackbox'
|
84
85
|
expect(manifest.values['prog_args'].scan('%{ssh_user}').length).to eq(0)
|
85
86
|
expect(manifest.values['prog_args'].scan('%{ssh_key}').length).to eq(0)
|
@@ -116,3 +117,4 @@ describe Manifest do
|
|
116
117
|
puts
|
117
118
|
end
|
118
119
|
end
|
120
|
+
# rubocop:enable Style/FormatStringToken
|
data/lib/norad_cli/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: norad_cli
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Blake Hitchcock
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2017-
|
13
|
+
date: 2017-07-18 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: git
|