table of contents
Net::Nessus::REST(3pm) | User Contributed Perl Documentation | Net::Nessus::REST(3pm) |
NAME¶
Net::Nessus::REST - REST interface for Nessus 6.0
DESCRIPTION¶
This module provides a Perl interface for communication with Nessus scanner using REST interface.
SYNOPSIS¶
use Net::Nessus::REST; my $nessus = Net::Nessus::REST->new( url => 'https://my.nessus:8834' ): $nessus->create_session( username => 'user', password => 's3cr3t', ); my $policy_template_id = $nessus->get_template_id( name => 'basic', type => 'policy' ); my $scan = $nessus->create_scan( uuid => $policy_template_id, settings => { text_targets => '127.0.0.1', name => 'localhost scan' } ); $nessus->launch_scan(scan_id => $scan->{id}); while ($nessus->get_scan_status(scan_id => $scan->{id}) ne 'completed') { sleep 10; } my $file_id = $nessus->export_scan( scan_id => $scan->{id}, format => 'pdf' ); while ($nessus->get_scan_export_status( scan_id => $scan->{id}, file_id => $file_id ) ne 'ready') { sleep 1; } $nessus->download_scan( scan_id => $scan->{id}, file_id => $file_id, filename => 'localhost.pdf' );
CLASS METHODS¶
Net::Nessus::REST->new(url => $url, [ssl_opts => $opts, timeout => $timeout])¶
Creates a new Net::Nessus::Rest instance.
INSTANCE METHODS¶
$nessus->create_session(username => $username, password => $password)¶
Creates a new session token for the given user.
See <https://your.nessus.server:8834/nessus6-api.html#/resources/session/create> for details.
$nessus->destroy_session()¶
Logs the current user out and destroys the session.
See <https://your.nessus.server:8834/nessus6-api.html#/resources/session/destroy> for details.
$nessus->list_policies()¶
Returns the policy list.
See <https://your.nessus.server:8834/nessus6-api.html#/resources/policies/list> for details.
$nessus->get_policy_id(name => $name)¶
Returns the identifier for the policy with given name.
$nessus->get_policy_details(id => $policy_id)¶
Returns a reference to a hash with all settings and parameters for a given scan policy.
See <https://your.nessus.server:8834/api#/resources/policies/details> for details.
$nessus->import_policy(file => $file_id)¶
Returns reference to hash with name and identifier of the policy imported. NB $file_id must be a valid identifier to a file uploaded to the Nessus server, e.g. with method file_upload()
Example: $result = $nessus->import_policy(file => $fileuploaded); print "Policy imported: " . $result->{'name'} . "\n";
See <https://your.nessus.server:8834/api#/resources/policies/import> for details.
$nessus->delete_policy(id => $policy_id)¶
Deletes a given scan policy off the Nessus server
See <https://your.nessus.server:8834/api#/resources/policies/delete> for details.
$nessus->configure_policy(id => $policy_id, uuid => $uuid, settings => $settings)¶
See <https://your.nessus.server:8834/api#/resources/policies/configure> for details.
$nessus->create_policy(uuid => $uuid, settings => $settings)¶
See <https://your.nessus.server:8834/api#/resources/policies/create> for details.
$nessus->list_scanners()¶
Returns the scanner list.
See <https://your.nessus.server:8834/nessus6-api.html#/resources/scanners/list> for details.
$nessus->list_folders()¶
Returns the current user's scan folders.
See <https://your.nessus.server:8834/nessus6-api.html#/resources/folders/list> for details.
$nessus->get_folder_id(name => $name)¶
Returns the identifier for the folder with given name.
$nessus->create_scan(uuid => $uuid, settings => $settings)¶
Creates a scan
See <https://your.nessus.server:8834/nessus6-api.html#/resources/scans/create> for details.
$nessus->configure_scan(scan_id => $scan_id, uuid => $uuid, settings => $settings)¶
Changes the schedule or policy parameters of a scan.
See <https://your.nessus.server:8834/nessus6-api.html#/resources/scans/configure> for details.
$nessus->delete_scan(scan_id => $scan_id)¶
Deletes a scan.
See <https://your.nessus.server:8834/nessus6-api.html#/resources/scans/delete> for details.
$nessus->delete_scan_history(scan_id => $scan_id, history_id => $history_id)¶
Deletes historical results from a scan.
See <https://your.nessus.server:8834/nessus6-api.html#/resources/scans/delete-history> for details.
$nessus->download_scan(scan_id => $scan_id, file_id => $file_id, filename => $filename)¶
Download an exported scan. Without filename parameter it will return the content of the file.
See <https://your.nessus.server:8834/nessus6-api.html#/resources/scans/download> for details.
$nessus->export_scan(scan_id => $scan_id, format => $format)¶
Export the given scan.
See <https://your.nessus.server:8834/nessus6-api.html#/resources/scans/export> for details.
$nessus->launch_scan(scan_id => $scan_id)¶
Launches a scan.
See <https://your.nessus.server:8834/nessus6-api.html#/resources/scans/launch> for details.
$nessus->list_scans([folder_id => $id, last_modification_date => $date])¶
Returns the scan list.
See <https://your.nessus.server:8834/nessus6-api.html#/resources/scans/list> for details.
$nessus->set_scan_read_status(scan_id => $scan_id, status => $status)¶
Changes the status of a scan.
See <https://your.nessus.server:8834/nessus6-api.html#/resources/scans/read-status> for details.
$nessus->get_scan_details(scan_id => $scan_id, [history_id => $history_id])¶
Returns details for the given scan.
See <https://your.nessus.server:8834/nessus6-api.html#/resources/scans/details> for details.
$nessus->get_scan_host_details(scan_id => $scan_id, host_id => $host_id, [history_id => $history_id])¶
Returns details for the given host.
See <https://your.nessus.server:8834/nessus6-api.html#/resources/scans/host-details> for details.
$nessus->get_scan_export_status(scan_id => $scan_id, file_id => $file_id)¶
Check the file status of an exported scan.
See <https://your.nessus.server:8834/nessus6-api.html#/resources/scans/export-status> for details.
$nessus->get_scan_plugin_output(scan_id => $scan_id, host_id => $host_id, plugin_id => $plugin_id, [history_id => $history_id])¶
Returns the output for a given plugin.
See <https://your.nessus.server:8834/nessus6-api.html#/resources/scans/plugin-output> for details.
$nessus->get_scan_id(name => $name)¶
Returns the identifier for the scan with given name.
$nessus->get_scan_status(scan_id => $scan_id)¶
Returns the status for given scan.
$nessus->get_scan_history_id(scan_id => $scan_id, scan_uuid => $scan_uuid)¶
Returns the identifier for the historical results for given scan and run.
$nessus->list_templates(type => $type)¶
Returns the template list.
See <https://your.nessus.server:8834/nessus6-api.html#/resources/editor/list> for details.
$nessus->get_template_id(type => $type, name => $name)¶
Returns the identifier for template with given name.
$nessus->get_plugin_details( id => $plugin_id )¶
returns the details of a plugin
See <https://your.nessus.server:8834/nessus6-api.html#/resources/plugins/plugin-details> for details.
$nessus->list_plugin_families( )¶
returns a list of plugin families
See <https://your.nessus.server:8834/nessus6-api.html#/resources/plugins/families> for details.
$nessus->get_plugin_family_details( id => $family_id )¶
returns the details about a plugin family
See <https://your.nessus.server:8834/nessus6-api.html#/resources/plugins/family-details> for details.
$nessus->get_scanner_id( name => $name )¶
returns the identifier for the scanner with given name.
$nessus->file_upload(file => $file)¶
Uploads a file to the Nessus server. Returns a reference to hash with identifier to the uploaded file.
Example: my $result = $nessus->file_upload(file => $file); my $fileuploaded = $result->{'fileuploaded'};
See <https://your.nessus.server:8834/api#/resources/file/upload> for details.
$nessus->stop_scan(scan_id => $scan_id )¶
Returns details for the given scan.
See <https://your.nessus.server:8834/nessus6-api.html#/resources/scans/stop> for details.
LICENSE¶
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.
2022-10-13 | perl v5.34.0 |