class Nexpose::ScanTemplate

Configuration object for a scan template.

The constructor is designed to take a valid XML representation of a scan template. If you wish to create a new scan template from scratch, use the load method without a template ID. If you wish to copy and modify an existing template, use the copy method.

This class is only a partial representation of some of the features available for configuration.

Attributes

xml[R]

Parsed XML of a scan template.

Public Class Methods

copy(nsc, id) click to toggle source

Copy an existing scan template, changing the id and title.

@param [Connection] nsc API connection to a Nexpose console. @param [String] id Unique identifier of an existing scan template. @return [ScanTemplate] A copy of the requested scan template configuration.

# File lib/nexpose/scan_template.rb, line 510
def self.copy(nsc, id)
  dupe = load(nsc, id)
  dupe.id   = '#NewScanTemplate#'
  dupe.name = "#{dupe.name} Copy"
  dupe
end
load(nsc, id = nil) click to toggle source

Load a scan template.

@param [Connection] nsc API connection to a Nexpose console. @param [String] id Unique identifier of an existing scan template.

If no ID is provided, a blank, base template will be returned.

@return [ScanTemplate] The requested scan template configuration.

# File lib/nexpose/scan_template.rb, line 494
def self.load(nsc, id = nil)
  if id
    response = JSON.parse(AJAX.get(nsc, "/data/scan/templates/#{URI.encode(id)}"))
    xml = response['value']
  else
    xml = AJAX.get(nsc, '/data/scan-template')
  end
  new(xml)
end
new(xml) click to toggle source

@param [String] xml XML representation of a scan template.

# File lib/nexpose/scan_template.rb, line 55
def initialize(xml)
  @xml = REXML::Document.new(xml)
end

Public Instance Methods

_disable_check(check, elem) click to toggle source
# File lib/nexpose/scan_template.rb, line 408
def _disable_check(check, elem)
  checks = REXML::XPath.first(@xml, '//VulnerabilityChecks')
  checks.elements.delete("Enabled/#{elem}[@name='#{check}']")
  disabled_checks = checks.elements['Disabled'] || checks.add_element('Disabled')
  disabled_checks.add_element(elem, { 'name' => check })
end
_enable_check(check, elem) click to toggle source
# File lib/nexpose/scan_template.rb, line 401
def _enable_check(check, elem)
  checks = REXML::XPath.first(@xml, '//VulnerabilityChecks')
  checks.elements.delete("Disabled/#{elem}[@name='#{check}']")
  enabled_checks = checks.elements['Enabled'] || checks.add_element('Enabled')
  enabled_checks.add_element(elem, { 'name' => check })
end
_remove_check(check, elem) click to toggle source
# File lib/nexpose/scan_template.rb, line 415
def _remove_check(check, elem)
  checks = REXML::XPath.first(@xml, '//VulnerabilityChecks')
  checks.elements.delete("Disabled/#{elem}[@name='#{check}']")
  checks.elements.delete("Enabled/#{elem}[@name='#{check}']")
end
aces_enabled?() click to toggle source

@return [Boolean] whether asset configuration scanning is enabled for

this template.
# File lib/nexpose/scan_template.rb, line 559
def aces_enabled?
  aces_level == 'full'
end
aces_level() click to toggle source

@return [String] the asset configuration logging value for this

template.
# File lib/nexpose/scan_template.rb, line 549
def aces_level
  logging = REXML::XPath.first(@xml, 'ScanTemplate/Logging')
  return 'default' if logging.nil?
  aces = REXML::XPath.first(logging, 'aces')
  return 'default' if aces.nil?
  aces.attributes['level']
end
aces_level=(level) click to toggle source

Enable or disable asset configuration scanning for this template. If the level is not “full”, “default” or “none”, this is a no-op.

@param [String] “full” to enable asset configuration logging, and

"default" or "none" to disable it.
# File lib/nexpose/scan_template.rb, line 531
def aces_level=(level)
  return if level.nil?
  return unless ['full', 'default', 'none'].include? level.downcase
  logging = REXML::XPath.first(@xml, 'ScanTemplate/Logging')
  if logging.nil?
    logging = REXML::Element.new('Logging')
    @xml.add_element(logging)
  end
  aces = REXML::XPath.first(logging, 'aces')
  if aces.nil?
    aces = REXML::Element.new('aces')
    logging.add_element(aces)
  end
  aces.attributes['level'] = level
end
control_scanning=(enable) click to toggle source

