PHP code example of leonjza / php-nessus-ng

1. Go to this page and download the library: Download leonjza/php-nessus-ng library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

leonjza / php-nessus-ng example snippets


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



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

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

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



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);
json
"leonjza/php-nessus-ng": "~1.0"