Assets

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

Methods available on tio.assets:

class AssetsAPI(api: APISession)[source]

This will contain all methods related to Assets

asset_import(source, *assets)[source]

Imports asset information into Tenable Vulnerability Management from an external source.

assets: import

Imports a list of asset definition dictionaries. Each asset record must contain at least one of the following attributes: fqdn, ipv4, netbios_name, mac_address. Each record may also contain additional properties.

Parameters:
  • *assets (dict) – One or more asset definition dictionaries

  • source (str) – An identifier to be used to upload the assets.

Returns:

The job UUID.

Return type:

str

Examples

import single asset:

>>> tio.assets.asset_import('example_source', {
...     'fqdn': ['example.py.test'],
...     'ipv4': ['192.168.254.1'],
...     'netbios_name': 'example',
...     'mac_address': ['00:00:00:00:00:00']
... })

import multiple asset:

>>> tio.assets.asset_import('multiple_asset_example_source',
...     {
...         'fqdn': ['example_one.py.test'],
...         'ipv4': ['192.168.1.1'],
...         'netbios_name': 'example_one',
...         'mac_address': ['00:00:00:00:00:00']
...     },{
...         'fqdn': ['example_two.py.test'],
...         'ipv4': ['192.168.255.1'],
...         'netbios_name': 'example_two',
...         'mac_address': ['00:00:00:00:00:00']
...     })
assign_tags(action, assets, tags)[source]

Add/remove tags for asset(s).

tags: assign-asset-tags

Parameters:
  • action (str) – Specifies whether to add or remove tags. Valid values: add, remove.

  • assets (List[str]) – An array of asset UUIDs.

  • tags (List[str]) – An array of tag value UUIDs.

Returns:

The job Resource record.

Return type:

dict

Examples

>>> asset = tio.assets.assign_tags(
...     'add', ['00000000-0000-0000-0000-000000000000'],
...     ['00000000-0000-0000-0000-000000000000'])
bulk_delete(*filters, hard_delete=None, filter_type=None)[source]

Deletes the specified assets.

assets: bulk_delete

Parameters:

*filters – A defined filter tuple consisting of the name, operator, and value. Example: ('host.hostname', 'match', 'asset.com').

Returns:

Returns the number of deleted assets.

Return type:

dict

Examples

>>> asset = tio.assets.bulk_delete(
...     ('host.hostname', 'match', 'asset.com'), filter_type='or')
>>> pprint(asset)
delete(uuid)[source]

Deletes the asset.

workbenches: asset-delete

Parameters:

asset_uuid (str) – The unique identifier for the asset.

Return type:

None

Examples

>>> asset_id = '00000000-0000-0000-0000-000000000000'
>>> tio.asset.delete(asset_id)
details(uuid)[source]

Retrieves the details about a specific asset.

assets: asset-info

Parameters:

uuid (str) – The UUID (unique identifier) for the asset.

Returns:

Asset resource definition.

Return type:

dict

Examples

>>> asset = tio.assets.details(
...     '00000000-0000-0000-0000-000000000000')
import_job_details(uuid)[source]

Returns the details about a specific asset import job.

assets: import-job-info

uuid (str):

The UUID (unique identifier) for the job.

Returns:

The job Resource record.

Return type:

dict

Examples

>>> job = tio.assets.import_job_details(
...     '00000000-0000-0000-0000-000000000000')
>>> pprint(job)
list()[source]

Returns a list of assets.

assets: list-assets

Returns:

List of asset records.

Return type:

list

Examples

>>> for asset in tio.assets.list():
...     pprint(asset)
list_import_jobs()[source]

Returns a list of asset import jobs.

assets: list-import-jobs

Returns:

List of job records.

Return type:

list

Examples

>>> for job in tio.assets.list_import_jobs():
...     pprint(job)
move_assets(source, destination, targets)[source]

Moves assets from the specified network to another network.

assets: move-assets

source (str):

The UUID of the network currently associated with the assets.

destination (str):

The UUID of the network to associate with the specified assets.

targets (list):

The IPv4 addresses of the assets to move.

Returns:

Returns the number of moved assets.

Return type:

int

Examples

>>> asset = tio.assets.move_assets('00000000-0000-0000-0000-000000000000',
...         '10000000-0000-0000-0000-000000000001', ["127.0.0.1"])
>>> pprint(asset)
tags(uuid)[source]

Retrieves the details about a specific asset.

tags: asset-tags

Parameters:

uuid (str) – The UUID (unique identifier) for the asset.

Returns:

Asset resource definition.

Return type:

dict

Examples

>>> asset = tio.assets.tags(
...     '00000000-0000-0000-0000-000000000000')
update_acr(assets_uuid_list, reason, value, note='')[source]

Updates ACR for the provided asset UUID’s with reason(s).

Parameters:
  • assets_uuid_list (list) – Asset UUID’s which are being updated.

  • reason (list) – List of reason(s).

  • value (str) – New ACR value for assets, ranging from 1 - 10.

  • note (str) – Additional note if any.

Returns:

Status code for the request.

Return type:

int

Examples

>>> tio.assets.update_acr(
... ['00000000-0000-0000-0000-000000000000', '00000000-0000-0000-0000-000000000001'],
... ['Other'], 1, 'some notes')