Adjust whether to perform control scanning (ControlsInsight integration) with this template. @param [Boolean] enable Whether to turn on control scanning.

# File lib/nexpose/scan_template.rb, line 121
def control_scanning=(enable)
  local_controls_scan = REXML::XPath.first(@xml, 'ScanTemplate/ControlsScan/localControlsScanEnabled')
  local_controls_scan.attributes['enabled'] = enable ? '1' : '0'
end
control_scanning?() click to toggle source

@return [Boolean] Whether control scanning in enabled.

# File lib/nexpose/scan_template.rb, line 111
def control_scanning?
  global_controls_scan = REXML::XPath.first(@xml, 'ScanTemplate/ControlsScan/globalControlsScanEnabled')
  local_controls_scan  = REXML::XPath.first(@xml, 'ScanTemplate/ControlsScan/localControlsScanEnabled')

  global_controls_scan.attributes['enabled'] == '1' || local_controls_scan.attributes['enabled'] == '1'
end
correlate=(enable) click to toggle source

Adjust whether to correlate reliable checks with regular checks. @param [Boolean] enable Whether to turn on vulnerability correlation.

# File lib/nexpose/scan_template.rb, line 282
def correlate=(enable)
  vuln_checks = REXML::XPath.first(@xml, 'ScanTemplate/VulnerabilityChecks')
  vuln_checks.attributes['correlate'] = enable ? '1' : '0'
end
correlate?() click to toggle source

@return [Boolean] Whether to correlate reliable checks with regular checks.

# File lib/nexpose/scan_template.rb, line 275
def correlate?
  vuln_checks = REXML::XPath.first(@xml, 'ScanTemplate/VulnerabilityChecks')
  vuln_checks.attributes['correlate'] == '1'
end
delete(nsc) click to toggle source

Delete this scan template from the console. Cannot be used to delete a built-in template.

@param [Connection] nsc API connection to a Nexpose console.

# File lib/nexpose/scan_template.rb, line 522
def delete(nsc)
  nsc.delete_scan_template(id)
end
description() click to toggle source

@return [String] Description of this scan template.

# File lib/nexpose/scan_template.rb, line 91
def description
  desc = REXML::XPath.first(@xml, 'ScanTemplate/templateDescription')
  desc.nil? ? nil : desc.text.to_s
end
description=(description) click to toggle source

Assign a description to this scan template. Require attribute. @param [String] description Description of the scan template.

# File lib/nexpose/scan_template.rb, line 98
def description=(description)
  desc = REXML::XPath.first(@xml, 'ScanTemplate/templateDescription')
  if desc
    desc.text = replace_entities(description)
  else
    root = REXML::XPath.first(xml, 'ScanTemplate')
    desc = REXML::Element.new('templateDescription')
    desc.add_text(description)
    root.add_element(desc)
  end
end
disable_checks_by_category(category) click to toggle source

Disable checks by category for this template.

@param [String] category Category to disable. @see list_vuln_categories

# File lib/nexpose/scan_template.rb, line 345
def disable_checks_by_category(category)
  _disable_check(category, 'VulnCategory')
end
disable_checks_by_type(type) click to toggle source

Disable checks by type for this template.

@param [String] type Type to disable. @see list_vuln_types

# File lib/nexpose/scan_template.rb, line 388
def disable_checks_by_type(type)
  _disable_check(type, 'CheckType')
end
disable_vuln_check(check_id) click to toggle source

Disable individual check for this template.

@param [String] check_id Unique identifier of vuln check.

# File lib/nexpose/scan_template.rb, line 454
def disable_vuln_check(check_id)
  checks = REXML::XPath.first(@xml, '//VulnerabilityChecks')
  checks.elements.delete("Enabled/Check[@id='#{check_id}']")
  disabled_checks = checks.elements['Disabled'] || checks.add_element('Disabled')
  disabled_checks.add_element('Check', { 'id' => check_id })
end
disabled_checks_by_category() click to toggle source

Get a list of the check categories disabled for this scan template.

@return [Array] List of enabled categories.

# File lib/nexpose/scan_template.rb, line 319
def disabled_checks_by_category
  checks = REXML::XPath.first(@xml, '//VulnerabilityChecks/Disabled')
  checks ? checks.elements.to_a('VulnCategory').map { |c| c.attributes['name'] } : []
end
disabled_checks_by_type() click to toggle source

Get a list of the check types disabled for this scan template.

@return [Array] List of enabled check types.

