-
Notifications
You must be signed in to change notification settings - Fork 103
Using Sites
Here's a walk-through of how to use a Site, as of version 3.2.0 of the gem.
In order to keep verbosity to a minimum, all of the examples assume that the Nexpose module has been included:
include Nexpose
As with all uses of the gem, in order to interact with a Nexpose console you will need an active, valid connection. The following line can be assumed for all code below:
nsc = Connection.new('10.2.0.1', 'nxadmin', 'secret-password')
nsc.login
This will load in the configuration of an existing site. It can be used to modify or query the site. In the example below the engine that scans are run on and the scan template is changed.
site = Site.load(nsc, 42)
site.engine_id = 5
site.scan_template_id = 'full-audit'
site.save(nsc)
This will copy an existing Site configuration, keeping all data the same except for the site ID and the name. This can be useful for duplicating a common template. It also demonstrates how to clear and add new assets (scan targets) to a site.
site = Site.copy(nsc, 42)
site.name = 'West Coast Web Servers'
site.included_addresses = [] # Clear out existing addresses and host names from configuration.
site.included_asset_groups = [] # Clear out existing asset groups from configuration.
site.include_asset('wc-web.company.com') # host name or IP address is determined automatically
site.include_asset('10.2.0.24') # host name or IP address is determined automatically
site.include_ip_range('10.2.0.0', '10.2.0.5')
site.save(nsc)
This example creates a new Site from scratch, launching a scan against the newly created site once it is complete.
site = Site.new('BC Servers', 'full-audit-with-correlation')
site.description = 'All servers in the BC domain. Using correlation scan template.'
site.include_ip_range('10.2.0.0', '10.2.2.128')
site.save(nsc)
site.scan(nsc)
Project Home 🔹 Release Notes 🔹 Wiki 🔹 Issues 🔹 Pull Requests