Important

The Nessus Package is currently a Technology Preview

Users

Methods described in this section relate to the users API. These methods can be accessed at Nessus.users.

class UsersAPI(api: APISession)[source]
api_keys(user_id: int) Dict[source]

Generates API Keys for the specified user

Parameters:

user_id (int) – The id of the user to generate keys for

Returns:

The new API Keys

Return type:

Dict

Example

>>> nessus.users.api_keys(1)
chpasswd(user_id: int, password: str) None[source]

Change the specified user’s password

Parameters:
  • user_id (int) – The user to update

  • password (str) – The new password

Example

>>> nessus.users.chpasswd(1, 'n3wp@ssw0rd')
create(username: str, password: str, permissions: int, type: Literal['local', 'ldap'] = 'local', name: str | None = None, email: str | None = None) Dict[source]

Creates a new user

Parameters:
  • username (str) – The unique username

  • password (str) – The user’s password

  • permissions (int) – The permission level for the user. Basic users are 16, regular Users are 32, and administrators are 64.

  • type (str, optional) – The type of user account to create. The default is local

  • name (str, optional) – A friendly name for the user

  • email (str, optional) – The user’s email address

Returns:

The created user object

Return type:

Dict

Example

>>> nessus.users.create(username='example',
...                     password='s3cr3tsqu1rr3l',
...                     permissions=32,
...                     name='Example User',
...                     email='example@company.com'
...                     )
delete(user_id: int) None[source]

Deletes the specified user

Parameters:

user_id (int) – The id of the user to delete

Example

>>> nessus.users.delete(1)
delete_many(user_ids: List[int]) None[source]

Deletes many users

Parameters:

user_ids (list[int]) – The list of user ids to delete

Example

>>> nessus.users.delete_many([1, 2, 3])
details(user_id: int) Dict[source]

Retrieves the specified user object

Parameters:

user_id (int) – The id of the user to fetch

Returns:

The user object

Return type:

Dict

Example

>>> nessus.users.details(1)
edit(user_id: int, permissions: int, name: str | None = None, email: str | None = None) Dict[source]

Updates the specified user object

Parameters:
  • user_id (int) – The id of the user to update

  • permissions (int) – The permissions settings for the user

  • name (str, optional) – The user’s friendly name

  • email (str, optional) – The user’s email address

Returns:

The updates user object

Return type:

Dict

Example

>>> nessus.users.edit(1, 32, name='Updated User')
list() List[Dict][source]

Retrieves the list of users configured in the system

Returns:

List of user objects

Return type:

List[Dict]

Example

>>> for user in nessus.users.list():
...     print(user)