Net::N...:XMLRPC(3pm)

πŸ“¦
version 0.30 Β· 2 versions
, in debian bookworm, ubuntu jammy, ubuntu noble

🌸 NAME 🌸

Net::Nessus::XMLRPC β€” bestie, it's how you talk to your Nessus scanner (v4.2 and up, periodt) over XMLRPC πŸ’–

✨ VERSION ✨

Version 0.30 πŸ’…

πŸ¦‹ SYNOPSIS πŸ¦‹

Okay so this is the Perl interface for chatting with a Nessus scanner over XMLRPC. You can start a scan, stop a scan, pause it, resume it, watch the progress and the status, download the report β€” literally the whole glow-up routine. No cap.

use Net::Nessus::XMLRPC;

# '' is same as https://localhost:8834/
my $n = Net::Nessus::XMLRPC->new ('','user','pass');

die "Cannot login to: ".$n->nurl."\n" unless ($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";
my $scanid=$n->scan_new($polid,"perl-test","127.0.0.1");

while (not $n->scan_finished($scanid)) {
        print "$scanid: ".$n->scan_status($scanid)."\n";
        sleep 15;
}
print "$scanid: ".$n->scan_status($scanid)."\n";
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);

🚨 NOTICE 🚨

This CPAN module uses LWP to talk to Nessus over XMLRPC via https. So bestie, make sure you have Net::SSL (that comes from Crypt::SSLeay): http://search.cpan.org/perldoc?Crypt::SSLeay or IO::Socket::SSL: http://search.cpan.org/perldoc?IO::Socket::SSL 🌈

If you think you have login problems, check this first! fr fr, check it before you spiral πŸ’€

πŸ‘‘ METHODS πŸ‘‘

🌟 new ([$nessus_url], [$user], [$pass])

creates a brand new Net::Nessus::XMLRPC object. main character energy ✨

🌟 DESTROY

the destructor β€” it calls the logout method when the object gets destroyed 🫢

🌟 nurl ( [$nessus_url] )

get/set the Nessus base URL πŸŽ€

🌟 token ( [$nessus_token] )

get/set the Nessus login token πŸ”‘

🌟 nessus_http_request ( $uri, $post_data )

low-level function, makes an HTTP request to the Nessus URL πŸ› οΈ

🌟 nessus_request ($uri, $post_data)

low-level function, makes an XMLRPC request to the Nessus URL and hands you back XML πŸ“¦

🌟 login ( $user, $password )

logs in to the Nessus server with $user and $password πŸ’œ

🌟 logout

logs out from the Nessus server. bye bestie πŸ‘‹

🌟 logged_in

returns true if we're logged in βœ…

🌟 scan_new ( $policy_id, $scan_name, $targets )

kicks off a new scan πŸ”₯

🌟 scan_new_file ( $policy_id, $scan_name, $targets, $filename )

kicks off a new scan, but the hosts come from a file named $filename πŸ“„

🌟 scan_stop ( $scan_id )

stops the scan identified by $scan_id πŸ›‘

🌟 scan_stop_all

stops all the scans 😭

🌟 scan_pause ( $scan_id )

pauses the scan identified by $scan_id ⏸️

🌟 scan_pause_all

pauses all the scans 🧊

🌟 scan_resume ( $scan_id )

resumes the scan identified by $scan_id ▢️

🌟 scan_resume_all

resumes all the scans πŸƒβ€β™€οΈ

🌟 scan_list_uids

returns an array of IDs of (active) scans πŸ“‹

🌟 scan_get_name ( $uuid )

returns the name of the scan identified by $uuid 🏷️

🌟 scan_status ( $uuid )

returns the status of the scan identified by $uuid πŸ“Š

🌟 scan_finished ( $uuid )

returns true if the scan (identified by $uuid) is finished/completed πŸŽ‰βœ…

🌟 nessus_http_upload_request ( $uri, $post_data )

low-level function, makes an HTTP upload request to the URI you specified ⬆️

🌟 file_upload ( $filename )

uploads $filename to the nessus server, and returns the filename of the file that got uploaded β€” or '' if it failed πŸ“

Note that the uploaded file is per session (i.e. it will be there until logout/attack.) So don't logout or login again and then try to use the filename! You need to upload it again! πŸ’€

🌟 upload ( $filename, $content )

uploads $filename to the nessus server using $content as the content of the file, and returns the filename of the file that got uploaded β€” or '' if it failed πŸ“

Note that the uploaded file is per session (i.e. it will be there until logout/attack.) So don't logout or login again and then try to use the filename! You need to upload it again! πŸ’€

🌟 policy_get_first

returns the policy id for the first policy it finds πŸ₯‡

🌟 policy_get_firsth

