From a75e5480a1c009fe4efa87c0acbd9eff326dbfd9 Mon Sep 17 00:00:00 2001 From: Tiago Sintra Date: Tue, 4 Oct 2016 01:03:38 +0200 Subject: [PATCH] Update nessus.rb - Fix issues reported on #7391 Fixes various functions which invoked scan_export_status and were not processing the result correctly. The function now returns an array (from JSON.parse) instead of a string. Also it takes in consideration the "loading" stage of the export procedure. --- plugins/nessus.rb | 35 ++++++++++++++++++++++++++++------- 1 file changed, 28 insertions(+), 7 deletions(-) diff --git a/plugins/nessus.rb b/plugins/nessus.rb index 0190be19df..885ede095c 100644 --- a/plugins/nessus.rb +++ b/plugins/nessus.rb @@ -1174,8 +1174,15 @@ module Msf file_id = export["file"] print_good("The export file ID for scan ID #{scan_id} is #{file_id}") print_status("Checking export status...") - status = @n.scan_export_status(scan_id, file_id) - if status == "ready" + begin + status = @n.scan_export_status(scan_id, file_id) + print_status("Export status: " + status["status"]) + if status["status"]=="ready" + break + end + sleep(1) + end while (status["status"]=="loading") + if status["status"] == "ready" print_status("The status of scan ID #{scan_id} export is ready") select(nil, nil, nil, 5) report = @n.report_download(scan_id, file_id) @@ -1449,9 +1456,16 @@ module Msf if export["file"] file_id = export["file"] print_good("The export file ID for scan ID #{scan_id} is #{file_id}") - print_status("Checking export status...") - status = @n.scan_export_status(scan_id, file_id) - if status == "ready" + print_status("Checking export status...") + begin + status = @n.scan_export_status(scan_id, file_id) + print_status("Export status: " + status["status"]) + if status["status"]=="ready" + break + end + sleep(1) + end while (status["status"]=="loading") + if status["status"] == "ready" print_good("The status of scan ID #{scan_id} export is ready") else print_error("There was some problem in exporting the scan. The error message is #{status}") @@ -1477,8 +1491,15 @@ module Msf when 2 scan_id = args[0] file_id = args[1] - status = @n.scan_export_status(scan_id, file_id) - if status == "ready" + begin + status = @n.scan_export_status(scan_id, file_id) + print_status("Export status: " + status["status"]) + if status["status"]=="ready" + break + end + sleep(1) + end while (status["status"]=="loading") + if status["status"] == "ready" print_status("The status of scan ID #{scan_id} export is ready") else print_error("There was some problem in exporting the scan. The error message is #{status}")