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
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 are32
, and administrators are64
.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
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)