Data Export Helper¶
The methods exposed within the export module are designed to mimick the same structure that Tenable Vulnerability Management uses for exporting data. These methods ultimately translate to GraphQL queries and then are fed to the Tenable OT API.
- class ExportsAPI(api: restfly.session.APISession)[source]¶
- assets(filters: Optional[List[Dict]] = None, sort: Optional[List[Dict]] = None, search: Optional[str] = None, start_at: Optional[str] = None, limit: int = 200, filter_type: str = 'And', return_json: bool = False) → Union[tenable.ot.exports.iterator.OTExportsIterator, Dict][source]¶
Assets Export
- Parameters
limit (int, optional) – The number of objects to be returned per page.
sort (list[dict], optional) – A list of sort parameters to be passed to sort the responses.
search (str, optional) – Search string
start_at (str, optional) – Start returning data after this object id.
filters (list[dict], optional) – List of filters to apply to restict the response to only the desired items.
filter_type (str, optional) – When passing multiple filters, how should the filters be applied to the dataset? Acceptable values are And and Or.
return_json (bool, optional) – If True, then the instead of an iterator, the json response will be returned instead.
- Returns
By default the method will return an iterator that will handle pagination and return a single item at a time. If return_json is set to True however, then the JSON response will be returned instead for that page.
- Return type
Union[OTExportsIterator, dict]
Example
>>> for asset in tot.exports.assets(): ... print(asset)
- findings(filters: Optional[List[Dict]] = None, sort: Optional[List[Dict]] = None, search: Optional[str] = None, start_at: Optional[str] = None, limit: int = 200, filter_type: str = 'And', return_json: bool = False) → Union[tenable.ot.exports.iterator.OTExportsIterator, Dict][source]¶
Findings Export
- Parameters
sorted (list[dict], optional) – A list of asset sort parameters to be passed to sort the responses.
search (str, optional) – Asset Search string
filters (list[dict], optional) – List of asset filters to apply to restict the response to only the desired assets.
filter_type (str, optional) – When passing multiple filters, how should the filters be applied to the dataset? Acceptable values are And and Or.
- Returns
The Iterable that hadles the more complex logic of gathering the findings for each asset and presenting them to the caller.
- Return type
OTFindingsIterator
Example
>>> for finding in tot.exports.findings(): ... print(finding)
- plugins(filters: Optional[List[Dict]] = None, sort: Optional[List[Dict]] = None, search: Optional[str] = None, start_at: Optional[str] = None, limit: int = 200, filter_type: str = 'And', return_json: bool = False) → Union[tenable.ot.exports.iterator.OTExportsIterator, Dict][source]¶
Plugin Export
- Parameters
limit (int, optional) – The number of objects to be returned per page.
sort (list[dict], optional) – A list of sort parameters to be passed to sort the responses.
search (str, optional) – Search string
start_at (str, optional) – Start returning data after this object id.
filters (list[dict], optional) – List of filters to apply to restict the response to only the desired items.
filter_type (str, optional) – When passing multiple filters, how should the filters be applied to the dataset? Acceptable values are And and Or.
return_json (bool, optional) – If True, then the instead of an iterator, the json response will be returned instead.
- Returns
By default the method will return an iterator that will handle pagination and return a single item at a time. If return_json is set to True however, then the JSON response will be returned instead for that page.
- Return type
Union[OTExportsIterator, dict]
Example
>>> for plugin in tot.exports.plugins(): ... print(plugin)