dissect.target.tools.utils
¶
Module Contents¶
Functions¶
Generate an argparse.ArgumentParser for a bound Plugin class method |
|
Generate an argparse.ArgumentParser for an unbound Plugin class method |
|
Generate an argparse.ArgumentParser for a Plugin class |
|
Generate an argparse.ArgumentParser for a Plugin instance |
|
Execute function func on provided target target with provided cli_params list. |
|
Retrieves the function attribute from the target. |
|
Resolves which plugin function to execute, and creates the argument parser for said plugin. |
|
Catches KeyboardInterrupt and BrokenPipeError (OSError 22 on Windows). |
|
Converts argument-style |
|
- dissect.target.tools.utils.configure_generic_arguments(args_parser: argparse.ArgumentParser) None ¶
- dissect.target.tools.utils.process_generic_arguments(args: argparse.Namespace) None ¶
- dissect.target.tools.utils.generate_argparse_for_bound_method(method: Callable, usage_tmpl: str | None = None) argparse.ArgumentParser ¶
Generate an argparse.ArgumentParser for a bound Plugin class method
- dissect.target.tools.utils.generate_argparse_for_unbound_method(method: Callable, usage_tmpl: str | None = None) argparse.ArgumentParser ¶
Generate an argparse.ArgumentParser for an unbound Plugin class method
- dissect.target.tools.utils.generate_argparse_for_plugin_class(plugin_cls: Type[dissect.target.plugin.Plugin], usage_tmpl: str | None = None) argparse.ArgumentParser ¶
Generate an argparse.ArgumentParser for a Plugin class
- dissect.target.tools.utils.generate_argparse_for_plugin(plugin_instance: dissect.target.plugin.Plugin, usage_tmpl: str | None = None) argparse.ArgumentParser ¶
Generate an argparse.ArgumentParser for a Plugin instance
- dissect.target.tools.utils.plugin_factory(target: dissect.target.Target, plugin: type | object, funcname: str, namespace: str | None) tuple[dissect.target.plugin.Plugin, str] ¶
- dissect.target.tools.utils.execute_function_on_target(target: dissect.target.Target, func: dissect.target.plugin.PluginFunction, cli_params: List[str] | None = None) Tuple[str, Any, List[str]] ¶
Execute function func on provided target target with provided cli_params list.
- dissect.target.tools.utils.get_target_attribute(target: dissect.target.Target, func: dissect.target.plugin.PluginFunction) dissect.target.plugin.Plugin | Callable ¶
Retrieves the function attribute from the target.
If the function does not exist yet, it will attempt to load it into the target.
- Parameters:
target – The target we wish to run the function on.
func – The function to run on the target.
- Returns:
The function, either plugin or a callable to execute.
- Raises:
UnsupportedPluginError – When the function was incompatible with the target.
- dissect.target.tools.utils.plugin_function_with_argparser(target_attr: dissect.target.plugin.Plugin | Callable) tuple[Iterator | None, argparse.ArgumentParser | None] ¶
Resolves which plugin function to execute, and creates the argument parser for said plugin.
- dissect.target.tools.utils.persist_execution_report(output_dir: pathlib.Path, report_data: Dict, timestamp: datetime.datetime) pathlib.Path ¶
- dissect.target.tools.utils.catch_sigpipe(func: Callable) Callable ¶
Catches KeyboardInterrupt and BrokenPipeError (OSError 22 on Windows).
- dissect.target.tools.utils.args_to_uri(targets: list[str], loader_name: str, rest: list[str]) list[str] ¶
Converts argument-style
-L
to URI-style.- Turns:
target-query /evtxs/* -L log --log-hint="evtx" -f evtx
- into:
target-query "log:///evtxs/*?hint=evtx" -f evtx
For loaders providing
@arg()
arguments.
- dissect.target.tools.utils.find_and_filter_plugins(target: dissect.target.Target, functions: str, excluded_func_paths: set[str] = None) Iterator[dissect.target.plugin.PluginFunction] ¶