Sha256: 9783e2366714e2586a5f0ca4c6f951a0d00e585000215b674216c26932836e40
Contents?: true
Size: 1.59 KB
Versions: 23
Compression:
Stored size: 1.59 KB
Contents
#!/usr/bin/env ruby require 'norad_beacon' def run(args) timeout = 3600 # set timeout for runner to 1 hour # Allocate a runner runner = NoradBeacon::Runner.new('FIXME:FULL_PATH_TO_TOOL_IN_CONTAINER', ['FIXME:TOOL_OPTION', 'FIXME:TOOL_OPTION', 'FIXME:TOOL_OPTION'].flatten, timeout) # Execute the runner, write output to a file, and process runner.execute # Or Execute the runner and process stdout # runner.execute(true) # Ensure the tool created results runner.parse_results do |fh| ############################ # Parse the results # # JSON Example below # ############################ results_hash = JSON.parse(fh.read()) id = 'FIXME:SOME_ID' status = 'fail' # Possible status: pass, fail, error raw_output = 'FIXME: Any raw output' title = 'FIXME: Any title' description = 'FIXME: Any description' cvss = 'FIXME: CVSS score' # Add the result to the runner's result set # Note: Multiple results can be added, they will show up individually runner.result_set.add(NoradBeacon::Result.new(id, status, raw_output, title, description, cvss)) end rescue Exception => e puts "An exception occurred: #{e.inspect}" puts e.backtrace status = 'error' raw_output = 'Internal error occurred' title = 'Failed to run the tests' description = 'Internal error occurred' runner.result_set.add(NoradBeacon::Result.new('0', status, raw_output, title, description)) ensure # Save the results to Norad NoradBeacon::NoradAPI.post_results(runner.result_set) end run(ARGV)
Version data entries
23 entries across 23 versions & 1 rubygems
Version | Path |
---|---|
norad_cli-0.1.10 | lib/norad_cli/templates/tool/wrapper.rb.erb |
norad_cli-0.1.9 | lib/norad_cli/templates/tool/wrapper.rb.erb |
norad_cli-0.1.8 | lib/norad_cli/templates/tool/wrapper.rb.erb |