Skip to content

Commit 2bd11f5

Browse files
committed
Land rapid7#7422, fix nessus_db_import command
Fix rapid7#7391
2 parents e139a1e + a75e548 commit 2bd11f5

File tree

1 file changed

+28
-7
lines changed

1 file changed

+28
-7
lines changed

plugins/nessus.rb

Lines changed: 28 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1174,8 +1174,15 @@ def cmd_nessus_db_import(*args)
11741174
file_id = export["file"]
11751175
print_good("The export file ID for scan ID #{scan_id} is #{file_id}")
11761176
print_status("Checking export status...")
1177-
status = @n.scan_export_status(scan_id, file_id)
1178-
if status == "ready"
1177+
begin
1178+
status = @n.scan_export_status(scan_id, file_id)
1179+
print_status("Export status: " + status["status"])
1180+
if status["status"]=="ready"
1181+
break
1182+
end
1183+
sleep(1)
1184+
end while (status["status"]=="loading")
1185+
if status["status"] == "ready"
11791186
print_status("The status of scan ID #{scan_id} export is ready")
11801187
select(nil, nil, nil, 5)
11811188
report = @n.report_download(scan_id, file_id)
@@ -1449,9 +1456,16 @@ def cmd_nessus_scan_export(*args)
14491456
if export["file"]
14501457
file_id = export["file"]
14511458
print_good("The export file ID for scan ID #{scan_id} is #{file_id}")
1452-
print_status("Checking export status...")
1453-
status = @n.scan_export_status(scan_id, file_id)
1454-
if status == "ready"
1459+
print_status("Checking export status...")
1460+
begin
1461+
status = @n.scan_export_status(scan_id, file_id)
1462+
print_status("Export status: " + status["status"])
1463+
if status["status"]=="ready"
1464+
break
1465+
end
1466+
sleep(1)
1467+
end while (status["status"]=="loading")
1468+
if status["status"] == "ready"
14551469
print_good("The status of scan ID #{scan_id} export is ready")
14561470
else
14571471
print_error("There was some problem in exporting the scan. The error message is #{status}")
@@ -1477,8 +1491,15 @@ def cmd_nessus_scan_export_status(*args)
14771491
when 2
14781492
scan_id = args[0]
14791493
file_id = args[1]
1480-
status = @n.scan_export_status(scan_id, file_id)
1481-
if status == "ready"
1494+
begin
1495+
status = @n.scan_export_status(scan_id, file_id)
1496+
print_status("Export status: " + status["status"])
1497+
if status["status"]=="ready"
1498+
break
1499+
end
1500+
sleep(1)
1501+
end while (status["status"]=="loading")
1502+
if status["status"] == "ready"
14821503
print_status("The status of scan ID #{scan_id} export is ready")
14831504
else
14841505
print_error("There was some problem in exporting the scan. The error message is #{status}")

0 commit comments

Comments
 (0)