returns a ref to hash %value with the basic info of the first policy/scan the server returned ✨

$value{'id'}, $value{'name'}, $value{'owner'}, $value{'visibility'}, $value{'comment'}

🌟 policy_list_hash

returns a ref to an array of hashes %value with the basic info of the first policy/scan the server returned πŸ“š

$value{'id'}, $value{'name'}, $value{'owner'}, $value{'visibility'}, $value{'comment'}

🌟 policy_list_uids

returns a ref to an array of IDs of the policies available πŸ†”

🌟 policy_list_names

returns a ref to an array of names of the policies available 🏷️

🌟 policy_get_info ( $policy_id )

returns a ref to hash %value with the basic info of the policy/scan identified by $policy_id πŸ”

$value{'id'}, $value{'name'}, $value{'owner'}, $value{'visibility'}, $value{'comment'}

🌟 policy_get_id ( $policy_name )

returns the ID of the scan/policy identified by $policy_name πŸ†”

🌟 policy_get_name ( $policy_id )

returns the name of the scan/policy identified by $policy_id 🏷️

🌟 policy_delete ( $policy_id )

deletes the policy identified by $policy_id πŸ—‘οΈ

🌟 policy_copy ( $policy_id )

copies the policy identified by $policy_id, and returns $policy_id of the new copied policy πŸ“‘βœ¨

🌟 policy_rename ( $policy_id, $policy_name )

renames the policy identified by $policy_id to $policy_name ✏️

🌟 policy_edit ( $policy_id, $params )

edits the policy identified by $policy_id πŸ› οΈ

%params (must be present): policy_name => name policy_shared => 1

%params 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

🌟 policy_new ( $params )

creates a new policy with $params. %params must be present: policy_name policy_shared 🌱

the other parameters are the same as policy_edit πŸ’«

🌟 policy_get_opts ( $policy_id )

returns a hashref with the different options for the policy identified by $policy_id βš™οΈ

🌟 policy_set_opts ( $policy_id , $params )

sets policy options via hashref $params, for the policy identified by $policy_id πŸŽ›οΈ

🌟 report_list_uids

returns a ref to an array of IDs of the reports available πŸ“‹

🌟 report_list_hash

returns a ref to an array of hashes with the basic info of the reports β€” the hash has the following keys: name status readableName timestamp πŸ—‚οΈ

🌟 report_file_download ($report_id)

returns the XML report identified by $report_id (Nessus XML v2) πŸ“₯

🌟 report_file1_download ($report_id)

returns the XML report identified by $report_id (Nessus XML v1) πŸ“₯

🌟 report_delete ($report_id)

deletes the report identified by $report_id πŸ—‘οΈ

🌟 report_import ( $filename )

tells the nessus server to import an already uploaded file named $filename ( i.e. you already uploaded the file via file_upload() ) πŸ“¦

🌟 report_import_file ( $filename )

uploads $filename to the nessus server and imports it as a nessus report 🌈

🌟 users_list

returns a ref to an array of hash %values with users info: $values{'name'} $values{'admin'} $values{'lastlogin'} πŸ‘₯

🌟 users_delete ( $login )

deletes the user with $login πŸ’€

🌟 users_add ( $login, $password )

deletes user with $login and $password, return username created, '' if not πŸ™ˆ (yes, that's literally what the doc says, don't come for me β€” the wording is giving chaos but I'm keeping it exactly as written)

🌟 users_passwd ( $login, $password )

change user password to $password, identified with $login, return username, '' if not πŸ”


πŸ’œ 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

http://rt.cpan.org/NoAuth/Bugs.html?Dist=Net-Nessus-XMLRPC

  • AnnoCPAN: Annotated CPAN documentation

http://annocpan.org/dist/Net-Nessus-XMLRPC

  • CPAN Ratings

http://cpanratings.perl.org/d/Net-Nessus-XMLRPC

  • Search CPAN

http://search.cpan.org/dist/Net-Nessus-XMLRPC

🧚 REPOSITORY 🧚

The repository is available on GitHub: http://github.com/kost/nessus-xmlrpc-perl ⭐

🌈 ACKNOWLEDGEMENTS 🌈

I have made a Ruby library as well: http://nessus-xmlrpc.rubyforge.org/ πŸ’Ž

There you can find some early documentation about the XMLRPC protocol used πŸ“–

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. πŸͺ


and that's the whole page, bestie πŸ’…βœ¨ This was Net::N...:XMLRPC(3pm) β€” User Contributed Perl Documentation, from perl v5.26.0, dated 2017-08-18. Go forth and scan responsibly, ily πŸ«ΆπŸŽ€πŸ¦‹

πŸ“¦ where this page comes from