Class: Nexpose::Console
- Inherits:
-
Object
- Object
- Nexpose::Console
- Defined in:
- lib/nexpose/console.rb
Overview
Instance Attribute Summary collapse
-
#incremental_scan_results ⇒ Object
Whether to retrieve incremental scan results from distributed engines.
-
#scan_threads_limit ⇒ Object
Impose a limit on the number of scan threads which an individual scan can use.
-
#session_timeout ⇒ Object
Session timeout for the Nexpose web server (in seconds).
-
#xml ⇒ Object
XML document representing the entire configuration.
Class Method Summary collapse
-
.load(connection) ⇒ Object
Load existing Nexpose security console configuration.
Instance Method Summary collapse
-
#initialize(xml) ⇒ Console
constructor
Construct a new Nexpose Security Console configuration object.
-
#save(connection) ⇒ Boolean
Save modifications to the Nexpose security console.
Constructor Details
#initialize(xml) ⇒ Console
Construct a new Nexpose Security Console configuration object. Not meant to be called publicly.
34 35 36 37 38 39 40 41 42 |
# 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 |
Instance Attribute Details
#incremental_scan_results ⇒ Object
Whether to retrieve incremental scan results from distributed engines.
23 24 25 |
# File 'lib/nexpose/console.rb', line 23 def incremental_scan_results @incremental_scan_results end |
#scan_threads_limit ⇒ Object
Impose a limit on the number of scan threads which an individual scan can use.
20 21 22 |
# File 'lib/nexpose/console.rb', line 20 def scan_threads_limit @scan_threads_limit end |
#session_timeout ⇒ Object
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].
17 18 19 |
# File 'lib/nexpose/console.rb', line 17 def session_timeout @session_timeout end |
#xml ⇒ Object
XML document representing the entire configuration.
26 27 28 |
# File 'lib/nexpose/console.rb', line 26 def xml @xml end |
Class Method Details
Instance Method Details
#save(connection) ⇒ Boolean
Save modifications to the Nexpose security console.
58 59 60 61 62 63 64 65 66 67 68 69 |
# 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 |