dissect.archive 1.5.dev2__tar.gz → 1.6.dev1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {dissect_archive-1.5.dev2 → dissect_archive-1.6.dev1}/.git-blame-ignore-revs +1 -1
- dissect_archive-1.6.dev1/.gitattributes +1 -0
- {dissect_archive-1.5.dev2 → dissect_archive-1.6.dev1}/PKG-INFO +3 -2
- {dissect_archive-1.5.dev2 → dissect_archive-1.6.dev1}/dissect/archive/wim.py +9 -5
- {dissect_archive-1.5.dev2 → dissect_archive-1.6.dev1}/dissect.archive.egg-info/PKG-INFO +3 -2
- {dissect_archive-1.5.dev2 → dissect_archive-1.6.dev1}/dissect.archive.egg-info/SOURCES.txt +11 -4
- dissect_archive-1.6.dev1/tests/_data/basic16k.wim.gz +0 -0
- dissect_archive-1.6.dev1/tests/_data/basic4k.wim.gz +0 -0
- dissect_archive-1.6.dev1/tests/_data/basic8k.wim.gz +0 -0
- dissect_archive-1.6.dev1/tests/_docs/Makefile +24 -0
- dissect_archive-1.6.dev1/tests/_docs/__init__.py +0 -0
- dissect_archive-1.6.dev1/tests/_docs/conf.py +41 -0
- dissect_archive-1.6.dev1/tests/_docs/index.rst +8 -0
- {dissect_archive-1.5.dev2 → dissect_archive-1.6.dev1}/tests/conftest.py +20 -5
- {dissect_archive-1.5.dev2 → dissect_archive-1.6.dev1}/tests/test_wim.py +24 -3
- {dissect_archive-1.5.dev2 → dissect_archive-1.6.dev1}/tox.ini +4 -4
- dissect_archive-1.5.dev2/.gitattributes +0 -1
- {dissect_archive-1.5.dev2 → dissect_archive-1.6.dev1}/COPYRIGHT +0 -0
- {dissect_archive-1.5.dev2 → dissect_archive-1.6.dev1}/LICENSE +0 -0
- {dissect_archive-1.5.dev2 → dissect_archive-1.6.dev1}/MANIFEST.in +0 -0
- {dissect_archive-1.5.dev2 → dissect_archive-1.6.dev1}/README.md +0 -0
- {dissect_archive-1.5.dev2 → dissect_archive-1.6.dev1}/dissect/archive/__init__.py +0 -0
- {dissect_archive-1.5.dev2 → dissect_archive-1.6.dev1}/dissect/archive/c_vbk.py +0 -0
- {dissect_archive-1.5.dev2 → dissect_archive-1.6.dev1}/dissect/archive/c_vma.py +0 -0
- {dissect_archive-1.5.dev2 → dissect_archive-1.6.dev1}/dissect/archive/c_wim.py +0 -0
- {dissect_archive-1.5.dev2 → dissect_archive-1.6.dev1}/dissect/archive/exceptions.py +0 -0
- {dissect_archive-1.5.dev2 → dissect_archive-1.6.dev1}/dissect/archive/tools/__init__.py +0 -0
- {dissect_archive-1.5.dev2 → dissect_archive-1.6.dev1}/dissect/archive/tools/backup.py +0 -0
- {dissect_archive-1.5.dev2 → dissect_archive-1.6.dev1}/dissect/archive/vbk.py +0 -0
- {dissect_archive-1.5.dev2 → dissect_archive-1.6.dev1}/dissect/archive/vma.py +0 -0
- {dissect_archive-1.5.dev2 → dissect_archive-1.6.dev1}/dissect/archive/xva.py +0 -0
- {dissect_archive-1.5.dev2 → dissect_archive-1.6.dev1}/dissect.archive.egg-info/dependency_links.txt +0 -0
- {dissect_archive-1.5.dev2 → dissect_archive-1.6.dev1}/dissect.archive.egg-info/entry_points.txt +0 -0
- {dissect_archive-1.5.dev2 → dissect_archive-1.6.dev1}/dissect.archive.egg-info/requires.txt +0 -0
- {dissect_archive-1.5.dev2 → dissect_archive-1.6.dev1}/dissect.archive.egg-info/top_level.txt +0 -0
- {dissect_archive-1.5.dev2 → dissect_archive-1.6.dev1}/pyproject.toml +0 -0
- {dissect_archive-1.5.dev2 → dissect_archive-1.6.dev1}/setup.cfg +0 -0
- {dissect_archive-1.5.dev2 → dissect_archive-1.6.dev1}/tests/__init__.py +0 -0
- /dissect_archive-1.5.dev2/tests/data/basic.wim.gz → /dissect_archive-1.6.dev1/tests/_data/basic32k.wim.gz +0 -0
- {dissect_archive-1.5.dev2/tests/data → dissect_archive-1.6.dev1/tests/_data}/test.vma.gz +0 -0
- {dissect_archive-1.5.dev2/tests/data → dissect_archive-1.6.dev1/tests/_data}/test13.vbk.gz +0 -0
- {dissect_archive-1.5.dev2/tests/data → dissect_archive-1.6.dev1/tests/_data}/test9.vbk.gz +0 -0
- {dissect_archive-1.5.dev2 → dissect_archive-1.6.dev1}/tests/test_exceptions.py +0 -0
- {dissect_archive-1.5.dev2 → dissect_archive-1.6.dev1}/tests/test_vbk.py +0 -0
- {dissect_archive-1.5.dev2 → dissect_archive-1.6.dev1}/tests/test_vma.py +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
tests/_data/* filter=lfs diff=lfs merge=lfs -text
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: dissect.archive
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.6.dev1
|
|
4
4
|
Summary: A Dissect module implementing parsers for various archive and backup formats
|
|
5
5
|
Author-email: Dissect Team <dissect@fox-it.com>
|
|
6
6
|
License: Affero General Public License v3
|
|
@@ -30,6 +30,7 @@ Provides-Extra: dev
|
|
|
30
30
|
Requires-Dist: dissect.archive[full]; extra == "dev"
|
|
31
31
|
Requires-Dist: dissect.cstruct<5.0.dev,>=4.0.dev; extra == "dev"
|
|
32
32
|
Requires-Dist: dissect.util<4.0.dev,>=3.0.dev; extra == "dev"
|
|
33
|
+
Dynamic: license-file
|
|
33
34
|
|
|
34
35
|
# dissect.archive
|
|
35
36
|
|
|
@@ -151,7 +151,9 @@ class Resource:
|
|
|
151
151
|
decompressor = DECOMPRESSOR_MAP.get(compression_flags)
|
|
152
152
|
if decompressor is None:
|
|
153
153
|
raise NotImplementedError(f"Compression algorithm not yet supported: {compression_flags}")
|
|
154
|
-
return CompressedStream(
|
|
154
|
+
return CompressedStream(
|
|
155
|
+
self.wim.fh, self.offset, self.size, self.original_size, decompressor, self.wim.header.CompressionSize
|
|
156
|
+
)
|
|
155
157
|
|
|
156
158
|
return RelativeStream(self.wim.fh, self.offset, self.size)
|
|
157
159
|
|
|
@@ -434,16 +436,18 @@ class CompressedStream(AlignedStream):
|
|
|
434
436
|
compressed_size: int,
|
|
435
437
|
original_size: int,
|
|
436
438
|
decompressor: Callable[[bytes], bytes],
|
|
439
|
+
chunk_size: int = DEFAULT_CHUNK_SIZE,
|
|
437
440
|
):
|
|
438
441
|
self.fh = fh
|
|
439
442
|
self.offset = offset
|
|
440
443
|
self.compressed_size = compressed_size
|
|
441
444
|
self.original_size = original_size
|
|
442
445
|
self.decompressor = decompressor
|
|
446
|
+
self.chunk_size = chunk_size
|
|
443
447
|
|
|
444
448
|
# Read the chunk table in advance
|
|
445
449
|
fh.seek(self.offset)
|
|
446
|
-
num_chunks = (original_size +
|
|
450
|
+
num_chunks = (original_size + self.chunk_size - 1) // self.chunk_size - 1
|
|
447
451
|
if num_chunks == 0:
|
|
448
452
|
self._chunks = (0,)
|
|
449
453
|
else:
|
|
@@ -460,7 +464,7 @@ class CompressedStream(AlignedStream):
|
|
|
460
464
|
result = []
|
|
461
465
|
|
|
462
466
|
num_chunks = len(self._chunks)
|
|
463
|
-
chunk, offset_in_chunk = divmod(offset,
|
|
467
|
+
chunk, offset_in_chunk = divmod(offset, self.chunk_size)
|
|
464
468
|
|
|
465
469
|
while length:
|
|
466
470
|
if chunk >= num_chunks:
|
|
@@ -470,10 +474,10 @@ class CompressedStream(AlignedStream):
|
|
|
470
474
|
chunk_offset = self._chunks[chunk]
|
|
471
475
|
if chunk < num_chunks - 1:
|
|
472
476
|
next_chunk_offset = self._chunks[chunk + 1]
|
|
473
|
-
chunk_remaining =
|
|
477
|
+
chunk_remaining = self.chunk_size - offset_in_chunk
|
|
474
478
|
else:
|
|
475
479
|
next_chunk_offset = self.compressed_size
|
|
476
|
-
chunk_remaining = (self.original_size - (chunk *
|
|
480
|
+
chunk_remaining = (self.original_size - (chunk * self.chunk_size)) - offset_in_chunk
|
|
477
481
|
|
|
478
482
|
read_length = min(chunk_remaining, length)
|
|
479
483
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: dissect.archive
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.6.dev1
|
|
4
4
|
Summary: A Dissect module implementing parsers for various archive and backup formats
|
|
5
5
|
Author-email: Dissect Team <dissect@fox-it.com>
|
|
6
6
|
License: Affero General Public License v3
|
|
@@ -30,6 +30,7 @@ Provides-Extra: dev
|
|
|
30
30
|
Requires-Dist: dissect.archive[full]; extra == "dev"
|
|
31
31
|
Requires-Dist: dissect.cstruct<5.0.dev,>=4.0.dev; extra == "dev"
|
|
32
32
|
Requires-Dist: dissect.util<4.0.dev,>=3.0.dev; extra == "dev"
|
|
33
|
+
Dynamic: license-file
|
|
33
34
|
|
|
34
35
|
# dissect.archive
|
|
35
36
|
|
|
@@ -29,7 +29,14 @@ tests/test_exceptions.py
|
|
|
29
29
|
tests/test_vbk.py
|
|
30
30
|
tests/test_vma.py
|
|
31
31
|
tests/test_wim.py
|
|
32
|
-
tests/
|
|
33
|
-
tests/
|
|
34
|
-
tests/
|
|
35
|
-
tests/
|
|
32
|
+
tests/_data/basic16k.wim.gz
|
|
33
|
+
tests/_data/basic32k.wim.gz
|
|
34
|
+
tests/_data/basic4k.wim.gz
|
|
35
|
+
tests/_data/basic8k.wim.gz
|
|
36
|
+
tests/_data/test.vma.gz
|
|
37
|
+
tests/_data/test13.vbk.gz
|
|
38
|
+
tests/_data/test9.vbk.gz
|
|
39
|
+
tests/_docs/Makefile
|
|
40
|
+
tests/_docs/__init__.py
|
|
41
|
+
tests/_docs/conf.py
|
|
42
|
+
tests/_docs/index.rst
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# Minimal makefile for Sphinx documentation
|
|
2
|
+
#
|
|
3
|
+
|
|
4
|
+
# You can set these variables from the command line, and also
|
|
5
|
+
# from the environment for the first two.
|
|
6
|
+
SPHINXOPTS ?= -jauto -w $(BUILDDIR)/warnings.log --fail-on-warning
|
|
7
|
+
SPHINXBUILD ?= sphinx-build
|
|
8
|
+
SOURCEDIR = .
|
|
9
|
+
BUILDDIR = build
|
|
10
|
+
|
|
11
|
+
# Put it first so that "make" without argument is like "make help".
|
|
12
|
+
help:
|
|
13
|
+
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
|
|
14
|
+
|
|
15
|
+
.PHONY: clean help Makefile
|
|
16
|
+
|
|
17
|
+
clean: Makefile
|
|
18
|
+
rm -rf api
|
|
19
|
+
@$(SPHINXBUILD) -M clean "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
|
|
20
|
+
|
|
21
|
+
# Catch-all target: route all unknown targets to Sphinx using the new
|
|
22
|
+
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
|
|
23
|
+
%: Makefile
|
|
24
|
+
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
|
|
File without changes
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
project = "dissect.archive"
|
|
2
|
+
|
|
3
|
+
extensions = [
|
|
4
|
+
"autoapi.extension",
|
|
5
|
+
"sphinx.ext.autodoc",
|
|
6
|
+
"sphinx.ext.autosectionlabel",
|
|
7
|
+
"sphinx.ext.doctest",
|
|
8
|
+
"sphinx.ext.napoleon",
|
|
9
|
+
"sphinx_argparse_cli",
|
|
10
|
+
]
|
|
11
|
+
|
|
12
|
+
exclude_patterns = []
|
|
13
|
+
|
|
14
|
+
html_theme = "furo"
|
|
15
|
+
|
|
16
|
+
autoapi_type = "python"
|
|
17
|
+
autoapi_dirs = ["../../dissect/"]
|
|
18
|
+
autoapi_ignore = ["*tests*", "*.tox*", "*venv*", "*examples*"]
|
|
19
|
+
autoapi_python_use_implicit_namespaces = True
|
|
20
|
+
autoapi_add_toctree_entry = False
|
|
21
|
+
autoapi_root = "api"
|
|
22
|
+
autoapi_options = [
|
|
23
|
+
"members",
|
|
24
|
+
"undoc-members",
|
|
25
|
+
"show-inheritance",
|
|
26
|
+
"show-module-summary",
|
|
27
|
+
"special-members",
|
|
28
|
+
"imported-members",
|
|
29
|
+
]
|
|
30
|
+
autoapi_keep_files = True
|
|
31
|
+
autoapi_template_dir = "_templates/autoapi"
|
|
32
|
+
|
|
33
|
+
autodoc_typehints = "signature"
|
|
34
|
+
autodoc_member_order = "groupwise"
|
|
35
|
+
|
|
36
|
+
autosectionlabel_prefix_document = True
|
|
37
|
+
|
|
38
|
+
suppress_warnings = [
|
|
39
|
+
# https://github.com/readthedocs/sphinx-autoapi/issues/285
|
|
40
|
+
"autoapi.python_import_resolution",
|
|
41
|
+
]
|
|
@@ -25,20 +25,35 @@ def open_file_gz(name: str, mode: str = "rb") -> Iterator[BinaryIO]:
|
|
|
25
25
|
|
|
26
26
|
|
|
27
27
|
@pytest.fixture
|
|
28
|
-
def
|
|
29
|
-
yield from open_file_gz("
|
|
28
|
+
def basic_wim_4k() -> Iterator[BinaryIO]:
|
|
29
|
+
yield from open_file_gz("_data/basic4k.wim.gz")
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
@pytest.fixture
|
|
33
|
+
def basic_wim_8k() -> Iterator[BinaryIO]:
|
|
34
|
+
yield from open_file_gz("_data/basic8k.wim.gz")
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
@pytest.fixture
|
|
38
|
+
def basic_wim_16k() -> Iterator[BinaryIO]:
|
|
39
|
+
yield from open_file_gz("_data/basic16k.wim.gz")
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
@pytest.fixture
|
|
43
|
+
def basic_wim_32k() -> Iterator[BinaryIO]:
|
|
44
|
+
yield from open_file_gz("_data/basic32k.wim.gz")
|
|
30
45
|
|
|
31
46
|
|
|
32
47
|
@pytest.fixture
|
|
33
48
|
def basic_vma() -> Iterator[BinaryIO]:
|
|
34
|
-
yield from open_file_gz("
|
|
49
|
+
yield from open_file_gz("_data/test.vma.gz")
|
|
35
50
|
|
|
36
51
|
|
|
37
52
|
@pytest.fixture
|
|
38
53
|
def vbk9() -> Iterator[BinaryIO]:
|
|
39
|
-
yield from open_file_gz("
|
|
54
|
+
yield from open_file_gz("_data/test9.vbk.gz")
|
|
40
55
|
|
|
41
56
|
|
|
42
57
|
@pytest.fixture
|
|
43
58
|
def vbk13() -> Iterator[BinaryIO]:
|
|
44
|
-
yield from open_file_gz("
|
|
59
|
+
yield from open_file_gz("_data/test13.vbk.gz")
|
|
@@ -3,11 +3,32 @@ from __future__ import annotations
|
|
|
3
3
|
import hashlib
|
|
4
4
|
from typing import BinaryIO
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
import pytest
|
|
7
|
+
from dissect.util.compression.lzxpress_huffman import decompress
|
|
7
8
|
|
|
9
|
+
from dissect.archive.wim import WIM, CompressedStream
|
|
8
10
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
+
|
|
12
|
+
@pytest.mark.parametrize(
|
|
13
|
+
("fixture", "chunk_size"),
|
|
14
|
+
[
|
|
15
|
+
("basic_wim_4k", 0x1000),
|
|
16
|
+
("basic_wim_8k", 0x2000),
|
|
17
|
+
("basic_wim_16k", 0x4000),
|
|
18
|
+
("basic_wim_32k", 0x8000),
|
|
19
|
+
],
|
|
20
|
+
)
|
|
21
|
+
def test_wim(fixture: BinaryIO, chunk_size: int, request: pytest.FixtureRequest) -> None:
|
|
22
|
+
value = request.getfixturevalue(fixture)
|
|
23
|
+
wim = WIM(value)
|
|
24
|
+
assert wim.header.CompressionSize == chunk_size
|
|
25
|
+
|
|
26
|
+
resource = next(iter(wim.resources.values()))
|
|
27
|
+
assert resource.open().chunk_size == chunk_size
|
|
28
|
+
|
|
29
|
+
stream = CompressedStream(wim.fh, resource.offset, resource.size, resource.original_size, decompress, chunk_size)
|
|
30
|
+
assert resource.wim.header.CompressionSize == stream.chunk_size
|
|
31
|
+
assert resource.open().read() == stream.read()
|
|
11
32
|
|
|
12
33
|
images = list(wim.images())
|
|
13
34
|
assert len(images) == 1
|
|
@@ -62,12 +62,12 @@ deps =
|
|
|
62
62
|
sphinx-design
|
|
63
63
|
furo
|
|
64
64
|
commands =
|
|
65
|
-
make -C tests/
|
|
66
|
-
make -C tests/
|
|
65
|
+
make -C tests/_docs clean
|
|
66
|
+
make -C tests/_docs html
|
|
67
67
|
|
|
68
68
|
[testenv:docs-linkcheck]
|
|
69
69
|
allowlist_externals = make
|
|
70
70
|
deps = {[testenv:docs-build]deps}
|
|
71
71
|
commands =
|
|
72
|
-
make -C tests/
|
|
73
|
-
make -C tests/
|
|
72
|
+
make -C tests/_docs clean
|
|
73
|
+
make -C tests/_docs linkcheck
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
tests/data/* filter=lfs diff=lfs merge=lfs -text
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{dissect_archive-1.5.dev2 → dissect_archive-1.6.dev1}/dissect.archive.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
{dissect_archive-1.5.dev2 → dissect_archive-1.6.dev1}/dissect.archive.egg-info/entry_points.txt
RENAMED
|
File without changes
|
|
File without changes
|
{dissect_archive-1.5.dev2 → dissect_archive-1.6.dev1}/dissect.archive.egg-info/top_level.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|