pyTenable icon indicating copy to clipboard operation
pyTenable copied to clipboard

scan/policy/ is archaic or obsolete in Nessus v10.2.0

Open Orangelxl opened this issue 3 years ago • 3 comments

The following error occurred when I created a task using pyTenables v1.4.8:

tio.scans.create(name="testuuid", targets=['172.16.1.130'], policy=4)
[404: GET] https://172.16.1.128:8834/editor/scan/policy/4 body=b'{"error":"The requested file was not found."}'
Traceback (most recent call last):
  File "D:/project/testing/tal-hst/core/nessus/nessus_scan.py", line 58, in <module>
    tio.scans.create(name="test2", targets=['172.16.1.130'], policy=4)
  File "C:\Python38\lib\site-packages\tenable\io\scans.py", line 697, in create
    scan = self._create_scan_document(kw)
  File "C:\Python38\lib\site-packages\tenable\io\scans.py", line 106, in _create_scan_document
    policy_tmpl = self._api.editor.details('scan/policy', item['id'])
  File "C:\Python38\lib\site-packages\tenable\io\editor.py", line 286, in details
    editor = self.obj_details(etype, id)
  File "C:\Python38\lib\site-packages\tenable\io\editor.py", line 212, in obj_details
    return self._api.get(
  File "C:\Python38\lib\site-packages\restfly\session.py", line 603, in get
    return self._req('GET', path, **kwargs)
  File "C:\Python38\lib\site-packages\restfly\session.py", line 559, in _req
    raise error_resp
restfly.errors.NotFoundError: [404: GET] https://172.16.1.128:8834/editor/scan/policy/4 body=b'{"error":"The requested file was not found."}'

In Nessus API Documentation v. 10.2.0, the/editor/scan/policy/{id} interface has been changed to/editor/{type}/{id} (The type of templates to retrieve (scan or policy).)

Finally, I solved the problem with the parameter policy_id. Maybe you could update the interface.

tio.scans.create(name="testuuid", targets=['172.16.1.130'], policy_id=4)

Orangelxl avatar Oct 25 '22 02:10 Orangelxl

Is this Nessus or IO?

SteveMcGrath avatar Oct 25 '22 14:10 SteveMcGrath

Thanks for bringing to our notice @Orangelxl, will review and update.

inayathulla avatar Nov 08 '22 06:11 inayathulla

@Orangelxl /editor/scan/policy/{id} is a valid Tenable.io endpoint.

The value passed to the keyword argument - policy gets added to policy_id in the json payload eventually after these steps. By passing policy_id directly, you run the risk of omitting those steps.

aseemsavio avatar Nov 09 '22 13:11 aseemsavio