From b73cfa51d92976535d6bf5b77b5e8d786b33da7d Mon Sep 17 00:00:00 2001 From: Red5d Date: Tue, 31 May 2016 15:08:17 -0400 Subject: [PATCH 1/2] Use a different method for getting engine versions The previous method of parsing the output of the "version engines" console command doesn't always work. The console command sometimes doesn't return data. This AJAX post method is what the web UI uses to get the engine data. It returns an array of engine data hash objects. --- lib/nexpose/manage.rb | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/lib/nexpose/manage.rb b/lib/nexpose/manage.rb index fd99ea7a..c4dd5a9e 100644 --- a/lib/nexpose/manage.rb +++ b/lib/nexpose/manage.rb @@ -44,22 +44,10 @@ def system_information end # Obtain the version information for each scan engine. - # Includes Product, Content, and Java versions. + # Includes dates and ids for Product and Content versions. # def engine_versions - info = console_command('version engines') - versions = [] - engines = info.sub('VERSION INFORMATION\n', '').split(/\n\n/) - engines.each do |eng| - engdata = {} - eng.split(/\n/).each do |kv| - key, value = kv.split(/:\s*/) - key = key.sub('Local Engine ', '').sub('Remote Engine ', '') - engdata[key] = value - end - versions << engdata - end - versions + JSON.parse(AJAX.post(self, "/data/engines"))['records'] end # Induce the application to retrieve required updates and restart From 1646079f4e2b6aa32774d4b706f61d74d1dfd115 Mon Sep 17 00:00:00 2001 From: Red5d Date: Tue, 31 May 2016 15:11:08 -0400 Subject: [PATCH 2/2] Fix quotes for houndci --- lib/nexpose/manage.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/nexpose/manage.rb b/lib/nexpose/manage.rb index c4dd5a9e..fa9304b0 100644 --- a/lib/nexpose/manage.rb +++ b/lib/nexpose/manage.rb @@ -47,7 +47,7 @@ def system_information # Includes dates and ids for Product and Content versions. # def engine_versions - JSON.parse(AJAX.post(self, "/data/engines"))['records'] + JSON.parse(AJAX.post(self, '/data/engines'))['records'] end # Induce the application to retrieve required updates and restart