Skip to content

Commit

Permalink
Compatibility with cstruct v4
Browse files Browse the repository at this point in the history
  • Loading branch information
pyrco committed May 27, 2024
1 parent 8a3a0b5 commit 8e3a185
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 8 deletions.
9 changes: 3 additions & 6 deletions acquire/crypt.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import io
from datetime import datetime, timezone

from dissect import cstruct
from dissect.cstruct import cstruct

try:
from Crypto.Cipher import AES, PKCS1_OAEP
Expand All @@ -14,9 +14,7 @@
HAS_PYCRYPTODOME = False


c_acquire = cstruct.cstruct()
c_acquire.load(
"""
acquire_def = """
enum HeaderType : uint8 {
PKCS1_OAEP = 0x1,
};
Expand Down Expand Up @@ -49,8 +47,7 @@
uint16 length; // Digest length (precedes footer)
};
"""
)

c_acquire = cstruct().load(acquire_def)

FILE_MAGIC = b"ENCRYPTEDACQUIRE"
FILE_VERSION = 1
Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ classifiers = [
"Topic :: Utilities",
]
dependencies = [
"dissect.cstruct",
"dissect.target",
"dissect.cstruct>3,<5",
"dissect.target>2,<4",
]
dynamic = ["version"]

Expand Down
7 changes: 7 additions & 0 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,13 @@ deps =
pytest
pytest-cov
coverage
# Unfortunately, tox does not allow separate installation flags for the project
# dependencies and the test dependencies. When running tox, we want to install the
# project dependencies with the --pre flag, so that we get the latest version of all
# dependencies. We do the installation step ourselves for this reason.
skip_install = true
commands_pre =
pip install --pre -e .
commands =
pytest --basetemp="{envtmpdir}" {posargs:--color=yes --cov=acquire --cov-report=term-missing -v tests}
coverage report
Expand Down

0 comments on commit 8e3a185

Please sign in to comment.