3 Replies Latest reply: Oct 13, 2017 2:07 AM by mne RSS

Nessus REST API - scan export with filtering problem

mne Novice

Hi all,

i'm trying to export some scan results from my nessus 6.11.1 via REST API.

I have scanned a whole subnet and i would like to generate an html report containing the data of a single ip address.

To achieve this result I would like to use the export-request api method ( Tenable.io API Documentation ) with a filter applied. I've tried with this method but it seems that the filter is not working and i'm getting an export of the whole subnet. Here some of my code snippets in python:

 

 

scan_export = nUrl + '/scans/' + str(sID) + '/export'  ## My nessus url

tstring = 'token=' + nToken

h = { 'X-Cookie': tstring , 'Content-Type': 'application/json'}  #headers, auth token and content type

nPayload = { 'format': 'html', 'chapters': 'vuln_hosts_summary', 'filters': [ { 'filter': 'host.hostname', 'quality': 'eq', 'value': '192.168.0.2' } ], 'filter.search_type': 'and' }  #Post data

r = requests.post(scan_export, headers=h, data=json.dumps(nPayload), verify=False)


I've also tried with other filter types (e.g. only Critical vulns or similar) but the filter gets ignored