acquire.acquire.collector
¶
Module Contents¶
Classes¶
Sortable and serializible string-based enum |
|
Sortable and serializible string-based enum |
|
Functions¶
Create a table-view report summary with success/failure/missing/empty counters per module |
|
Create a full list of successful / failed / missing / empty artifacts collected, |
Attributes¶
- acquire.acquire.collector.log¶
- class acquire.acquire.collector.Outcome¶
Bases:
acquire.utils.StrEnum
Sortable and serializible string-based enum
- SUCCESS = 'success'¶
- FAILURE = 'failure'¶
- MISSING = 'missing'¶
- EMPTY = 'empty'¶
- class acquire.acquire.collector.ArtifactType¶
Bases:
acquire.utils.StrEnum
Sortable and serializible string-based enum
- FILE = 'file'¶
- SYMLINK = 'symlink'¶
- GLOB = 'glob'¶
- DIR = 'dir'¶
- COMMAND = 'command'¶
- PATH = 'path'¶
- class acquire.acquire.collector.Record¶
- module_name: str¶
- artifact_type: ArtifactType¶
- artifact_value: str¶
- details: str | None = None¶
- class acquire.acquire.collector.CollectionReport¶
- target: dissect.target.Target¶
- seen_paths: set[str]¶
- add_file_collected(module: str, path: dissect.target.helpers.fsutil.TargetPath) None ¶
- add_symlink_collected(module: str, path: dissect.target.helpers.fsutil.TargetPath) None ¶
- add_symlink_failed(module: str, path: dissect.target.helpers.fsutil.TargetPath) None ¶
- add_file_failed(module: str, failed_path: dissect.target.helpers.fsutil.TargetPath) None ¶
- add_file_missing(module: str, missing_path: dissect.target.helpers.fsutil.TargetPath) None ¶
- add_glob_failed(module: str, failed_pattern: str) None ¶
- add_glob_empty(module: str, pattern: str) None ¶
- add_dir_collected(module: str, path: dissect.target.helpers.fsutil.TargetPath) None ¶
- add_dir_failed(module: str, failed_path: dissect.target.helpers.fsutil.TargetPath) None ¶
- add_dir_missing(module: str, missing_path: dissect.target.helpers.fsutil.TargetPath) None ¶
- add_path_collected(module: str, path: dissect.target.helpers.fsutil.TargetPath) None ¶
- add_path_failed(module: str, failed_path: dissect.target.helpers.fsutil.TargetPath) None ¶
- add_path_missing(module: str, missing_path: dissect.target.helpers.fsutil.TargetPath) None ¶
- add_command_collected(module: str, command_parts: collections.abc.Sequence[str]) None ¶
- add_command_failed(module: str, command_parts: collections.abc.Sequence[str]) None ¶
- get_records_per_module_per_outcome(serialize_records: bool = False) dict[str, dict[str, list[Record]]] ¶
- get_counts_per_module_per_outcome() dict[str, dict[str, int]] ¶
- was_path_seen(path: str | dissect.target.helpers.fsutil.TargetPath) bool ¶
- class acquire.acquire.collector.Collector(target: dissect.target.Target, output: acquire.outputs.base.Output, base: str = 'fs', skip_list: set | None = None)¶
- METADATA_BASE = '$metadata$'¶
- COMMAND_OUTPUT_BASE = '$metadata$/command-output'¶
- target¶
- output¶
- base = 'fs'¶
- skip_list¶
- report¶
- bound_module_name = None¶
- filter¶
- __exit__(*args, **kwargs) None ¶
- bind(module: type) None ¶
- unbind() None ¶
- close() None ¶
- collect(spec: collections.abc.Iterator, module_name: str | None = None, follow: bool = True, volatile: bool = False) None ¶
- collect_path(path: str | dissect.target.helpers.fsutil.TargetPath, outpath: str | None = None, module_name: str | None = None, base: str | None = None, volatile: bool = False, seen_paths: set[dissect.target.helpers.fsutil.TargetPath] | None = None) None ¶
Collect a path from the target’s root filesystem, including any intermediary symlinks.
- Parameters:
path – The path to collect (this may be a file, directory or symlink).
outpath – A posix style explicit path where to store the collected path. In case
path
is a directory this will be the new base directory. It is concatenated withbase
to get the final output path. Windows device path and sysvol parts are normalized. When set, intermediate symlinks ofpath
are not collected. When not set, it will be constructed from the givenpath
.module_name – When set it indicates the module doing the collection, used for logging and reporting. When not set the :class:
Collector
’sbound_module
will be used.base – A different base path to use to store the file, it is prepended to the given or generated
outpath
.volatile – When this flag is set, the collection of a number of artefacts is performed slightly different. Symlinks at the end of a path will not be collected, empty directories will be collected, files will be collected in a slower but more robust way, any errors while reading the bytes will not fail the collection of the file and all bytes already retrieved will be stored.
seen_paths – A list of normalized path strings, used when calling this function recursively to collect directories to break out of symlink loops.
- collect_file_raw(path: str | dissect.target.helpers.fsutil.TargetPath, fs: dissect.target.filesystem.Filesystem, mountpoint: str, outpath: str | None = None, module_name: str | None = None, base: str | None = None, file_accessor: Callable[[BinaryIO, int], BinaryIO] | None = None) None ¶
Collect a single file from one of the target’s filesystems.
- Parameters:
path – The path to the file to collect. This path will be fully resolved before collecting and construction of the output path.
fs – The filesystem to collect the path from.
mountpoint – The (possibly fake) mountpoint of the given filesystem, to make the path unique within the target. If
outpath
is not supplied it will be concatenated withpath
andbase
to construct theoutpath
.outpath – A posix style explicit path where to store the collected file. It is concatenated with
base
to get the final output path. Windows device path and sysvol parts are normalized. When not set, it will be constructed from the givenpath
.module_name – When set it indicates the module doing the collection, used for logging and reporting. When not set the
Collector
’sbound_module
will be used.base – A different base path to use to store the file, it is prepended to the given or generated
outpath
.file_accessor
- collect_glob(pattern: str, module_name: str | None = None) None ¶
- collect_command_output(command_parts: list[str], output_filename: str, module_name: str | None = None) None ¶
- acquire.acquire.collector.get_report_summary(report: CollectionReport) str ¶
Create a table-view report summary with success/failure/missing/empty counters per module
- acquire.acquire.collector.get_full_formatted_report(report: CollectionReport, record_indent: int = 4) str ¶
Create a full list of successful / failed / missing / empty artifacts collected, broken down by module.