class Nexpose::Console
Nexpose
console configuration class.
Changes to this object are not persisted until the save
method is called.
Example usage:
config = Nexpose::Console.load(nsc) config.session_timeout = 600 config.save(nsc)
Attributes
Whether to retrieve incremental scan results from distributed engines.
Impose a limit on the number of scan threads which an individual scan can use.
Session timeout for the Nexpose
web server (in seconds). The web interface enforces a value from 60 to 604,800 [1 minute to 7 days].
XML
document representing the entire configuration.
Public Class Methods
Construct a new Nexpose
Security Console
configuration object. Not meant to be called publicly. @see load
@param [REXML::Document] xml Parsed XML
representation of the configuration.
# File lib/nexpose/console.rb, line 34 def initialize(xml) @xml = xml nsc = REXML::XPath.first(@xml, 'NeXposeSecurityConsole') @scan_threads_limit = nsc.attributes['scanThreadsLimit'].to_i @incremental_scan_results = nsc.attributes['realtimeIntegration'] == '1' web_server = REXML::XPath.first(nsc, 'WebServer') @session_timeout = web_server.attributes['sessionTimeout'].to_i end
Public Instance Methods
Save modifications to the Nexpose
security console.
@param [Connection] connection Nexpose
connection. @return [Boolean] true if configuration successfully saved.
# File lib/nexpose/console.rb, line 58 def save(connection) nsc = REXML::XPath.first(@xml, 'NeXposeSecurityConsole') nsc.attributes['scanThreadsLimit'] = @scan_threads_limit.to_i nsc.attributes['realtimeIntegration'] = @incremental_scan_results ? '1' : '0' web_server = REXML::XPath.first(nsc, 'WebServer') web_server.attributes['sessionTimeout'] = @session_timeout.to_i response = REXML::Document.new(Nexpose::AJAX.post(connection, '/data/admin/config/nsc', @xml)) saved = REXML::XPath.first(response, 'SaveConfig') saved.attributes['success'] == '1' end