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.
- Parameters:
- Returns:
The plugin resource record.
- Return type:
Examples
>>> plugin = sc.plugins.detail(19506) >>> pprint(plugin)
- family_details(plugin_id, fields=None)[source]¶
Returns the details for the specified plugin family.
- Parameters:
- Returns:
The plugin family resource.
- Return type:
Examples
>>> family = sc.plugins.family_details(10) >>> pprint(family)
- family_list(**kwargs)[source]¶
Returns the list of plugin families.
- 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
anddesc
. The default isasc
.type (str, optional) – The type of plugins to return. Available types are
active
,all
,compliance
,custom
,lce
,notPassive
, andpassive
. If nothing is specified, thenall
is assumed.
- Returns:
List of plugin family records.
- Return type:
Examples
>>> for fam in sc.plugins.family_list(): ... pprint(fam)
- family_plugins(plugin_id, **kwargs)[source]¶
Retrieves the plugins for the specified family.
- 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
anddesc
. The default isasc
.type (str, optional) – The type of plugins to return. Available types are
active
,all
,compliance
,custom
,lce
,notPassive
, andpassive
. If nothing is specified, thenall
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.
- 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
anddesc
. The default isasc
.type (str, optional) – The type of plugins to return. Available types are
active
,all
,compliance
,custom
,lce
,notPassive
, andpassive
. If nothing is specified, thenall
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')