class ScanRunDescription

Attributes

connection_url[RW]
engine_id[RW]
exceptions_list_url[RW]
ip_addresses[RW]
password[RW]
port[RW]
scan_template_id[RW]
site_name[RW]
username[RW]

Public Class Methods

new(options) click to toggle source
# File lib/nexpose-runner/scan_run_description.rb, line 12
def initialize(options)
  if File.file?('config/scan.yml')
    options = YAML.load_file('config/scan.yml')
  elsif options.instance_of? Array
    options = CommandLineArgumentParser.parse(options)
  end

  self.connection_url = options['connection_url']
  @@exceptions_list_url_value = options['exceptions_list_url']
  self.username =  options['username']
  self.password = options['password']
  @@port_value = options['port']
  self.site_name = options['site_name']
  self.ip_addresses = options['ip_addresses']
  self.scan_template_id = options['scan_template_id']
  self.engine_id = options['engine_id']
  self.timeout = options['timeout']
  self.open_timeout = options['open_timeout']
end

Public Instance Methods

exceptions_list_url=(value) click to toggle source
# File lib/nexpose-runner/scan_run_description.rb, line 66
def exceptions_list_url=(value)
  @@exceptions_list_url_value = value
end
get_value(value_to_check, default) click to toggle source
# File lib/nexpose-runner/scan_run_description.rb, line 82
def get_value(value_to_check, default)
  (value_to_check.nil? || value_to_check.empty?) ? default : value_to_check
end
ip_addresses=(value) click to toggle source
# File lib/nexpose-runner/scan_run_description.rb, line 74
def ip_addresses=(value)
  @@ip_addresses = value.split(',') unless value.nil?
end
open_timeout() click to toggle source
# File lib/nexpose-runner/scan_run_description.rb, line 62
def open_timeout
  get_value(@@open_timeout, CONSTANTS::DEFAULT_OPEN_TIMEOUT)
end
open_timeout=(value) click to toggle source
# File lib/nexpose-runner/scan_run_description.rb, line 58
def open_timeout=(value)
  @@open_timeout = value
end
port=(value) click to toggle source
# File lib/nexpose-runner/scan_run_description.rb, line 42
def port=(value)
  @@port_value = value
end
timeout() click to toggle source
# File lib/nexpose-runner/scan_run_description.rb, line 54
def timeout
  get_value(@@timeout, CONSTANTS::DEFAULT_TIMEOUT)
end
timeout=(value) click to toggle source
# File lib/nexpose-runner/scan_run_description.rb, line 50
def timeout=(value)
  @@timeout = value
end
verify() click to toggle source
# File lib/nexpose-runner/scan_run_description.rb, line 32
def verify
  raise StandardError, CONSTANTS::REQUIRED_CONNECTION_URL_MESSAGE if connection_url.nil? || connection_url.empty?
  raise StandardError, CONSTANTS::REQUIRED_USERNAME_MESSAGE if username.nil? || username.empty?
  raise StandardError, CONSTANTS::REQUIRED_PASSWORD_MESSAGE if password.nil? || password.empty?
  raise StandardError, CONSTANTS::REQUIRED_SITE_NAME_MESSAGE if site_name.nil? || site_name.empty?
  raise StandardError, CONSTANTS::REQUIRED_IP_ADDRESS_MESSAGE if ip_addresses.length == 0
  raise StandardError, CONSTANTS::REQUIRED_SCAN_TEMPLATE_MESSAGE if scan_template_id.nil? || scan_template_id.empty?

end