Perl interface to Tenable.sc (SecurityCenter) REST API
View the Project on GitHub giterlizzi/perl-Net-SecurityCenter
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 IDfilename
: FileGet 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 (see start_date
)start_time
: Start date in epochend_date
: End date in epochfilter
: Filter (usable
, manageable
, running
or completed
)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
Get list of running scans.
Params:
fields
: FieldsGet list of completed scans.
Params:
fields
: FieldsGets the scan information associated with id
.
Params:
id
: Scan result IDfields
: Fields (see list
)Get scan progress associated with id
.
print 'Scan progress: ' . $sc->progress( id => 1337 ) . '%';
Params:
id
: Scan result IDGet scan status associated with id
.
print 'Scan status: ' . $sc->status( id => 1337 );
Params:
id
: Scan result IDPause a scan associated with id
.
if ($sc->get_status( id => 1337 ) eq 'running') {
$sc->pause( id => 1337 );
}
Params:
id
: Scan result IDResume a paused scan associated with id
.
if ($sc->get_status( id => 1337 ) eq 'paused') {
$sc->resume( id => 1337 );
}
Params:
id
: Scan result IDImports 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 TrackingRe-imports the Scan Result associated with id
.
$sc->reimport( id => 1337 );
Params:
id
: Scan result IDStop 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
)Emails the Scan Result associated with id
.
$sc->email( id => 1337, email => 'john@example.org' );
Params:
id
: Scan result IDemail
: Email addressPlease 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
This software is copyright (c) 2018-2021 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.