# File lib/nexpose/scan_template.rb, line 362
def disabled_checks_by_type
  checks = REXML::XPath.first(@xml, '//VulnerabilityChecks/Disabled')
  checks ? checks.elements.to_a('CheckType').map { |c| c.attributes['name'] } : []
end
disabled_vuln_checks() click to toggle source

Get a list of the individual vuln checks disabled for this scan template.

@return [Array] List of enabled vulnerability checks.

# File lib/nexpose/scan_template.rb, line 434
def disabled_vuln_checks
  checks = REXML::XPath.first(@xml, '//VulnerabilityChecks/Disabled')
  checks ? checks.elements.to_a('Check').map { |c| c.attributes['id'] } : []
end
enable_checks_by_category(category) click to toggle source

Enable checks by category for this template.

@param [String] category Category to enable. @see list_vuln_categories

# File lib/nexpose/scan_template.rb, line 337
def enable_checks_by_category(category)
  _enable_check(category, 'VulnCategory')
end
enable_checks_by_type(type) click to toggle source

Enable checks by type for this template.

@param [String] type Type to enable. @see list_vuln_types

# File lib/nexpose/scan_template.rb, line 380
def enable_checks_by_type(type)
  _enable_check(type, 'CheckType')
end
enable_debug_logging=(enable) click to toggle source

Enable or disable the debug logging. @param [Boolean] enable Enable or disable the debug logging.

# File lib/nexpose/scan_template.rb, line 565
def enable_debug_logging=(enable)
  return if enable.nil?
  logging = REXML::XPath.first(@xml, 'ScanTemplate/Logging')
  if logging.nil?
    logging = REXML::Element.new('Logging')
    @xml.add_element(logging)
  end
  debug_logging = REXML::XPath.first(logging, 'debugLogging')
  if debug_logging.nil?
    debug_logging = REXML::Element.new('debugLogging')
    logging.add_element(debug_logging)
  end
  debug_logging.attributes['enabled'] = (enable ? 1 : 0)
end
enable_enhanced_logging=(enable) click to toggle source

Enable or disable the enhanced logging. @param [Boolean] enable Enable or disable the enhanced logging.

# File lib/nexpose/scan_template.rb, line 582
def enable_enhanced_logging=(enable)
  self.enable_debug_logging = enable
  self.aces_level = (enable ? 'full' : 'none')
end
enable_icmp_device_discovery=(enable) click to toggle source

Enable/disable ICMP device discovery @param [Boolean] enable Enable or disable ICMP device discovery

# File lib/nexpose/scan_template.rb, line 196
def enable_icmp_device_discovery=(enable)
  icmp = REXML::XPath.first(@xml, 'ScanTemplate/DeviceDiscovery/CheckHosts/icmpHostCheck')
  icmp.attributes['enabled'] = (enable ? 1 : 0)
end
enable_ip_stack_fingerprinting=(enable) click to toggle source

Enable/disable IP stack fingerprinting @param [Boolean] enable Enable or disable IP stack fingerprinting

# File lib/nexpose/scan_template.rb, line 181
def enable_ip_stack_fingerprinting=(enable)
  ns = REXML::XPath.first(@xml, 'ScanTemplate/Plugins/Plugin[@name="java/NetworkScanners"]')
  param = REXML::XPath.first(ns, './param[@name="ipFingerprintEnabled"]')
  if param
    param.text = (enable ? 1 : 0)
  else
    param = REXML::Element.new('param')
    param.add_attribute('name', 'ipFingerprintEnabled')
    param.text = (enable ? 1 : 0)
    ns.add_element(param)
  end
end
enable_tcp_device_discovery=(enable) click to toggle source

Enable/disable TCP device discovery @param [Boolean] enable Enable or disable TCP device discovery

# File lib/nexpose/scan_template.rb, line 203
def enable_tcp_device_discovery=(enable)
  tcp = REXML::XPath.first(@xml, 'ScanTemplate/DeviceDiscovery/CheckHosts/TCPHostCheck')
  tcp.attributes['enabled'] = (enable ? 1 : 0)
end
enable_tcp_service_discovery=(enable) click to toggle source

Enable or disable TCP port scanning. @param [Boolean] enable Enable or disable TCP ports

# File lib/nexpose/scan_template.rb, line 231
def enable_tcp_service_discovery=(enable)
  service_ports = REXML::XPath.first(@xml, 'ScanTemplate/ServiceDiscovery/TCPPortScan')
  service_ports.attributes['mode'] = 'none' unless enable
end
enable_udp_device_discovery=(enable) click to toggle source

