Usage:
The Scan Manager can be used to:
-
MONITOR A SCAN
# Create a NeXpose API Connection nexpose_connection = NeXpose::Connection.new host, username, password, port
# Initialize the scan manager # Poll NeXpose every 5 seconds for the scan status poll_time = 5 scan_manager = ScanManager.new nexpose_connection, false, poll__time
# Add your observing class to the scan manager that defines an update method # scan_data contains the scan ID, status, and message if any class ScanObserver
def update scan_data, notifier
<do whatever with scan_data>
end
end
scan_observer = ScanObserver.new scan_manager.add_observer scan_observer
-
START A RESTRICTIVE SCAN
# Define the condition
conditional_scan =
{
:site_id => <site ID>,
:max_scans => 5, # Only start scan if there are less than 5 scans running
:devices => <array of devices>, # IPs
:listeners => listeners # Can be null or an observer as defined in A
}
scan_manager.add_conditional_device_scan conditional_scan This file was modified by JetBrains RubyMine 3.1.1 for binding GitHub repository This file was modified by JetBrains RubyMine 3.1.1 for binding GitHub repository