Skip Menu |

This queue is for tickets about the Rapid7-NeXpose-API CPAN distribution.

Report information
The Basics
Id: 75230
Status: new
Priority: 0/
Queue: Rapid7-NeXpose-API

People
Owner: Nobody in particular
Requestors: jaldridge [...] tanagerinc.com
Cc:
AdminCc:

Bug Information
Severity: Wishlist
Broken in: 0.03
Fixed in: (no value)



Subject: Additional methods to retrieve Site Configuration, Scan History, and Device Listing
I've implemented three methods for the NeXpose API (file attached). - siteconfig, returns the configuration details for a site - sitescanhistory, returns scan summaries for a site - sitedevicelisting, returns list of scanned devices I've made an effort to follow the naming conventions and employ the same style of error handling. I've performed basic functional testing on all. The code provided in the attachment can be inserted (pasted) into "API.pm" at a single point (outside a sub) adjacent to the other NeXpose API methods. Thank you for the useful module and I hope you or others find my additions useful.
Subject: API-03.01-jaldridge.methods-added.pm
############################################################################# # 2012-02-22 John Aldridge -- Methods Added =head2 siteconfig ( $siteid ) site config, returns the configuration details for a site =cut sub siteconfig { my ( $self, $siteid ) = @_; my $hashref = { 'SiteConfigRequest' => { 'sync-id' => $self->syncid(), 'session-id' => $self->session(), 'site-id' => $siteid } }; my $xmlh = $self->xml_request($hashref); return '' unless $xmlh->{'SiteConfigResponse'}->[0]->{'success'} == 1; return $xmlh->{'SiteConfigResponse'}->[0]->{'Site'}; } =head2 sitescanhistory ( $siteid ) site scan history, returns scan summaries for a site. =cut sub sitescanhistory { my ( $self, $siteid ) = @_; my $hashref = { 'SiteScanHistoryRequest' => { 'sync-id' => $self->syncid(), 'session-id' => $self->session(), 'site-id' => $siteid } }; my $xmlh = $self->xml_request($hashref); return '' unless $xmlh->{'SiteScanHistoryResponse'}->[0]->{'success'} == 1; return $xmlh->{'SiteScanHistoryResponse'}->[0]->{'ScanSummary'}; } =head2 sitedevicelisting ( [ $siteid ] ) site device listing, returns list of scanned devices ether by site or all if site is an empty string. =cut sub sitedevicelisting { my ( $self, $siteid ) = @_; my $hashrefsub = { 'sync-id' => $self->syncid(), 'session-id' => $self->session(), }; $hashrefsub->{'site-id'} = $siteid if ($siteid || $siteid == 0); my $hashref = { 'SiteDeviceListingRequest' => $hashrefsub }; my $xmlh = $self->xml_request($hashref); return '' unless $xmlh->{'SiteDeviceListingResponse'}->[0]->{'success'} == 1; return $xmlh->{'SiteDeviceListingResponse'}->[0]->{'Site'}; } #############################################################################