NAME
Net::Nessus::XMLRPC - Communicate with Nessus scanner(v4.2+) via XMLRPC
VERSION
Version 0.02
SYNOPSIS
This is Perl interface for communication with Nessus scanner over XMLRPC. You can start, stop, pause and resume scan. Watch progress and status of scan, download report, etc.
use Net::Nessus::XMLRPC;
use strict;
# '' is same as https://localhost:8834/
my $n = Net::Nessus::XMLRPC->new ('','user','pass');
my $scanid;
$SIG{INT} = \&ctrlc;
if ($n->logged_in) {
print "Logged in\n";
my $polid=$n->policy_get_first;
print "Using policy ID: $polid ";
my $polname=$n->policy_get_name($polid);
print "with name: $polname\n";
$scanid=$n->scan_new($polid,"perl-test","127.0.0.1");
while (not $n->scan_finished($scanid)) {
print "Status of $scanid: ".$n->scan_status($scanid)."\n";
sleep 10;
}
print "Status of $scanid: ".$n->scan_status($scanid)."\n";
} else {
print "URL, user or password not correct: ".$n->nurl."\n";
}
sub ctrlc {
$SIG{INT} = \&ctrlc;
print "\nCTRL+C presssed, stopping scan.\n";
$n->scan_stop($scanid);
}
METHODS
new ([$nessus_url], [$user], [$pass])
creates new object Net::Nessus::XMLRPC
nurl ( [$nessus_url] )
get/set Nessus base URL
token ( [$nessus_token] )
get/set Nessus login token
nessus_http_request ( $uri, $post_data )
low-level function, makes HTTP request to Nessus URL
nessus_request ($uri, $post_data)
low-level function, makes XMLRPC request to Nessus URL and returns XML
login ( $user, $password )
login to Nessus server via $user and $password
logged_in
returns true if we're logged in
scan_new ( $policy_id, $scan_name, $targets )
initiates new scan
scan_stop ( $scan_id )
stops the scan identified by $scan_id
scan_stop_all
stops all scans
scan_pause ( $scan_id )
pauses the scan identified by $scan_id
scan_pause_all
pauses all scans
scan_resume ( $scan_id )
resumes the scan identified by $scan_id
scan_resume_all
resumes all scans
scan_list_uids
returns array of IDs of (active) scans
scan_get_name ( $uuid )
returns name of the scan identified by $uuid
scan_status ( $uuid )
returns status of the scan identified by $uuid
scan_finished ( $uuid )
returns true if scan is finished/completed (identified by $uuid)
policy_get_first
returns policy id for the first policy found
policy_list_uids
returns array of IDs of policies available
scan_list_names
returns array of names of policies available
policy_get_id ( $policy_name )
returns ID of the policy identified by $policy_name
policy_get_name ( $policy_id )
returns name of the scan identified by $policy_id
report_list_uids
returns array of IDs of reports available
report_file_download ($report_id)
returns XML report identified by $report_id (Nessus XML v2)
report_file1_download ($report_id)
returns XML report identified by $report_id (Nessus XML v1)
report_delete ($report_id)
delete report identified by $report_id
AUTHOR
Vlatko Kosturjak, <kost at linux.hr>
BUGS
Please report any bugs or feature requests to bug-net-nessus-xmlrpc at rt.cpan.org
, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Net-Nessus-XMLRPC. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
SUPPORT
You can find documentation for this module with the perldoc command.
perldoc Net::Nessus::XMLRPC
You can also look for information at:
RT: CPAN's request tracker
AnnoCPAN: Annotated CPAN documentation
CPAN Ratings
Search CPAN
ACKNOWLEDGEMENTS
I have made Ruby library as well: http://nessus-xmlrpc.rubyforge.org/
There you can find some early documentation about XMLRPC protocol used.
COPYRIGHT & LICENSE
Copyright 2010 Vlatko Kosturjak, all rights reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.