Sha256: d83435ae7c21f74a999362d6f4a8d2e3e582fcd268ae1c7c50837ba5e5940d19
Contents?: true
Size: 1.48 KB
Versions: 7
Compression:
Stored size: 1.48 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 runner.execute # 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
7 entries across 7 versions & 1 rubygems