From 217fdaac84e3590311b1b7c1f0f1bd6f656e2d7a Mon Sep 17 00:00:00 2001 From: kprzerwa-r7 Date: Wed, 13 Jan 2016 12:57:54 +0000 Subject: [PATCH 1/2] Added ability to control windows service editor in scan template --- lib/nexpose/scan_template.rb | 15 +++++++++++++++ lib/nexpose/version.rb | 2 +- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/lib/nexpose/scan_template.rb b/lib/nexpose/scan_template.rb index 72ac05fa..d15bd689 100644 --- a/lib/nexpose/scan_template.rb +++ b/lib/nexpose/scan_template.rb @@ -583,5 +583,20 @@ def enable_enhanced_logging=(enable) self.enable_debug_logging = enable self.aces_level = (enable ? 'full' : 'none') end + + # Enable or disable windows service editor + # @param [Boolean] enable Enable or disable windows service editor + def windows_service_editor=(enable) + cifs_scanner = REXML::XPath.first(@xml, 'ScanTemplate/Plugins/Plugin[@name="java/CifsScanner"]') + param = REXML::XPath.first(cifs_scanner, './param[@name="windowsServiceEditor"]') + if param + param.text = (enable ? 1 : 0) + else + param = REXML::Element.new('param') + param.add_attribute('name', 'windowsServiceEditor') + param.text = (enable ? 1 : 0) + cifs_scanner.add_element(param) + end + end end end diff --git a/lib/nexpose/version.rb b/lib/nexpose/version.rb index 60ba26aa..2ff024ed 100644 --- a/lib/nexpose/version.rb +++ b/lib/nexpose/version.rb @@ -1,4 +1,4 @@ module Nexpose # The latest version of the Nexpose gem - VERSION = '3.1.0' + VERSION = '3.1.1' end From 2680c8bcbbaf3eae45f7f17d8c1356542bf552d6 Mon Sep 17 00:00:00 2001 From: kprzerwa-r7 Date: Fri, 15 Jan 2016 11:50:30 +0000 Subject: [PATCH 2/2] Changes following code review --- lib/nexpose/scan_template.rb | 11 ++++++----- lib/nexpose/version.rb | 2 +- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/lib/nexpose/scan_template.rb b/lib/nexpose/scan_template.rb index d15bd689..0fd24412 100644 --- a/lib/nexpose/scan_template.rb +++ b/lib/nexpose/scan_template.rb @@ -584,19 +584,20 @@ def enable_enhanced_logging=(enable) self.aces_level = (enable ? 'full' : 'none') end - # Enable or disable windows service editor - # @param [Boolean] enable Enable or disable windows service editor + # Enable or disable windows service editor. + # @param [Boolean] enable Enable or disable windows service editor. def windows_service_editor=(enable) cifs_scanner = REXML::XPath.first(@xml, 'ScanTemplate/Plugins/Plugin[@name="java/CifsScanner"]') param = REXML::XPath.first(cifs_scanner, './param[@name="windowsServiceEditor"]') if param - param.text = (enable ? 1 : 0) + param.text = (enable ? '1' : '0') else param = REXML::Element.new('param') - param.add_attribute('name', 'windowsServiceEditor') - param.text = (enable ? 1 : 0) + param.attributes['name'] = 'windowsServiceEditor' + param.text = (enable ? '1' : '0') cifs_scanner.add_element(param) end + param.text end end end diff --git a/lib/nexpose/version.rb b/lib/nexpose/version.rb index 2ff024ed..60ba26aa 100644 --- a/lib/nexpose/version.rb +++ b/lib/nexpose/version.rb @@ -1,4 +1,4 @@ module Nexpose # The latest version of the Nexpose gem - VERSION = '3.1.1' + VERSION = '3.1.0' end