.\" Automatically generated by Pod::Man 4.09 (Pod::Simple 3.35) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .if !\nF .nr F 0 .if \nF>0 \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} .\} .\" ======================================================================== .\" .IX Title "Net::Nessus::XMLRPC 3pm" .TH Net::Nessus::XMLRPC 3pm "2017-08-18" "perl v5.26.0" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" Net::Nessus::XMLRPC \- Communicate with Nessus scanner(v4.2+) via XMLRPC .SH "VERSION" .IX Header "VERSION" Version 0.30 .SH "SYNOPSIS" .IX Header "SYNOPSIS" This is Perl interface for communication with Nessus scanner over \s-1XMLRPC.\s0 You can start, stop, pause and resume scan. Watch progress and status of scan, download report, etc. .PP .Vb 1 \& use Net::Nessus::XMLRPC; \& \& # \*(Aq\*(Aq is same as https://localhost:8834/ \& my $n = Net::Nessus::XMLRPC\->new (\*(Aq\*(Aq,\*(Aquser\*(Aq,\*(Aqpass\*(Aq); \& \& die "Cannot login to: ".$n\->nurl."\en" unless ($n\->logged_in); \& \& print "Logged in\en"; \& my $polid=$n\->policy_get_first; \& print "Using policy ID: $polid "; \& my $polname=$n\->policy_get_name($polid); \& print "with name: $polname\en"; \& my $scanid=$n\->scan_new($polid,"perl\-test","127.0.0.1"); \& \& while (not $n\->scan_finished($scanid)) { \& print "$scanid: ".$n\->scan_status($scanid)."\en"; \& sleep 15; \& } \& print "$scanid: ".$n\->scan_status($scanid)."\en"; \& my $reportcont=$n\->report_file_download($scanid); \& my $reportfile="report.xml"; \& open (FILE,">$reportfile") or die "Cannot open file $reportfile: $!"; \& print FILE $reportcont; \& close (FILE); .Ve .SH "NOTICE" .IX Header "NOTICE" This \s-1CPAN\s0 module uses \s-1LWP\s0 for communicating with Nessus over \s-1XMLRPC\s0 via https. Therefore, make sure that you have Net::SSL (provided by Crypt::SSLeay): http://search.cpan.org/perldoc?Crypt::SSLeay or IO::Socket::SSL: http://search.cpan.org/perldoc?IO::Socket::SSL .PP If you think you have login problems, check this first! .SH "METHODS" .IX Header "METHODS" .SS "new ([$nessus_url], [$user], [$pass])" .IX Subsection "new ([$nessus_url], [$user], [$pass])" creates new object Net::Nessus::XMLRPC .SS "\s-1DESTROY\s0" .IX Subsection "DESTROY" destructor, calls logout method on destruction .SS "nurl ( [$nessus_url] )" .IX Subsection "nurl ( [$nessus_url] )" get/set Nessus base \s-1URL\s0 .SS "token ( [$nessus_token] )" .IX Subsection "token ( [$nessus_token] )" get/set Nessus login token .ie n .SS "nessus_http_request ( $uri, $post_data )" .el .SS "nessus_http_request ( \f(CW$uri\fP, \f(CW$post_data\fP )" .IX Subsection "nessus_http_request ( $uri, $post_data )" low-level function, makes \s-1HTTP\s0 request to Nessus \s-1URL\s0 .ie n .SS "nessus_request ($uri, $post_data)" .el .SS "nessus_request ($uri, \f(CW$post_data\fP)" .IX Subsection "nessus_request ($uri, $post_data)" low-level function, makes \s-1XMLRPC\s0 request to Nessus \s-1URL\s0 and returns \s-1XML\s0 .ie n .SS "login ( $user, $password )" .el .SS "login ( \f(CW$user\fP, \f(CW$password\fP )" .IX Subsection "login ( $user, $password )" login to Nessus server via \f(CW$user\fR and \f(CW$password\fR .SS "logout" .IX Subsection "logout" logout from Nessus server .SS "logged_in" .IX Subsection "logged_in" returns true if we're logged in .ie n .SS "scan_new ( $policy_id, $scan_name, $targets )" .el .SS "scan_new ( \f(CW$policy_id\fP, \f(CW$scan_name\fP, \f(CW$targets\fP )" .IX Subsection "scan_new ( $policy_id, $scan_name, $targets )" initiates new scan .ie n .SS "scan_new_file ( $policy_id, $scan_name, $targets, $filename )" .el .SS "scan_new_file ( \f(CW$policy_id\fP, \f(CW$scan_name\fP, \f(CW$targets\fP, \f(CW$filename\fP )" .IX Subsection "scan_new_file ( $policy_id, $scan_name, $targets, $filename )" initiates new scan with hosts from file named \f(CW$filename\fR .ie n .SS "scan_stop ( $scan_id )" .el .SS "scan_stop ( \f(CW$scan_id\fP )" .IX Subsection "scan_stop ( $scan_id )" stops the scan identified by \f(CW$scan_id\fR .SS "scan_stop_all" .IX Subsection "scan_stop_all" stops all scans .ie n .SS "scan_pause ( $scan_id )" .el .SS "scan_pause ( \f(CW$scan_id\fP )" .IX Subsection "scan_pause ( $scan_id )" pauses the scan identified by \f(CW$scan_id\fR .SS "scan_pause_all" .IX Subsection "scan_pause_all" pauses all scans .ie n .SS "scan_resume ( $scan_id )" .el .SS "scan_resume ( \f(CW$scan_id\fP )" .IX Subsection "scan_resume ( $scan_id )" resumes the scan identified by \f(CW$scan_id\fR .SS "scan_resume_all" .IX Subsection "scan_resume_all" resumes all scans .SS "scan_list_uids" .IX Subsection "scan_list_uids" returns array of IDs of (active) scans .ie n .SS "scan_get_name ( $uuid )" .el .SS "scan_get_name ( \f(CW$uuid\fP )" .IX Subsection "scan_get_name ( $uuid )" returns name of the scan identified by \f(CW$uuid\fR .ie n .SS "scan_status ( $uuid )" .el .SS "scan_status ( \f(CW$uuid\fP )" .IX Subsection "scan_status ( $uuid )" returns status of the scan identified by \f(CW$uuid\fR .ie n .SS "scan_finished ( $uuid )" .el .SS "scan_finished ( \f(CW$uuid\fP )" .IX Subsection "scan_finished ( $uuid )" returns true if scan is finished/completed (identified by \f(CW$uuid\fR) .ie n .SS "nessus_http_upload_request ( $uri, $post_data )" .el .SS "nessus_http_upload_request ( \f(CW$uri\fP, \f(CW$post_data\fP )" .IX Subsection "nessus_http_upload_request ( $uri, $post_data )" low-level function, makes \s-1HTTP\s0 upload request to \s-1URI\s0 specified .ie n .SS "file_upload ( $filename )" .el .SS "file_upload ( \f(CW$filename\fP )" .IX Subsection "file_upload ( $filename )" uploads \f(CW$filename\fR to nessus server, returns filename of file uploaded or '' if failed .PP Note that uploaded file is per session (i.e. it will be there until logout/attack.) So, don't logout or login again and use the filename! You need to upload it again! .ie n .SS "upload ( $filename, $content )" .el .SS "upload ( \f(CW$filename\fP, \f(CW$content\fP )" .IX Subsection "upload ( $filename, $content )" uploads \f(CW$filename\fR to nessus server using \f(CW$content\fR as content of file, returns filename of file uploaded or '' if failed .PP Note that uploaded file is per session (i.e. it will be there until logout/attack.) So, don't logout or login again and use the filename! You need to upload it again! .SS "policy_get_first" .IX Subsection "policy_get_first" returns policy id for the first policy found .SS "policy_get_firsth" .IX Subsection "policy_get_firsth" returns ref to hash \f(CW%value\fR with basic info of first policy/scan returned by the server .PP \&\f(CW$value\fR{'id'}, \f(CW$value\fR{'name'}, \f(CW$value\fR{'owner'}, \f(CW$value\fR{'visibility'}, \&\f(CW$value\fR{'comment'} .SS "policy_list_hash" .IX Subsection "policy_list_hash" returns ref to array of hashes \f(CW%value\fR with basic info of first policy/scan returned by the server .PP \&\f(CW$value\fR{'id'}, \f(CW$value\fR{'name'}, \f(CW$value\fR{'owner'}, \f(CW$value\fR{'visibility'}, \&\f(CW$value\fR{'comment'} .SS "policy_list_uids" .IX Subsection "policy_list_uids" returns ref to array of IDs of policies available .SS "policy_list_names" .IX Subsection "policy_list_names" returns ref to array of names of policies available .ie n .SS "policy_get_info ( $policy_id )" .el .SS "policy_get_info ( \f(CW$policy_id\fP )" .IX Subsection "policy_get_info ( $policy_id )" returns ref to hash \f(CW%value\fR with basic info of policy/scan identified by \f(CW$policy_id\fR .PP \&\f(CW$value\fR{'id'}, \f(CW$value\fR{'name'}, \f(CW$value\fR{'owner'}, \f(CW$value\fR{'visibility'}, \&\f(CW$value\fR{'comment'} .ie n .SS "policy_get_id ( $policy_name )" .el .SS "policy_get_id ( \f(CW$policy_name\fP )" .IX Subsection "policy_get_id ( $policy_name )" returns \s-1ID\s0 of the scan/policy identified by \f(CW$policy_name\fR .ie n .SS "policy_get_name ( $policy_id )" .el .SS "policy_get_name ( \f(CW$policy_id\fP )" .IX Subsection "policy_get_name ( $policy_id )" returns name of the scan/policy identified by \f(CW$policy_id\fR .ie n .SS "policy_delete ( $policy_id )" .el .SS "policy_delete ( \f(CW$policy_id\fP )" .IX Subsection "policy_delete ( $policy_id )" delete policy identified by \f(CW$policy_id\fR .ie n .SS "policy_copy ( $policy_id )" .el .SS "policy_copy ( \f(CW$policy_id\fP )" .IX Subsection "policy_copy ( $policy_id )" copy policy identified by \f(CW$policy_id\fR, returns \f(CW$policy_id\fR of new copied policy .ie n .SS "policy_rename ( $policy_id, $policy_name )" .el .SS "policy_rename ( \f(CW$policy_id\fP, \f(CW$policy_name\fP )" .IX Subsection "policy_rename ( $policy_id, $policy_name )" rename policy to \f(CW$policy_name\fR identified by \f(CW$policy_id\fR .ie n .SS "policy_edit ( $policy_id, $params )" .el .SS "policy_edit ( \f(CW$policy_id\fP, \f(CW$params\fP )" .IX Subsection "policy_edit ( $policy_id, $params )" edit policy identified by \f(CW$policy_id\fR .PP \&\f(CW%params\fR (must be present): policy_name => name policy_shared => 1 .PP \&\f(CW%params\fR can be (examples) max_hosts => 50, max_checks=> 10, use_mac_addr => no, throttle_scan => yes, optimize_test => yes, log_whole_attack => no, ssl_cipher_list => strong, save_knowledge_base => no, port_range => 1\-65535 .ie n .SS "policy_new ( $params )" .el .SS "policy_new ( \f(CW$params\fP )" .IX Subsection "policy_new ( $params )" create new policy with \f(CW$params\fR, \&\f(CW%params\fR must be present: policy_name policy_shared .PP the others parameters are same as policy_edit .ie n .SS "policy_get_opts ( $policy_id )" .el .SS "policy_get_opts ( \f(CW$policy_id\fP )" .IX Subsection "policy_get_opts ( $policy_id )" returns hashref with different options for policy identified by \f(CW$policy_id\fR .ie n .SS "policy_set_opts ( $policy_id , $params )" .el .SS "policy_set_opts ( \f(CW$policy_id\fP , \f(CW$params\fP )" .IX Subsection "policy_set_opts ( $policy_id , $params )" sets policy options via hashref \f(CW$params\fR identified by \f(CW$policy_id\fR .SS "report_list_uids" .IX Subsection "report_list_uids" returns ref to array of IDs of reports available .SS "report_list_hash" .IX Subsection "report_list_hash" returns ref to array of hashes with basic info of reports hash has following keys: name status readableName timestamp .SS "report_file_download ($report_id)" .IX Subsection "report_file_download ($report_id)" returns \s-1XML\s0 report identified by \f(CW$report_id\fR (Nessus \s-1XML\s0 v2) .SS "report_file1_download ($report_id)" .IX Subsection "report_file1_download ($report_id)" returns \s-1XML\s0 report identified by \f(CW$report_id\fR (Nessus \s-1XML\s0 v1) .SS "report_delete ($report_id)" .IX Subsection "report_delete ($report_id)" delete report identified by \f(CW$report_id\fR .ie n .SS "report_import ( $filename )" .el .SS "report_import ( \f(CW$filename\fP )" .IX Subsection "report_import ( $filename )" tells nessus server to import already uploaded file named \f(CW$filename\fR ( i.e. you already uploaded the file via \fIfile_upload()\fR ) .ie n .SS "report_import_file ( $filename )" .el .SS "report_import_file ( \f(CW$filename\fP )" .IX Subsection "report_import_file ( $filename )" uploads \f(CW$filename\fR to nessus server and imports it as nessus report .SS "users_list" .IX Subsection "users_list" returns ref to array of hash \f(CW%values\fR with users info \&\f(CW$values\fR{'name'} \&\f(CW$values\fR{'admin'} \&\f(CW$values\fR{'lastlogin'} .ie n .SS "users_delete ( $login )" .el .SS "users_delete ( \f(CW$login\fP )" .IX Subsection "users_delete ( $login )" deletes user with \f(CW$login\fR .ie n .SS "users_add ( $login, $password )" .el .SS "users_add ( \f(CW$login\fP, \f(CW$password\fP )" .IX Subsection "users_add ( $login, $password )" deletes user with \f(CW$login\fR and \f(CW$password\fR, return username created, '' if not .ie n .SS "users_passwd ( $login, $password )" .el .SS "users_passwd ( \f(CW$login\fP, \f(CW$password\fP )" .IX Subsection "users_passwd ( $login, $password )" change user password to \f(CW$password\fR identified with \f(CW$login\fR, return username, '' if not .SH "AUTHOR" .IX Header "AUTHOR" Vlatko Kosturjak, \f(CW\*(C`\*(C'\fR .SH "BUGS" .IX Header "BUGS" Please report any bugs or feature requests to \f(CW\*(C`bug\-net\-nessus\-xmlrpc at rt.cpan.org\*(C'\fR, or through the web interface at . I will be notified, and then you'll automatically be notified of progress on your bug as I make changes. .SH "SUPPORT" .IX Header "SUPPORT" You can find documentation for this module with the perldoc command. .PP .Vb 1 \& perldoc Net::Nessus::XMLRPC .Ve .PP You can also look for information at: .IP "\(bu" 4 \&\s-1RT: CPAN\s0's request tracker .Sp .IP "\(bu" 4 AnnoCPAN: Annotated \s-1CPAN\s0 documentation .Sp .IP "\(bu" 4 \&\s-1CPAN\s0 Ratings .Sp .IP "\(bu" 4 Search \s-1CPAN\s0 .Sp .SH "REPOSITORY" .IX Header "REPOSITORY" Repository is available on GitHub: http://github.com/kost/nessus\-xmlrpc\-perl .SH "ACKNOWLEDGEMENTS" .IX Header "ACKNOWLEDGEMENTS" I have made Ruby library as well: http://nessus\-xmlrpc.rubyforge.org/ .PP There you can find some early documentation about \s-1XMLRPC\s0 protocol used. .SH "COPYRIGHT & LICENSE" .IX Header "COPYRIGHT & LICENSE" Copyright 2010 Vlatko Kosturjak, all rights reserved. .PP This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.