2017 © Pedro Peláez
 

library php-nessus-ng

PHP wrapper functions for interfacing with the Nessus V6.x API

image

leonjza/php-nessus-ng

PHP wrapper functions for interfacing with the Nessus V6.x API

  • Tuesday, February 14, 2017
  • by leonjza
  • Repository
  • 6 Watchers
  • 13 Stars
  • 2,010 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 10 Forks
  • 1 Open issues
  • 21 Versions
  • 3 % Grown

The README.md

PHPNessusNG

Build Status Code Climate Latest Stable Version Total Downloads Latest Unstable Version License, (*1)

PHP wrapper functions for interfacing with the Nessus V6.x API., (*2)

If you are looking for the Nessus V5.x capable XMLRPC API Class, please see the n5 branch here, (*3)

Information:

The Nessus 6 Vulnerability Scanner provides a RESTful API interface. This library aims to be a wrapper around this API, allowing you to query it directly, as detailed in the API documentation., (*4)

One major advantage of this library is that it does not necessarily have to update when new endpoints are made available. It is simply a wrapper. Calls to the API can be made exactly as it is documented in the API reference found at the /api resource of your local scanner. For eg. If a API endpoint is defined as:, (*5)

DELETE /scans/{scan_id}

Then you can call it with:, (*6)

$client->scans($id)->via('delete');

The latest version of this wrapper has only been tested against a Nessus 6.1 scanner., (*7)

Concepts:

There are a fair number of ways to use this library. All methods start the same way though; Instantiating a new instance. The library will handle the authentication cookie automatically internally., (*8)

Some examples of calling the API:, (*9)

<?php

include 'vendor/autoload.php';

$t = new Nessus\Client('username', 'password', 'hostname.local');

Now, you may call API methods either via method chaining, or via the call(), method.
A method chaining example (assuming $scan_id == 5) would be:, (*10)

// Get a file ID for a new report export
$file_id = $t->scans($scan_id)->export()->setFields(array('format' => 'nessus'))->via('post');

The same using the call() method would be:, (*11)

// Get a file ID for a new report export
$t->setFields(array('format' => 'nessus'));
$t->call('scans/5/export/');
$file_id = $t->via('post');

NOTE: All calls should end with a via($method), where $method is the HTTP method to use. via() accepts a second argument, which specifies if a response should be returned raw if true, or a parsed JSON object if not set (false)., (*12)

Installation:

The easiest way by far would be to install the library via composer. Add the following line to your composer.json:, (*13)

"leonjza/php-nessus-ng": "~1.0"

Run php composer.phar update. You should now have the \Nessus class available to use., (*14)

This will give you the Nessus V6 compatible library. As previously mentioned, should you require the V5 compatile version, its details can be found in the n5 branch., (*15)

Usage example:

Include the Composer Autoloader, instantiate a new instance, and start using it. Below is an example script that will download the first available report in the .nessus format:, (*16)

<?php

include 'vendor/autoload.php';

$t = new Nessus\Client('username', 'password', 'hostname.local');

// Get a scan_id to export a report for.
$scan_id = $t->scans()->via('get')->scans[0]->id;

// Request the export, taking note of the returned file_id that we need.
$file_id = $t->scans($scan_id)->export()->setFields(array('format' => 'nessus'))->via('post')->file;

// Set a status that will update as we poll for a status
$export_status = 'waiting';

// If the export status is ready, break.
while ($export_status != 'ready') {

    // Poll for a status update
    $export_status = $t->scans($scan_id)->export($file_id)->status()->via('get')->status;

    // Wait 1 second before another poll
    sleep(1);
}

// Get the .nessus report export, specifying that we want it via a raw get
$file = $t->scans($scan_id)->export($file_id)->download()->via('get', true);

Contact

Twitter: @leonjza, (*17)

The Versions

14/02 2017

dev-master

9999999-dev

PHP wrapper functions for interfacing with the Nessus V6.x API

  Sources   Download

MIT

The Requires

 

The Development Requires

by Peter Scopes

14/02 2017

1.0.8

1.0.8.0

PHP wrapper functions for interfacing with the Nessus V6.x API

  Sources   Download

MIT

The Requires

 

The Development Requires

by Peter Scopes

26/10 2016

1.0.7

1.0.7.0

PHP wrapper functions for interfacing with the Nessus V6.x API

  Sources   Download

MIT

The Requires

 

The Development Requires

by Peter Scopes

19/10 2016

1.0.6

1.0.6.0

PHP wrapper functions for interfacing with the Nessus V6.x API

  Sources   Download

MIT

The Requires

 

The Development Requires

by Peter Scopes

29/05 2015

1.0.5

1.0.5.0

PHP wrapper functions for interfacing with the Nessus V6.x API

  Sources   Download

MIT

The Requires

 

12/03 2015

1.0.4

1.0.4.0

PHP wrapper functions for interfacing with the Nessus V6.x API

  Sources   Download

MIT

The Requires

 

26/11 2014

1.0.3

1.0.3.0

PHP wrapper functions for interfacing with the Nessus V6.x API

  Sources   Download

MIT

The Requires

 

25/11 2014

1.0.2

1.0.2.0

PHP wrapper functions for interfacing with the Nessus V6.x API

  Sources   Download

MIT

The Requires

 

12/11 2014

1.0.1

1.0.1.0

PHP wrapper functions for interfacing with the Nessus V6.x API

  Sources   Download

MIT

The Requires

 

23/10 2014

1.0.0

1.0.0.0

PHP wrapper functions for interfacing with the Nessus API

  Sources   Download

MIT

The Requires

 

17/10 2014

dev-n5

dev-n5

PHP wrapper functions for interfacing with the Nessus API

  Sources   Download

MIT

The Requires

 

10/10 2014

0.6

0.6.0.0

PHP wrapper functions for interfacing with the Nessus API

  Sources   Download

MIT

The Requires

 

01/10 2014

0.5.4

0.5.4.0

PHP wrapper functions for interfacing with the Nessus API

  Sources   Download

MIT

The Requires

 

21/08 2014

0.5.3

0.5.3.0

PHP wrapper functions for interfacing with the Nessus API

  Sources   Download

MIT

The Requires

 

21/08 2014

0.5.2

0.5.2.0

PHP wrapper functions for interfacing with the Nessus API

  Sources   Download

MIT

The Requires

 

20/08 2014

0.5.1

0.5.1.0

PHP wrapper functions for interfacing with the Nessus API

  Sources   Download

MIT

The Requires

 

20/08 2014

0.5

0.5.0.0

PHP wrapper functions for interfacing with the Nessus API

  Sources   Download

MIT

The Requires

 

28/07 2014

0.4

0.4.0.0

PHP wrapper functions for interfacing with the Nessus API

  Sources   Download

MIT

The Requires

 

23/07 2014

0.3

0.3.0.0

PHP wrapper functions for interfacing with the Nessus API

  Sources   Download

MIT

The Requires

 

08/07 2014

0.2

0.2.0.0

PHP wrapper functions for interfacing with the Nessus API

  Sources   Download

MIT

The Requires

 

08/07 2014

0.1

0.1.0.0

PHP wrapper functions for interfacing with the Nessus API

  Sources   Download

MIT

The Requires