Net::SecurityCenter::API::ScanResult - Perl interface to Tenable.sc (SecurityCenter) Scan Result REST API
use Net::SecurityCenter::REST; use Net::SecurityCenter::API::ScanResult; my $sc = Net::SecurityCenter::REST->new('sc.example.org'); $sc->login('secman', 'password'); my $api = Net::SecurityCenter::API::ScanResult->new($sc); $sc->logout();
This module provides Perl scripts easy way to interface the Scan Result REST API of Tenable.sc (SecurityCenter).
For more information about the Tenable.sc (SecurityCenter) REST API follow the online documentation:
https://docs.tenable.com/sccv/api/index.html
Create a new instance of Net::SecurityCenter::API::ScanResult using Net::SecurityCenter::REST class.
Download the Nessus (XML) scan result.
my $nessus_scan = $sc->download( id => 1337 ); $sc->download( id => 1337, filename => '/var/nessus/scans/1337.nessus' );
Params:
id : Scan result ID
id
filename : File
filename
Get list of scans results (completed, running, etc.).
my $scans = $sc->list( start_date => '2020-01-01', end_date => '2020-02-01', fields => 'id,name,description,startTime,finishTime', ); # Using Time::Piece use Time::Piece; use Time::Seconds; my $t = Time::Piece->new; $t -= ONE_DAY; # Yesterday my $scans = $sc->list( start_date => $t, );
fields : List of fields
fields
start_date : Start date of scan in ISO 8601 format (YYYY-MM-DD, YYYY-MM-DD HH:MM:SS or YYYY-MM-DDTHH:MM:SS) or Time::Piece object
start_date
end_date : End date of scan (see start_date)
end_date
start_time : Start date in epoch
start_time
end_date : End date in epoch
filter : Filter (usable, manageable, running or completed)
filter
usable
manageable
running
completed
Allowed Fields:
id *
name **
name
description **
description
status **
status
initiator
owner
ownerGroup
repository
scan
job
details
importStatus
importStart
importFinish
importDuration
downloadAvailable
downloadFormat
dataFormat
resultType
resultSource
errorDetails
importErrorDetails
totalIPs
scannedIPs
startTime
finishTime
scanDuration
completedIPs
completedChecks
totalChecks
(*) always comes back (**) comes back if fields list not specified
Get list of running scans.
fields : Fields
Get list of completed scans.
Gets the scan information associated with id.
fields : Fields (see list)
list
Get scan progress associated with id.
print 'Scan progress: ' . $sc->progress( id => 1337 ) . '%';
Get scan status associated with id.
print 'Scan status: ' . $sc->status( id => 1337 );
Pause a scan associated with id.
if ($sc->get_status( id => 1337 ) eq 'running') { $sc->pause( id => 1337 ); }
Resume a paused scan associated with id.
if ($sc->get_status( id => 1337 ) eq 'paused') { $sc->resume( id => 1337 ); }
Imports the Scan Result associated with the uploaded file, identified by filename.
$sc->import( filename => '/tmp/report.nessus', repository => 1 );
filename : Nessus report filename (required)
repository : Repository ID (required)
scan_vhost : Scan VirtualHost
scan_vhost
classify_mitigated_age : Classify Mitigated Age
classify_mitigated_age
dhcp_tracking DHCP Tracking
dhcp_tracking
Re-imports the Scan Result associated with id.
$sc->reimport( id => 1337 );
Stop a scan associated with id.
if ($sc->get_status( id => 1337 ) eq 'running') { $sc->stop( id => 1337 ); }
type : Stop type (values: import)
type
import
Delete a scan associated with id.
if ($sc->get_status( id => 1337 ) eq 'completed') { $sc->delete( id => 1337 ); }
Emails the Scan Result associated with id.
$sc->email( id => 1337, email => 'john@example.org' );
email : Email address
email
Please report any bugs or feature requests through the issue tracker at https://github.com/giterlizzi/perl-Net-SecurityCenter/issues. You will be notified automatically of any progress on your issue.
This is open source software. The code repository is available for public review and contribution under the terms of the license.
https://github.com/giterlizzi/perl-Net-SecurityCenter
git clone https://github.com/giterlizzi/perl-Net-SecurityCenter.git
Giuseppe Di Terlizzi <gdt@cpan.org>
This software is copyright (c) 2018-2023 by Giuseppe Di Terlizzi.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
To install Net::SecurityCenter, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Net::SecurityCenter
CPAN shell
perl -MCPAN -e shell install Net::SecurityCenter
For more information on module installation, please visit the detailed CPAN module installation guide.