Enable/disable UDP device discovery @param [Boolean] enable Enable or disable UDP device discovery

# File lib/nexpose/scan_template.rb, line 217
def enable_udp_device_discovery=(enable)
  udp = REXML::XPath.first(@xml, 'ScanTemplate/DeviceDiscovery/CheckHosts/UDPHostCheck')
  udp.attributes['enabled'] = (enable ? 1 : 0)
end
enable_udp_service_discovery=(enable) click to toggle source

Enable or disable UDP service discovery @param [Boolean] enable Enable or disable UDP service discovery

# File lib/nexpose/scan_template.rb, line 269
def enable_udp_service_discovery=(enable)
  service_ports = REXML::XPath.first(@xml, 'ScanTemplate/ServiceDiscovery/UDPPortScan')
  service_ports.attributes['mode'] = 'none' unless enable
end
enable_vuln_check(check_id) click to toggle source

Enable individual check for this template.

@param [String] check_id Unique identifier of vuln check.

# File lib/nexpose/scan_template.rb, line 443
def enable_vuln_check(check_id)
  checks = REXML::XPath.first(@xml, '//VulnerabilityChecks')
  checks.elements.delete("Disabled/Check[@id='#{check_id}']")
  enabled_checks = checks.elements['Enabled'] || checks.add_element('Enabled')
  enabled_checks.add_element('Check', { 'id' => check_id })
end
enabled_checks_by_category() click to toggle source

Get a list of the check categories enabled for this scan template.

@return [Array] List of enabled categories.

# File lib/nexpose/scan_template.rb, line 328
def enabled_checks_by_category
  checks = REXML::XPath.first(@xml, '//VulnerabilityChecks/Enabled')
  checks ? checks.elements.to_a('VulnCategory').map { |c| c.attributes['name'] } : []
end
enabled_checks_by_type() click to toggle source

Get a list of the check types enabled for this scan template.

@return [Array] List of enabled check types.

# File lib/nexpose/scan_template.rb, line 371
def enabled_checks_by_type
  checks = REXML::XPath.first(@xml, '//VulnerabilityChecks/Enabled')
  checks ? checks.elements.to_a('CheckType').map { |c| c.attributes['name'] } : []
end
enabled_vuln_checks() click to toggle source

Get a list of the individual vuln checks enabled for this scan template.

@return [Array] List of enabled vulnerability checks.

# File lib/nexpose/scan_template.rb, line 425
def enabled_vuln_checks
  checks = REXML::XPath.first(@xml, '//VulnerabilityChecks/Enabled')
  checks ? checks.elements.to_a('Check').map { |c| c.attributes['id'] } : []
end
exclude_tcp_service_discovery_ports=(ports) click to toggle source

Exclude TCP ports during TCP service discovery @param [Array] ports TCP ports to exclude from TCP service discovery

# File lib/nexpose/scan_template.rb, line 247
def exclude_tcp_service_discovery_ports=(ports)
  service_ports = REXML::XPath.first(@xml, 'ScanTemplate/ServiceDiscovery/ExcludedTCPPortScan')
  REXML::XPath.first(service_ports, './portList').text = ports.join(',')
end
exclude_udp_service_discovery_ports=(ports) click to toggle source

Exclude UDP ports when performing UDP service discovery @param [Array] ports UDP ports to exclude from UDP service discovery

# File lib/nexpose/scan_template.rb, line 262
def exclude_udp_service_discovery_ports=(ports)
  service_ports = REXML::XPath.first(@xml, 'ScanTemplate/ServiceDiscovery/ExcludedUDPPortScan')
  REXML::XPath.first(service_ports, './portList').text = ports.join(',')
end
host_threads=(threads) click to toggle source

Adjust the number of threads to use per asset for this template @param [Integer] threads the number of threads to use per asset

# File lib/nexpose/scan_template.rb, line 174
def host_threads=(threads)
  host_threads = REXML::XPath.first(@xml, 'ScanTemplate/General/hostThreads')
  host_threads.text = threads.to_s
end
id() click to toggle source

@return [String] Unique identifier of the scan template.

# File lib/nexpose/scan_template.rb, line 60
def id
  root = REXML::XPath.first(@xml, 'ScanTemplate')
  root.attributes['id']
end
id=(value) click to toggle source
# File lib/nexpose/scan_template.rb, line 65
def id=(value)
  root = REXML::XPath.first(@xml, 'ScanTemplate')
  root.attributes['id'] = value
end
name() click to toggle source

