---
name: "Net::Nessus::XMLRPC"
section: "3pm"
platform: "linux"
package: "libnet-nessus-xmlrpc-perl"
version: "0.30-3"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/Net::Nessus::XMLRPC"
---

# Net::Nessus::XMLRPC(3pm)

Communicate with Nessus scanner(v4.2+) via XMLRPC

## NAME

Net::Nessus::XMLRPC - Communicate with Nessus scanner(v4.2+) via XMLRPC

## VERSION

Version 0.30

## 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;
        # '' 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 for communicating with Nessus over XMLRPC 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

If you think you have login problems, check this first!

## METHODS

### new (\[$nessus\_url\], \[$user\], \[$pass\])

creates new object Net::Nessus::XMLRPC

### DESTROY

destructor, calls logout method on destruction

### 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`

### logout

logout from Nessus server

### logged\_in

returns true if we're logged in

### scan\_new ( $policy\_id, $scan\_name, $targets )

initiates new scan

### scan\_new\_file ( $policy\_id, $scan\_name, $targets, $filename )

initiates new scan with hosts from file named `$filename`

### 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`)

### nessus\_http\_upload\_request ( $uri, $post\_data )

low-level function, makes HTTP upload request to URI specified

### file\_upload ( $filename )

uploads `$filename` to nessus server, returns filename of file uploaded or '' if failed

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!

### upload ( $filename, $content )

uploads `$filename` to nessus server using `$content` as content of file, returns filename of file uploaded or '' if failed

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!

### policy\_get\_first

returns policy id for the first policy found

### policy\_get\_firsth

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

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

### policy\_list\_hash

returns ref to array of hashes `%value` with basic info of first policy/scan  returned by the server

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

### policy\_list\_uids

returns ref to array of IDs of policies available

### policy\_list\_names

returns ref to array of names of policies available

### policy\_get\_info ( $policy\_id )

returns ref to hash `%value` with basic info of policy/scan identified by `$policy_id`

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

### policy\_get\_id ( $policy\_name )

returns ID of the scan/policy identified by `$policy_name`

### policy\_get\_name ( $policy\_id )

returns name of the scan/policy identified by `$policy_id`

### policy\_delete ( $policy\_id )

delete policy identified by `$policy_id`

### policy\_copy ( $policy\_id )

copy policy identified by `$policy_id`, returns `$policy_id` of new copied policy

### policy\_rename ( $policy\_id, $policy\_name )

rename policy to `$policy_name` identified by `$policy_id`

### policy\_edit ( $policy\_id, $params )

edit 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 )

create new policy with `$params`,  `%params` must be present: policy\_name policy\_shared

the others parameters are same as policy\_edit

### policy\_get\_opts ( $policy\_id )

returns hashref with different options for policy identified by `$policy_id`

### policy\_set\_opts ( $policy\_id , $params )

sets policy options via hashref `$params` identified by `$policy_id`

### report\_list\_uids

returns ref to array of IDs of reports available

### report\_list\_hash

returns ref to array of hashes with basic info of reports  hash has following keys: name status readableName timestamp

### 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`

### report\_import ( $filename )

tells nessus server to import already uploaded file named `$filename` ( i.e. you already uploaded the file via **file\_upload()** )

### report\_import\_file ( $filename )

uploads `$filename` to nessus server and imports it as nessus report

### users\_list

returns ref to array of hash `%values` with users info  `$values`{'name'} `$values`{'admin'} `$values`{'lastlogin'}

### users\_delete ( $login )

deletes user with `$login`

### users\_add ( $login, $password )

deletes user with `$login` and `$password`, return username created, '' if not

### 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

Repository is available on GitHub: http://github.com/kost/nessus-xmlrpc-perl

## 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.
