Skip to content

Conversion Guide: 0.2.x to 0.5.0

Michael Daines edited this page Sep 5, 2013 · 3 revisions

This is a break-down of the breaking API changes between versions 0.2.x and 0.5. It should aid in converting existing scripts which you may have written. I've tried to organize these by which ones are most likely to affect existing code. This document does not extensively cover wholly new features introduced in the 0.5 version of the gem.

Site

site_listing has been renamed to list_sites, or simply sites. The SiteListing class has been removed in lieu of this method.

Similarly, site_device_listing has been renamed to list_site_devices, or simply devices.

site_delete has been renamed to delete_site.

Sites no longer store the underlying IPs in the IPRange class as IPAddr objects. They are simply strings, which make for easier comparison with external resources. It still uses the IPAddr class in places for validation.

The Site.scan method now returns a Scan object. See the Scan section below.

Asset Group

asset_group_delete has been renamed to delete_asset_group.

The rescan_assets methods returns a Hash with site IDs as the key, providing more information and context than the call used to.

Scan

The site_device_scan_start method has been removed. It is replaced by several different methods meeting the different purposes this single method was trying to achieve. The new methods are: scan_device and scan_devices (to scan by Device, an object returned by other methods in the gem), scan_asset and scan_assets (to scan by host name or IP address), scan_ips (to scan by raw IP addresses), and scan_site (to scan an entire site).

scan_pause and scan_resume has been renamed to pause_scan and resume_scan.

scan_site now returns a new object, Scan. It contains the scan and engine IDs. Previously, the method returned an Array of this information.

Report

report_listing has been renamed to list_reports, or simply reports.

The method get_report_config has been removed in favor of ReportConfig.load.

Report Template

The method report_template_listing is now list_report_templates, or simply report_templates.

The method get_report_template has been removed in favor of ReportTemplate.load.

Engine

The EngineConfig class has been renamed to simply Engine.

The initializer for Engine has changed. Instead of passing a Connection object, you pass the address, and optionally name and port.

engine = Engine.new('10.2.0.10', 'Miami Engine', 40814)

Introduced load method for pulling existing engine configuration.

engine = Engine.load(nsc, 5)

The save method has to be handed a Connection object.

EnginePool

Call either the list_engine_pools or engine_pools method to get a list of engine pools. Used to be a method on EnginePool.

The EnginePool constructor arguments have be reordered to better map to the most common use case.

pool = EnginePool.new('East Coast Pool', 'silo')

EnginePool methods have been reorganized to match interface elsewhere. The following methods were removed: load_details, update, create. The corresponding methods are now load and save. The save method handles whether it is an update or created based upon whether the id is set to -1.

Credential

The AdminCredentials class has been renamed to Credential (not plural, as it represents a single credential).

The field securityblob has been shorted to blob.

There is no longer a need for the isblob field, and it was removed.

The set_credentials method has been removed (duplicated functionality of another method).

Several set methods were removed. They can be accessed directly, such as cred.host = 'xyz'.

Method set_privilege_credentials renamed to add_privilege_credentials.

Vulnerability

vuln_listing has been renamed to list_vulns, or simply vulns.

Alert

The Alert field alert changes to type.

Ticket

Ticketing has been completely rewritten. Version 0.2 and earlier used keyword maps for all of the methods. 0.5 uses classes exclusively.

Vulnerability Exception

Vulnerability Exceptions have been completely rewritten. Version 0.2 and earlier used keyword maps for all of the methods. 0.5 uses classes exclusively.