Export¶
Methods described in this section relate to the attack path export API for TenableOne.
These methods can be accessed at TenableOne.attack_path.export.
- class ExportAPI(api: APISession)[source]¶
- attack_paths(file_format: FileFormat, sort: ExportSortParams | None = None, filters: ExportFilter | ExportFilterCondition | None = None, vector_ids: List[str] | None = None, columns: List[AttackPathColumnKey] | None = None, file_name: str | None = None) → ExportRequestId[source]¶
Export top attack paths
- Parameters:
file_format (FileFormat) – The output file format (CSV or JSON).
sort (ExportSortParams, optional) – Sort parameters for the export.
filters (ExportFilter | ExportFilterCondition, optional) – Filters to apply to the export. Can be a single filter condition or a compound filter with multiple conditions.
vector_ids (list[str], optional) – List of vector IDs to filter by.
columns (list[AttackPathColumnKey], optional) – Columns to include in the export.
file_name (str, optional) – The name of the export file.
- Returns:
The export request ID.
- Return type:
ExportRequestId
Examples
>>> export = tenable_one.attack_path.export.attack_paths( ... file_format=FileFormat.CSV, ... columns=[AttackPathColumnKey.PATH_NAME, AttackPathColumnKey.PRIORITY], ... ) >>> print(export.export_id)
- attack_techniques(file_format: FileFormat, filters: ExportFilter | ExportFilterCondition | None = None, sort: ExportSortParams | None = None, columns: List[AttackTechniqueColumnKey] | None = None, file_name: str | None = None, attack_technique_ids: List[str] | None = None) → ExportRequestId[source]¶
Export attack techniques
- Parameters:
file_format (FileFormat) – The output file format (CSV or JSON).
filters (ExportFilter | ExportFilterCondition, optional) – Filters to apply to the export. Can be a single filter condition or a compound filter with multiple conditions.
sort (ExportSortParams, optional) – Sort parameters for the export.
columns (list[AttackTechniqueColumnKey], optional) – Columns to include in the export.
file_name (str, optional) – The name of the export file.
attack_technique_ids (list[str], optional) – List of attack technique IDs to filter by.
- Returns:
The export request ID.
- Return type:
ExportRequestId
Examples
>>> export = tenable_one.attack_path.export.attack_techniques( ... file_format=FileFormat.JSON, ... columns=[ ... AttackTechniqueColumnKey.MITRE_ID, ... AttackTechniqueColumnKey.TECHNIQUE_NAME, ... ], ... ) >>> print(export.export_id)
- download(export_id: str, fobj: BytesIO | None = None) → bytes | BytesIO[source]¶
Download export results
- Parameters:
export_id (str) – The export ID to download.
fobj (BytesIO, optional) – A file-like object to write the downloaded data to. If not provided, the data will be returned as bytes. If provided, the data will be streamed directly to the file object and the file object will be returned.
- Returns:
The exported data as bytes if fobj is not provided, or the file object if fobj is provided.
- Return type:
Union[bytes, BytesIO]
Examples
Download to bytes:
>>> data = tenable_one.attack_path.export.download("export-123") >>> with open("export.csv", "wb") as f: ... f.write(data)
Stream to file object:
>>> fobj = BytesIO() >>> tenable_one.attack_path.export.download("export-123", fobj) >>> with open("export.csv", "wb") as f: ... f.write(fobj.getvalue())
- mitre_heatmap(file_format: FileFormat, filter: MitreHeatmapFilter | None = None, columns: List[str] | None = None, file_name: str | None = None) → ExportRequestId[source]¶
Export MITRE ATT&CK heatmap
- Parameters:
file_format (FileFormat) – The output file format. CSV emits a flat technique table; JSON emits a Navigator-compatible layer document.
filter (MitreHeatmapFilter, optional) – Filter criteria for the heatmap (platform, query, severities, matrix, show_all_techniques).
columns (list[str], optional) – Column names to include in the export.
file_name (str, optional) – Custom file name for the export.
- Returns:
The export request ID.
- Return type:
ExportRequestId
Examples
>>> export = tenable_one.attack_path.export.mitre_heatmap( ... file_format=FileFormat.JSON, ... filter=MitreHeatmapFilter(matrix=MitreMatrix.ENTERPRISE), ... ) >>> print(export.export_id)
- status(export_id: str) → ExportRequestStatus[source]¶
Get export status
- Parameters:
export_id (str) – The export ID to check status for.
- Returns:
The export status information.
- Return type:
ExportRequestStatus
Examples
>>> status = tenable_one.attack_path.export.status("export-123") >>> print(f"Status: {status.status}")