bin/pwn_bdba_scan in pwn-0.4.787 vs bin/pwn_bdba_scan in pwn-0.4.788

- old
+ new

@@ -25,10 +25,14 @@ options.on('-rPATH', '--report=PATH', '<Required - Path to Save Black Duck Binary Analysis Scan Report>') do |r| opts[:report_path] = r end + options.on('-R', '--report-only', '<Optional - Only Generate a Black Duck Binary Analysis Scan Report for an Existing Scan (Default: false)>') do |o| + opts[:report_only] = o + end + options.on('-tTYPE', '--report-type=TYPE', '<Optional - Black Duck Binary Analysis Scan Report Type csv_libs|csv_vulns|pdf (Default: csv_vulns)>') do |t| opts[:report_type] = t end end.parse! @@ -56,10 +60,12 @@ raise "ERROR: BDBA Target File Not Found: #{target_file}" unless File.exist?(target_file) report_path = opts[:report_path] raise "ERROR: BDBA Report Path Not Provided: #{report_path}" if report_path.nil? + report_only = opts[:report_only] ||= false + report_type_str = opts[:report_type] ||= 'csv_vulns' report_type = report_type_str.to_s.to_sym groups_resp = PWN::Plugins::BlackDuckBinaryAnalysis.get_groups( token: token @@ -69,15 +75,17 @@ raise "ERROR: BDBA Parent Group Not Found: #{parent_group_name}" if parent_arr.nil? sorted_parent_arr = parent_arr.sort_by { |g| g[:id] } parent_id = sorted_parent_arr.last[:id] - puts "Uploading/Scanning: #{target_file}" - PWN::Plugins::BlackDuckBinaryAnalysis.upload_file( - token: token, - file: target_file, - group_id: parent_id - ) + unless report_only + puts "Uploading/Scanning: #{target_file}" + PWN::Plugins::BlackDuckBinaryAnalysis.upload_file( + token: token, + file: target_file, + group_id: parent_id + ) + end scan_progress_resp = {} loop do scan_progress_resp = PWN::Plugins::BlackDuckBinaryAnalysis.get_apps_by_group( token: token,