Important

The Nessus Package is currently a Technology Preview

Groups

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

class GroupsAPI(api: APISession)[source]
add_user(group_id: int, user_id: int) None[source]

Adds a user to the group

Parameters:
  • group_id (int) – The group id

  • user_id (int) – The user id

Example

>>> nessus.groups.add_user(group_id, user_id)
create(name: str) Dict[source]

Creates a new group

Parameters:

name (str) – The name of the new group

Returns:

The new group object

Return type:

Dict

Example

>>> nessus.groups.create('Example Group')
delete(group_id: int) None[source]

Deletes a group

Parameters:

group_id (int) – The id of the group to delete

Example

>>> nessus.groups.delete(group_id)
delete_many(group_ids: List[int]) None[source]

Deletes many groups

Parameters:

group_ids (list[int]) – The list of group ids to delete

Example

>>> nessus.groups.delete_many([group_1, group_2, group_3])
edit(group_id: int, name: str) Dict[source]

Edits the specified group

Parameters:
  • group_id (int) – The group to edit

  • name (str) – The new name for the group

Returns:

The updated group object

Return type:

Dict

Example

>>> nessus.groups.edit(group_id, name='Updated Name')
list() List[Dict][source]

Gets the list of groups

Returns:

List of group objects

Return type:

List

Example

>>> for group in nessus.groups.list():
...     print(group)
list_users(group_id: int) List[Dict][source]

Gets the list of users associated to the specified group

Parameters:

group_id (int) – The group to request members for

Returns:

The list of users associated to the group specified.

Return type:

List

Example

>>> for user in nessus.groups.list_users(group_id):
...     print(user)
remove_user(group_id: int, user_id: int) None[source]

Removes a user from the specified group

Parameters:
  • group_id (int) – The group to modify

  • user_id (int) – The user to remove

Example

>>> nessus.groups.remove_user(group_id, user_id)