Plugins

The following methods allow for interaction with the Tenable Security Center Plugins API. These items are typically seen under the Plugins section of Tenable Security Center.

Methods available on sc.plugins:

class PluginAPI(api: APISession)[source]
details(plugin_id, fields=None)[source]

Returns the details for a specific plugin.

plugins: details

Parameters:
  • plugin_id (int) – The identifier for the plugin.

  • fields (list, optional) – A list of attributes to return.

Returns:

The plugin resource record.

Return type:

dict

Examples

>>> plugin = sc.plugins.detail(19506)
>>> pprint(plugin)
family_details(plugin_id, fields=None)[source]

Returns the details for the specified plugin family.

plugin-family: details

Parameters:
  • plugin_id (int) – The plugin family numeric identifier.

  • fields (list, optional) – A list of attributes to return.

Returns:

The plugin family resource.

Return type:

dict

Examples

>>> family = sc.plugins.family_details(10)
>>> pprint(family)
family_list(**kwargs)[source]

Returns the list of plugin families.

plugin-families: list

Parameters:
  • fields (list, optional) – A list of attributes to return.

  • filter (tuple, optional) – A filter tuple for which to filter the plugins. Filter tuples must be ('name', 'operator', 'value') and follow a similar yet different format to the analysis filters.

  • sort_field (str, optional) – The field to sort the results on.

  • sort_direction (str, optional) – The direction in which to sort the results. Valid settings are asc and desc. The default is asc.

  • type (str, optional) – The type of plugins to return. Available types are active, all, compliance, custom, lce, notPassive, and passive. If nothing is specified, then all is assumed.

Returns:

List of plugin family records.

Return type:

list

Examples

>>> for fam in sc.plugins.family_list():
...     pprint(fam)
family_plugins(plugin_id, **kwargs)[source]

Retrieves the plugins for the specified family.

plugin-family: plugins

Parameters:
  • plugin_id (int) – The numeric identifier for the plugin family.

  • fields (list, optional) – A list of attributes to return.

  • filter (tuple, optional) – A filter tuple for which to filter the plugins. Filter tuples must be ('name', 'operator', 'value') and follow a similar yet different format to the analysis filters.

  • limit (int, optional) – How many records should be returned in each page of data. If none is specified, the default is 1000 records.

  • offset (int, optional) – At what offset within the data should we start returning data. If none is specified, the default is 0.

  • pages (int, optional) – How many pages of data should we return. If none is specified then all pages will return.

  • sort_field (str, optional) – The field to sort the results on.

  • sort_direction (str, optional) – The direction in which to sort the results. Valid settings are asc and desc. The default is asc.

  • type (str, optional) – The type of plugins to return. Available types are active, all, compliance, custom, lce, notPassive, and passive. If nothing is specified, then all is assumed.

Returns:

an iterator object handling data pagination.

Return type:

PluginResultsIterator

Examples

>>> plugins = sc.plugins.family_plugins(10)
>>> for plugin in plugins:
...     pprint(plugin)
list(**kwargs)[source]

Retrieves the list of plugins.

plugins: list

Parameters:
  • fields (list, optional) – A list of attributes to return.

  • filter (tuple, optional) – A filter tuple for which to filter the plugins. Filter tuples must be ('name', 'operator', 'value') and follow a similar yet different format to the analysis filters.

  • filters (list[tuple], optional) – A list of filter tuples. Filters are treated as a logical OR.

  • limit (int, optional) – How many records should be returned in each page of data. If none is specified, the default is 1000 records.

  • offset (int, optional) – At what offset within the data should we start returning data. If none is specified, the default is 0.

  • pages (int, optional) – How many pages of data should we return. If none is specified then all pages will return.

  • sort_field (str, optional) – The field to sort the results on.

  • sort_direction (str, optional) – The direction in which to sort the results. Valid settings are asc and desc. The default is asc.

  • type (str, optional) – The type of plugins to return. Available types are active, all, compliance, custom, lce, notPassive, and passive. If nothing is specified, then all is assumed.

Returns:

an iterator object handling data pagination.

Return type:

PluginResultsIterator

Examples

To retrieve all of the plugins, you’ll simply need to call the list method like so:

>>> plugins = sc.plugins.list()
>>> for plugin in plugins:
...     pprint(plugin)

If you only want the plugins with java in the name, you’d run a query similar to this one:

>>> plugins = sc.plugins.list(
...     filter=('name', 'like', 'java'))

For just the active plugins, we’d run:

>>> plugins = sc.plugins.list(type='active')