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: 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.
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: str | None = None, sort_order: Literal['asc', 'desc'] | None = None, search_type: Literal['and', 'or'] | None = None, filters: Dict | Tuple | None = None, return_json: bool = False) → PaginationIterator | List[Dict][source]¶
Returns a list of agents.
- Parameters:
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)