From c327b4d4e4126551e3dfe03f751df1986a68b9f4 Mon Sep 17 00:00:00 2001 From: qmadev <190383216+qmadev@users.noreply.github.com> Date: Mon, 15 Sep 2025 00:46:57 +0200 Subject: [PATCH] Add temp suffix for running acquire outputs --- acquire/outputs/dir.py | 4 ++-- acquire/outputs/tar.py | 4 +++- acquire/outputs/zip.py | 4 +++- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/acquire/outputs/dir.py b/acquire/outputs/dir.py index cc708dd6..183fa86e 100644 --- a/acquire/outputs/dir.py +++ b/acquire/outputs/dir.py @@ -14,7 +14,7 @@ class DirectoryOutput(Output): def __init__(self, path: Path, **kwargs): - self.path = path + self.path = path.with_suffix(".running") def write( self, @@ -50,4 +50,4 @@ def write( shutil.copyfileobj(fh, fhout) def close(self) -> None: - pass + self.path.rename(self.path.parent.joinpath(self.path.stem)) diff --git a/acquire/outputs/tar.py b/acquire/outputs/tar.py index 69b72906..71eeee9c 100644 --- a/acquire/outputs/tar.py +++ b/acquire/outputs/tar.py @@ -48,7 +48,7 @@ def __init__( ext += ".enc" self._fh = None - self.path = path.with_suffix(path.suffix + ext) + self.path = path.with_suffix(path.suffix + ext + ".running") if encrypt: self._fh = EncryptedStream(self.path.open("wb"), public_key) @@ -107,3 +107,5 @@ def close(self) -> None: self.tar.close() if self._fh: self._fh.close() + + self.path.rename(self.path.parent.joinpath(self.path.stem)) diff --git a/acquire/outputs/zip.py b/acquire/outputs/zip.py index 4ad16142..2535832a 100644 --- a/acquire/outputs/zip.py +++ b/acquire/outputs/zip.py @@ -43,7 +43,7 @@ def __init__( ext += ".enc" self._fh = None - self.path = path.with_suffix(path.suffix + ext) + self.path = path.with_suffix(path.suffix + ext + ".running") if compress: self.compression = ZIP_COMPRESSION_METHODS.get(compression_method, zipfile.ZIP_DEFLATED) @@ -109,6 +109,8 @@ def close(self) -> None: if self._fh: self._fh.close() + self.path.rename(self.path.parent.joinpath(self.path.stem)) + def _get_external_attr(self, entry: FilesystemEntry) -> int: """Return the appropriate external attributes of the entry."""