Important

The Nessus Package is currently a Technology Preview

Agents

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

class AgentsAPI(api: restfly.session.APISession)[source]
delete(agent_id: int) None[source]

Deletes an agent

Parameters

agent_id (int) – Id of the agent to delete

Example

>>> nessus.agents.delete(agent_id)
delete_many(agent_ids: List[int]) None[source]

Deletes multiple agents.

Parameters

agent_ids (list[int]) – List of agent ids to delete

Example

>>> nessus.agents.delete_many([agent1, agent2, agent3])
details(agent_id: int) Dict[source]

Returns the details for an agent.

Parameters

agent_id (int) – Id of the agent to retreive

Example

>>> agent = nessus.agents.details(agent_id)
list(limit: int = 1000, offset: int = 0, sort_by: typing.Optional[str] = None, sort_order: typing.Optional[typing_extensions.Literal[asc, desc]] = None, search_type: typing.Optional[typing_extensions.Literal[and, or]] = None, filters: typing.Optional[typing.Union[typing.Dict, typing.Tuple]] = None, return_json: bool = False) Union[tenable.nessus.iterators.pagination.PaginationIterator, List[Dict]][source]

Returns a list of agents.

Parameters
  • filters (list[tuple], optional) – List of filters.

  • sort_by (str, optional) – Field to sort by

  • sort_order (str, optional) – Is the sort ascending (asc) or descending (desc)?

  • limit (int, optional) – Number of records per page

  • offset (int, optional) – How many records to skip before starting to return data

  • return_json (bool, optional) – Should a JSON object be returned instead of an iterator?

Example

>>> for agent in nessus.agents.list():
...     print(agent)

Example with filtering:

>>> for agent in nessus.agents.list(
...     filters=[('name', 'match', 'lin')]
... ):
...     print(agent)

Example getting the JSON response instead:

>>> agents = nessus.agents.list(return_json=True)

Unlinks an agent.

Parameters

agent_id (int) – Id of the agent to unlink

Example

>>> nessus.agents.unlink(agent_id)

Unlinks multiple agents.

Parameters

agent_ids (list[int]) – List of agent ids to unlink

Example

>>> nessus.agents.unlink_many([agent1, agent2, agent3])