API

class nessus.API(base_url, username='', password='', login=True, debug=False)

Main API class

Parameters:
  • base_url – IP:PORT or FQDN:PORT of Nessus Server
  • username – user login
  • password – user password
  • login (bool) – disable autologin to Nessus Server
  • debug (bool) – enable DEBUG mode

Example:

>>> from nessus import API
>>> nessus = API('https://127.0.0.1:8834', login=False)
>>> nessus.login('user', 'pass')

Is equivalent of:

>>> nessus = API('https://127.0.0.1:8834', username='user', password='pass')
feed()

Current plugin feed information from the server.

This will return the feed type (HomeFeed vs. ProfessionalFeed), Nessus version and integrated web server version.

Permissions:

  • authenticated: Yes
  • administrator: No
Returns:Feed information.

Example:

>>> from nessus import API
>>> nessus = API('https://127.0.0.1:8834', username='user', password='pass')
>>> print nessus.feed()
get_cert()

Nessus server certificate.

Permissions:

  • authenticated: Yes
  • administrator: No
Returns:Server certificate

Example:

>>> from nessus import API
>>> nessus = API('https://127.0.0.1:8834', username='user', password='pass')
>>> print nessus.get_cert()
login(login, password)

Authenticates a user.

Permissions:

  • authenticated: No
  • administrator: No
Parameters:
  • login – user login
  • password – user password

Example:

>>> from nessus import API
>>> nessus = API('https://127.0.0.1:8834', login=False)
>>> nessus.login('user', 'pass')
logout()

Log out a user.

It invalidates the token and performs some “house-cleaning” tasks such as deleting the temporary files created for that user.

Permissions:

  • authenticated: Yes
  • administrator: No

Example:

>>> from nessus import API
>>> nessus = API('https://127.0.0.1:8834', username='user', password='pass')
>>> nessus.logout()
timezones()

Lists time zones that can be specified in a scheduled scan policy.

Permissions:

  • authenticated: Yes
  • administrator: No
Returns:List of time zones

Example:

>>> from nessus import API
>>> nessus = API('https://127.0.0.1:8834', username='user', password='pass')
>>> print nessus.timezones()
uuid()

Nessus server UUID.

Permissions:

  • authenticated: Yes
  • administrator: No
Returns:Server information

Example:

>>> from nessus import API
>>> nessus = API('https://127.0.0.1:8834', username='user', password='pass')
>>> print nessus.uuid()