Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make acquire compression configurable #185

Merged
merged 6 commits into from
Jul 19, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion acquire/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,12 @@

from dissect.target import Target

from acquire.outputs import COMPRESSION_METHODS, OUTPUTS
from acquire.outputs import (
COMPRESSION_METHODS,
OUTPUTS,
TAR_COMPRESSION_METHODS,
ZIP_COMPRESSION_METHODS,
)
from acquire.uploaders.plugin_registry import UploaderRegistry


Expand Down Expand Up @@ -323,6 +328,11 @@ def check_and_set_acquire_args(
if not args.children and args.skip_parent:
raise ValueError("--skip-parent can only be set with --children")

if args.output_type == "zip" and args.compress_method not in ZIP_COMPRESSION_METHODS:
raise ValueError(f"Invalid compression method for zip: {ZIP_COMPRESSION_METHODS.keys()}")
pyrco marked this conversation as resolved.
Show resolved Hide resolved
if args.output_type == "tar" and args.compress_method not in TAR_COMPRESSION_METHODS:
raise ValueError(f"Invalid compression method for tar: {TAR_COMPRESSION_METHODS.keys()}")
pyrco marked this conversation as resolved.
Show resolved Hide resolved


def get_user_name() -> str:
try:
Expand Down
9 changes: 5 additions & 4 deletions tests/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -491,10 +491,11 @@ def test_utils_normalize_path(
if os == "windows":
case_sensitive = False

with patch.object(mock_target, "os", new=os), patch.object(
mock_target.fs, "_case_sensitive", new=case_sensitive
), patch.object(mock_target.fs, "_alt_separator", new=("\\" if os == "windows" else "/")), patch.dict(
mock_target.props, {"sysvol_drive": sysvol}
with (
patch.object(mock_target, "os", new=os),
patch.object(mock_target.fs, "_case_sensitive", new=case_sensitive),
patch.object(mock_target.fs, "_alt_separator", new=("\\" if os == "windows" else "/")),
patch.dict(mock_target.props, {"sysvol_drive": sysvol}),
):
if as_path:
path = TargetPath(mock_target.fs, path)
Expand Down
Loading