@return [String] Name or title of this scan template.

# File lib/nexpose/scan_template.rb, line 71
def name
  desc = REXML::XPath.first(@xml, 'ScanTemplate/templateDescription')
  desc.nil? ? nil : desc.attributes['title']
end
name=(name) click to toggle source

Assign name to this scan template. Required attribute. @param [String] name Title to assign.

# File lib/nexpose/scan_template.rb, line 78
def name=(name)
  desc = REXML::XPath.first(@xml, 'ScanTemplate/templateDescription')
  if desc
    desc.attributes['title'] = replace_entities(name)
  else
    root = REXML::XPath.first(xml, 'ScanTemplate')
    desc = REXML::Element.new('templateDescription')
    desc.add_attribute('title', name)
    root.add_element(desc)
  end
end
policy_scanning=(enable) click to toggle source

Adjust whether to perform policy scanning with this template. @param [Boolean] enable Whether to turn on policy scanning.

# File lib/nexpose/scan_template.rb, line 147
def policy_scanning=(enable)
  gen = REXML::XPath.first(@xml, 'ScanTemplate/General')
  gen.attributes['disablePolicyScan'] = enable ? '0' : '1'
end
policy_scanning?() click to toggle source

@return [Boolean] Whether policy scanning in enabled.

# File lib/nexpose/scan_template.rb, line 140
def policy_scanning?
  gen = REXML::XPath.first(@xml, 'ScanTemplate/General')
  gen.attributes['disablePolicyScan'] == '0'
end
potential_checks=(enable) click to toggle source

Adjust whether to perform potential vulnerability checks with this template. @param [Boolean] enable Whether to turn on potential checks.

# File lib/nexpose/scan_template.rb, line 310
def potential_checks=(enable)
  checks = REXML::XPath.first(@xml, 'ScanTemplate/VulnerabilityChecks')
  checks.attributes['potential'] = enable ? '1' : '0'
end
potential_checks?() click to toggle source

@return [Boolean] Whether potential vulnerability checks are performed

with this template.
# File lib/nexpose/scan_template.rb, line 303
def potential_checks?
  checks = REXML::XPath.first(@xml, 'ScanTemplate/VulnerabilityChecks')
  checks.attributes['potential'] == '1'
end
remove_checks_by_category(category) click to toggle source

Remove checks by category for this template. Removes both enabled and disabled checks.

@param [String] category Category to remove. @see list_vuln_categories

# File lib/nexpose/scan_template.rb, line 354
def remove_checks_by_category(category)
  _remove_check(category, 'VulnCategory')
end
remove_checks_by_type(type) click to toggle source

Remove checks by type for this template. Removes both enabled and disabled checks.

@param [String] type Type to remove. @see list_vuln_types

# File lib/nexpose/scan_template.rb, line 397
def remove_checks_by_type(type)
  _remove_check(type, 'CheckType')
end
remove_vuln_check(check_id) click to toggle source

Remove individual check for this template. Removes both enabled and disabled checks.

@param [String] check_id Unique identifier of vuln check.

# File lib/nexpose/scan_template.rb, line 466
def remove_vuln_check(check_id)
  checks = REXML::XPath.first(@xml, '//VulnerabilityChecks')
  checks.elements.delete("Disabled/Check[@id='#{check_id}']")
  checks.elements.delete("Enabled/Check[@id='#{check_id}']")
end
save(nsc) click to toggle source

Save this scan template configuration to a Nexpose console.

@param [Connection] nsc API connection to a Nexpose console.

# File lib/nexpose/scan_template.rb, line 476
def save(nsc)
  root = REXML::XPath.first(@xml, 'ScanTemplate')
  if root.attributes['id'] == '#NewScanTemplate#'
    response = JSON.parse(AJAX.post(nsc, '/data/scan/templates', xml))
    root.attributes['id'] = response['value']
  else
    response = JSON.parse(AJAX.put(nsc, "/data/scan/templates/#{URI.encode(id)}", xml))
  end
  response['value']
end
scan_threads=(threads) click to toggle source

Adjust the number of threads to use per scan engine for this template @param [Integer] threads the number of threads to use per engine

# File lib/nexpose/scan_template.rb, line 167
def scan_threads=(threads)
  scan_threads = REXML::XPath.first(@xml, 'ScanTemplate/General/scanThreads')
  scan_threads.text = threads.to_s
end
tcp_device_discovery_ports=(ports) click to toggle source

Set custom TCP ports to scan for device discovery @param [Array] ports Ports to scan for device discovery

