NAME
Net::SecurityCenter::API::ScanResult - Perl interface to Tenable.sc (SecurityCenter) Scan Result REST API
SYNOPSIS
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();
DESCRIPTION
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
CONSTRUCTOR
Net::SecurityCenter::API::ScanResult->new ( $client )
Create a new instance of Net::SecurityCenter::API::ScanResult using Net::SecurityCenter::REST class.
METHODS
download
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 IDfilename
: File
list
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,
);
Params:
fields
: List of fieldsstart_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 objectend_date
: End date of scan (seestart_date
)start_time
: Start date in epochend_date
: End date in epochfilter
: Filter (usable
,manageable
,running
orcompleted
)
Allowed Fields:
id
*name
**description
**status
**initiator
owner
ownerGroup
repository
scan
job
details
importStatus
importStart
importFinish
importDuration
downloadAvailable
downloadFormat
dataFormat
resultType
resultSource
running
errorDetails
importErrorDetails
totalIPs
scannedIPs
startTime
finishTime
scanDuration
completedIPs
completedChecks
totalChecks
(*) always comes back (**) comes back if fields list not specified
list_running
Get list of running scans.
Params:
fields
: Fields
list_completed
Get list of completed scans.
Params:
fields
: Fields
get
Gets the scan information associated with id
.
Params:
id
: Scan result IDfields
: Fields (seelist
)
progress
Get scan progress associated with id
.
print 'Scan progress: ' . $sc->progress( id => 1337 ) . '%';
Params:
id
: Scan result ID
status
Get scan status associated with id
.
print 'Scan status: ' . $sc->status( id => 1337 );
Params:
id
: Scan result ID
pause
Pause a scan associated with id
.
if ($sc->get_status( id => 1337 ) eq 'running') {
$sc->pause( id => 1337 );
}
Params:
id
: Scan result ID
resume
Resume a paused scan associated with id
.
if ($sc->get_status( id => 1337 ) eq 'paused') {
$sc->resume( id => 1337 );
}
Params:
id
: Scan result ID
import
Imports the Scan Result associated with the uploaded file, identified by filename
.
$sc->import( filename => '/tmp/report.nessus', repository => 1 );
Params:
filename
: Nessus report filename (required)repository
: Repository ID (required)scan_vhost
: Scan VirtualHostclassify_mitigated_age
: Classify Mitigated Agedhcp_tracking
DHCP Tracking
reimport
Re-imports the Scan Result associated with id
.
$sc->reimport( id => 1337 );
Params:
id
: Scan result ID
stop
Stop a scan associated with id
.
if ($sc->get_status( id => 1337 ) eq 'running') {
$sc->stop( id => 1337 );
}
Params:
id
: Scan result IDtype
: Stop type (values:import
)
delete
Delete a scan associated with id
.
if ($sc->get_status( id => 1337 ) eq 'completed') {
$sc->delete( id => 1337 );
}
Params:
id
: Scan result ID
Emails the Scan Result associated with id
.
$sc->email( id => 1337, email => 'john@example.org' );
Params:
id
: Scan result IDemail
: Email address
SUPPORT
Bugs / Feature Requests
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.
Source Code
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
AUTHOR
Giuseppe Di Terlizzi <gdt@cpan.org>
LICENSE AND COPYRIGHT
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.