norad_cli 0.1.23 → 0.1.24
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/Gemfile +1 -0
- data/Rakefile +1 -0
- data/lib/norad_cli/cli/main.rb +1 -0
- data/lib/norad_cli/cli/secrepo.rb +2 -1
- data/lib/norad_cli/cli/sectest.rb +25 -15
- data/lib/norad_cli/support/api_security_container_seed_script.rb +1 -0
- data/lib/norad_cli/support/manifest_spec.rb +1 -1
- data/lib/norad_cli/support/readme_spec.rb +1 -0
- data/lib/norad_cli/support/results_server.rb +1 -0
- data/lib/norad_cli/support/sectest_container.rb +1 -0
- data/lib/norad_cli/version.rb +2 -1
- data/lib/norad_cli.rb +1 -0
- data/norad_cli.gemspec +1 -0
- 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: f1089ae2c3cec35a4c705bd1815a64d104947bf7
|
4
|
+
data.tar.gz: 8aa75600ab12c1f623ebadf2f6a322bd41c16cb7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9f6e7dfbde96b1edf5c3ed35d3a536c5a8a8011380d066714e46f03f3e8c6c8a10e3723e119a300a0a021a761ba1c4638957366341184f540896291219f2e9ba
|
7
|
+
data.tar.gz: adef476de5591355f2bad229edb2cdf1cbef15fcfe18df170b8129d7c35f91f9701e005c26d703adb6343b20acd7c6fd3e5a41f8a9c955ed5e6b634b9e757844
|
data/Gemfile
CHANGED
data/Rakefile
CHANGED
data/lib/norad_cli/cli/main.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
+
|
2
3
|
require 'thor'
|
3
4
|
require 'git'
|
4
5
|
require 'docker'
|
@@ -20,7 +21,7 @@ class Repo < Thor
|
|
20
21
|
Git.init(repo_name)
|
21
22
|
|
22
23
|
# Create the necessary directories
|
23
|
-
%w
|
24
|
+
%w[base spec sectests].each do |dirrepo_name|
|
24
25
|
empty_directory "#{repo_name}/#{dirrepo_name}"
|
25
26
|
end
|
26
27
|
|
@@ -1,4 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
+
|
2
3
|
require 'thor'
|
3
4
|
require 'git'
|
4
5
|
require 'docker'
|
@@ -38,7 +39,7 @@ class Sectest < Thor
|
|
38
39
|
@@sectest_manifest['version'] = 'latest'
|
39
40
|
|
40
41
|
# Dynamically add options and description based on the needs of the sectest container
|
41
|
-
if %w
|
42
|
+
if %w[build build:all build:image build:specs execute].include?(ARGV[1]) && sectest_name && !sectest_name.start_with?('-', '--')
|
42
43
|
# Read in the program arguments
|
43
44
|
if File.exist?("sectests/#{sectest_name}/manifest.yml")
|
44
45
|
@@sectest_manifest = YAML.safe_load(File.read("sectests/#{sectest_name}/manifest.yml"))
|
@@ -77,7 +78,7 @@ class Sectest < Thor
|
|
77
78
|
repo_dir = Dir.pwd
|
78
79
|
|
79
80
|
# Check for valid test types
|
80
|
-
if !%w
|
81
|
+
if !%w[authenticated web_application brute_force ssl_crypto ssh_crypto whole_host].include?(options[:test_type])
|
81
82
|
say("#{options[:test_type]} is not a supported test type", :red)
|
82
83
|
say('Exiting...', :red)
|
83
84
|
exit(1)
|
@@ -277,25 +278,18 @@ class Sectest < Thor
|
|
277
278
|
|
278
279
|
desc 'validate:image SECTESTNAME', 'Validate SECTESTNAME manifest.yml and readme.md'
|
279
280
|
define_method 'validate:image' do |name|
|
280
|
-
|
281
|
-
ENV['sectest_name'] = name
|
282
|
-
RSpec.clear_examples
|
283
|
-
RSpec::Core::Runner.run(["#{File.dirname(File.expand_path(__FILE__))}/../support/readme_spec.rb"], $stderr, $stdout)
|
284
|
-
|
285
|
-
# Validate the manifest file
|
286
|
-
RSpec.clear_examples
|
287
|
-
RSpec::Core::Runner.run(["#{File.dirname(File.expand_path(__FILE__))}/../support/manifest_spec.rb"], $stderr, $stdout)
|
281
|
+
run_validations(name)
|
288
282
|
end
|
289
283
|
|
290
284
|
desc 'validate', 'Validate all manifest.yml and readme.md'
|
291
285
|
def validate
|
292
286
|
# Error check to ensure this is a plugin directory
|
293
|
-
Dir.glob('sectests/*').
|
287
|
+
files = Dir.glob('sectests/*').map do |f|
|
294
288
|
if File.directory? f
|
295
|
-
|
296
|
-
send('validate:image', f.split('/')[-1])
|
289
|
+
f.split('/')[-1]
|
297
290
|
end
|
298
|
-
end
|
291
|
+
end.compact
|
292
|
+
run_validations(*files)
|
299
293
|
end
|
300
294
|
|
301
295
|
no_tasks do
|
@@ -320,7 +314,7 @@ class Sectest < Thor
|
|
320
314
|
|
321
315
|
# Ensure commands are run from the root dir
|
322
316
|
def root_dir?
|
323
|
-
%w
|
317
|
+
%w[base spec sectests].each do |dirrepo_name|
|
324
318
|
if !File.exist?(dirrepo_name)
|
325
319
|
say("Commands must be run from the root of the test repository\nExiting....", :red)
|
326
320
|
exit(1)
|
@@ -359,5 +353,21 @@ class Sectest < Thor
|
|
359
353
|
end
|
360
354
|
exit(codes.detect(-> { 0 }, &:nonzero?))
|
361
355
|
end
|
356
|
+
|
357
|
+
def run_validations(*files)
|
358
|
+
codes = files.map do |file|
|
359
|
+
ENV['sectest_name'] = file
|
360
|
+
# Validate the readme file
|
361
|
+
say("Validating README for #{file}")
|
362
|
+
RSpec.clear_examples
|
363
|
+
RSpec::Core::Runner.run(["#{File.dirname(File.expand_path(__FILE__))}/../support/readme_spec.rb"], $stderr, $stdout)
|
364
|
+
|
365
|
+
# Validate the manifest file
|
366
|
+
say("Validating manifest.yml for #{file}")
|
367
|
+
RSpec.clear_examples
|
368
|
+
RSpec::Core::Runner.run(["#{File.dirname(File.expand_path(__FILE__))}/../support/manifest_spec.rb"], $stderr, $stdout)
|
369
|
+
end
|
370
|
+
exit(codes.detect(-> { 0 }, &:nonzero?))
|
371
|
+
end
|
362
372
|
end
|
363
373
|
end
|
@@ -1,4 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
+
|
2
3
|
require 'safe_yaml'
|
3
4
|
SafeYAML::OPTIONS[:default_mode] = :safe
|
4
5
|
|
@@ -66,7 +67,6 @@ describe Manifest do
|
|
66
67
|
CONFIG_SHIM = { ssh_user: '', ssh_key: '', target: '' }.freeze
|
67
68
|
it 'validates the manifest file of all containers' do
|
68
69
|
next if File.exist?("sectests/#{ENV['sectest_name']}/.parent_only")
|
69
|
-
puts "Looking for valid manifest in: #{p}..."
|
70
70
|
manifest = Manifest.new "sectests/#{ENV['sectest_name']}/manifest.yml"
|
71
71
|
ok
|
72
72
|
manifest_name_check(manifest)
|
data/lib/norad_cli/version.rb
CHANGED
data/lib/norad_cli.rb
CHANGED
data/norad_cli.gemspec
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.1.
|
4
|
+
version: 0.1.24
|
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-05-08 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: git
|