Accept Risks¶
The following methods allow for interaction into the Tenable Security Center Accept Risk API.
Methods available on sc.accept_risks
:
- class AcceptRiskAPI(api: APISession)[source]¶
- apply(id, repo)[source]¶
Applies the accept risk rule for either all repositories, or the repository specified.
- Parameters:
- Returns:
Empty string response from the API.
- Return type:
Examples
>>> sc.accept_risks.apply(1)
- create(plugin_id, repos, **kw)[source]¶
Creates a new accept risk rule. Either ips, uuids, or asset_list must be specified.
- Parameters:
plugin_id (int) – The plugin to apply the accept risk rule to.
repos (list) – The list of repositories to apply this accept risk rule to.
asset_list (int, optional) – The asset list id to apply the accept risk rule to. Please note that
asset_list
,ips
, anduuids
are mutually exclusive.comments (str, optional) – The comment associated to the accept risk rule.
expires (int, optional) – Timestamp. When should the rule expire? if no expiration is set, the rule will never expire. If not mentioned, value is -1 (-1 represents December 31st 1969 23:59:59 hours GMT)
ips (list, optional) – A list of IPs to apply the accept risk rule to. Please note that
asset_list
,ips
, anduuids
are mutually exclusive.port (int, optional) – The port to restrict this accept risk rule to. The default is unrestricted.
protocol (int, optional) – The protocol to restrict the accept risk rule to. The default is unrestricted.
uuids (list, optional) – The agent uuids to apply the accept risk rule to. Please note that
asset_list
,ips
, anduuids
are mutually exclusive.host_uuids (list[str], optional) – The hostUUIDs to apply the accept risk rule to. Please note that
asset_list
,ips
,uuids
, andhost_uuids
are mutually exclusive.
- Returns:
The newly created accept risk rule definition.
- Return type:
Examples
Create a rule to accept 97737 on 2 IPs till Aug 25th 2021 00:00 Hrs GMT.
>>> rule = sc.accept_risks.create(97737, [1], ... ips=['192.168.0.101', '192.168.0.102'], expires=1629849600)
Create a rule to accept 97737 on all IPs on repository 1:
>>> rule = sc.accept_risks.create(97737, [1])
- delete(id)[source]¶
Removes the accepted risk rule from Tenable Security Center
- Parameters:
id (int) – The identifier for the accept risk rule.
- Returns:
Empty string response from the API.
- Return type:
Examples
>>> sc.accept_risks.delete(1)
- details(id, fields=None)[source]¶
Retrieves the details of an accepted risk rule.
- Parameters:
- Returns:
The accept risk rule details.
- Return type:
Examples
>>> rule = sc.accept_risks.details(1) >>> pprint(rule)
- list(repo_ids=None, plugin_id=None, port=None, org_ids=None, fields=None)[source]¶
Retrieves the list of accepted risk rules.
- Parameters:
fields (list, optional) – A list of attributes to return for each accepted risk rule.
plugin_id (int, optional) – Plugin id to filter the response on.
port (int, optional) – Port number to filter the response on.
org_ids (list, optional) – List of organization ids to filter on.
repo_ids (list, optional) – List of repository ids to filter the response on.
- Returns:
A list of accepted risk rules.
- Return type:
Examples
>>> for rule in sc.accept_risks.list(): ... pprint(rule)