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: restfly.session.APISession)[source]
apply(id, repo)[source]

Applies the accept risk rule for either all repositories, or the repository specified.

accept-risk: apply

Parameters
  • id (int) – The identifier for the accept risk rule.

  • repo (int, optional) – A specific repository to apply the rule to. The default if not specified is all repositories (0).

Returns

Empty string response from the API.

Return type

str

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.

accept-risk: create

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, and uuids 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, and uuids 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, and uuids are mutually exclusive.

Returns

The newly created accept risk rule definition.

Return type

dict

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

accept-risk: delete

Parameters

id (int) – The identifier for the accept risk rule.

Returns

Empty string response from the API.

Return type

str

Examples

>>> sc.accept_risks.delete(1)
details(id, fields=None)[source]

Retrieves the details of an accepted risk rule.

accept-risk details

Parameters
  • id (int) – The identifier for the accept risk rule.

  • fields (list, optional) – A list of attributes to return for each accepted risk rule.

Returns

The accept risk rule details.

Return type

dict

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.

accept-risk: list

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

list

Examples

>>> for rule in sc.accept_risks.list():
...     pprint(rule)