Target Groups

The following methods allow for interaction into the Tenable Vulnerability Management target_groups API endpoints.

Methods available on tio.target_groups:

class TargetGroupsAPI(api: restfly.session.APISession)[source]
create(name, members, **kw)[source]

Create a target-group.

target-groups: create

Parameters
  • name (str) – The name of the target group

  • members (list) – The members of the target group. FQDNs, CIDRs, IPRanges, and individual IPs are supported.

  • acls (list, optional) – A list of ACLs defining how the asset list can be used. For further information on how the ACL dictionaries should be written, please refer to the API documentation.

Returns

The resource record of the newly created target group.

Return type

dict

Examples

>>> tg = tio.target_groups.create('Example', ['192.168.0.0/24'])
delete(id)[source]

Delete a target group.

target-groups: delete

Parameters

id (int) – The unique identifier for the target group.

Returns

The target group was successfully deleted.

Return type

None

Examples

>>> tio.target_groups.delete(1)
details(id)[source]

Retrieve the details of a target group.

target-groups: details

Parameters

id (int) – The unique identifier for the target group.

Returns

The resource record for the target group.

Return type

dict

Examples

>>> tg = tio.target_groups.details(1)
edit(id, **kw)[source]

Edit an existing target group.

target-groups: edit

Parameters
  • id (int) – The unique identifier for the target group.

  • name (str, optional) – The name of the target group.

  • members (list, optional) – The members of the target group. FQDNs, CIDRs, IPRanges, and individual IPs are supported. NOTE: modifying the member list is atomic and not additive. All previous members that are desired to be kept within the member list much also be included.

  • acls (list, optional) – A list of ACLs defining how the asset list can be used. For further information on how the ACL dictionaries should be written, please refer to the API documentation. NOTE: modifying ACLs is atomic and not additive. Please provide the complete list of ACLs that this asset group will need.

Returns

The modified target group resource record.

Return type

dict

Examples

>>> tio.target_groups.edit(1, name='Updated TG Name')
list()[source]

Retrieve the list of target groups configured.

target-groups: list

Returns

Listing of target group resource records.

Return type

list

Examples

>>> for tg in tio.target_groups.list():
...     pprint(tg)