# File lib/nexpose/scan_template.rb, line 210
def tcp_device_discovery_ports=(ports)
  tcp = REXML::XPath.first(@xml, 'ScanTemplate/DeviceDiscovery/CheckHosts/TCPHostCheck')
  REXML::XPath.first(tcp, './portList').text = ports.join(',')
end
tcp_service_discovery_ports=(ports) click to toggle source

Set custom TCP ports to scan for TCP service discovery @param [Array] ports Ports to scan for TCP service discovery

# File lib/nexpose/scan_template.rb, line 238
def tcp_service_discovery_ports=(ports)
  service_ports = REXML::XPath.first(@xml, 'ScanTemplate/ServiceDiscovery/TCPPortScan')
  service_ports.attributes['mode'] = 'custom'
  service_ports.attributes['method'] = 'syn'
  REXML::XPath.first(service_ports, './portList').text = ports.join(',')
end
udp_device_discovery_ports=(ports) click to toggle source

Set custom UDP ports to scan for UDP device discovery @param [Array] ports Ports to scan for UDP device discovery

# File lib/nexpose/scan_template.rb, line 224
def udp_device_discovery_ports=(ports)
  udp = REXML::XPath.first(@xml, 'ScanTemplate/DeviceDiscovery/CheckHosts/UDPHostCheck')
  REXML::XPath.first(udp, './portList').text = ports.join(',')
end
udp_service_discovery_ports=(ports) click to toggle source

Set custom UDP ports to scan for UDP service discovery @param [Array] ports Ports to scan during UDP service discovery

# File lib/nexpose/scan_template.rb, line 254
def udp_service_discovery_ports=(ports)
  service_ports = REXML::XPath.first(@xml, 'ScanTemplate/ServiceDiscovery/UDPPortScan')
  service_ports.attributes['mode'] = 'custom'
  REXML::XPath.first(service_ports, './portList').text = ports.join(',')
end
unsafe_checks=(enable) click to toggle source

Adjust whether to perform unsafe vulnerability checks with this template. @param [Boolean] enable Whether to turn on unsafe checks.

# File lib/nexpose/scan_template.rb, line 296
def unsafe_checks=(enable)
  checks = REXML::XPath.first(@xml, 'ScanTemplate/VulnerabilityChecks')
  checks.attributes['unsafe'] = enable ? '1' : '0'
end
unsafe_checks?() click to toggle source

@return [Boolean] Whether unsafe vulnerability checks are performed

by this template.
# File lib/nexpose/scan_template.rb, line 289
def unsafe_checks?
  checks = REXML::XPath.first(@xml, 'ScanTemplate/VulnerabilityChecks')
  checks.attributes['unsafe'] == '1'
end
vuln_scanning=(enable) click to toggle source

Adjust whether to perform vuln scanning with this template. @param [Boolean] enable Whether to turn on vuln scanning.

# File lib/nexpose/scan_template.rb, line 134
def vuln_scanning=(enable)
  gen = REXML::XPath.first(@xml, 'ScanTemplate/General')
  gen.attributes['disableVulnScan'] = enable ? '0' : '1'
end
vuln_scanning?() click to toggle source

@return [Boolean] Whether vuln scanning in enabled.

# File lib/nexpose/scan_template.rb, line 127
def vuln_scanning?
  gen = REXML::XPath.first(@xml, 'ScanTemplate/General')
  gen.attributes['disableVulnScan'] == '0'
end
web_spidering=(enable) click to toggle source

Adjust whether to perform web spidering with this template. @param [Boolean] enable Whether to turn on web spider scanning.

# File lib/nexpose/scan_template.rb, line 160
def web_spidering=(enable)
  gen = REXML::XPath.first(@xml, 'ScanTemplate/General')
  gen.attributes['disableWebSpider'] = enable ? '0' : '1'
end
web_spidering?() click to toggle source

@return [Boolean] Whether web spidering in enabled.

# File lib/nexpose/scan_template.rb, line 153
def web_spidering?
  gen = REXML::XPath.first(@xml, 'ScanTemplate/General')
  gen.attributes['disableWebSpider'] == '0'
end
windows_service_editor=(enable) click to toggle source

Enable or disable windows service editor. @param [Boolean] enable Enable or disable windows service editor.

# File lib/nexpose/scan_template.rb, line 589
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.attributes['name'] = 'windowsServiceEditor'
    param.text = (enable ? '1' : '0')
    cifs_scanner.add_element(param)
  end
  param.text
end