dissect.squashfs 1.9.dev2__tar.gz → 1.10.dev2__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.
Files changed (34) hide show
  1. dissect_squashfs-1.10.dev2/.gitattributes +1 -0
  2. {dissect_squashfs-1.9.dev2 → dissect_squashfs-1.10.dev2}/PKG-INFO +7 -17
  3. {dissect_squashfs-1.9.dev2 → dissect_squashfs-1.10.dev2}/README.md +4 -11
  4. {dissect_squashfs-1.9.dev2 → dissect_squashfs-1.10.dev2}/dissect/squashfs/c_squashfs.py +2 -1
  5. {dissect_squashfs-1.9.dev2 → dissect_squashfs-1.10.dev2}/dissect/squashfs/squashfs.py +3 -0
  6. {dissect_squashfs-1.9.dev2 → dissect_squashfs-1.10.dev2}/dissect.squashfs.egg-info/PKG-INFO +7 -17
  7. {dissect_squashfs-1.9.dev2 → dissect_squashfs-1.10.dev2}/dissect.squashfs.egg-info/SOURCES.txt +11 -10
  8. {dissect_squashfs-1.9.dev2 → dissect_squashfs-1.10.dev2}/dissect.squashfs.egg-info/requires.txt +0 -8
  9. {dissect_squashfs-1.9.dev2 → dissect_squashfs-1.10.dev2}/pyproject.toml +1 -9
  10. {dissect_squashfs-1.9.dev2/tests/docs → dissect_squashfs-1.10.dev2/tests/_docs}/conf.py +2 -0
  11. {dissect_squashfs-1.9.dev2 → dissect_squashfs-1.10.dev2}/tests/conftest.py +7 -7
  12. {dissect_squashfs-1.9.dev2 → dissect_squashfs-1.10.dev2}/tests/test_squashfs.py +19 -0
  13. {dissect_squashfs-1.9.dev2 → dissect_squashfs-1.10.dev2}/tox.ini +4 -4
  14. {dissect_squashfs-1.9.dev2 → dissect_squashfs-1.10.dev2}/.git-blame-ignore-revs +0 -0
  15. {dissect_squashfs-1.9.dev2 → dissect_squashfs-1.10.dev2}/COPYRIGHT +0 -0
  16. {dissect_squashfs-1.9.dev2 → dissect_squashfs-1.10.dev2}/LICENSE +0 -0
  17. {dissect_squashfs-1.9.dev2 → dissect_squashfs-1.10.dev2}/MANIFEST.in +0 -0
  18. {dissect_squashfs-1.9.dev2 → dissect_squashfs-1.10.dev2}/dissect/squashfs/__init__.py +0 -0
  19. {dissect_squashfs-1.9.dev2 → dissect_squashfs-1.10.dev2}/dissect/squashfs/compression.py +0 -0
  20. {dissect_squashfs-1.9.dev2 → dissect_squashfs-1.10.dev2}/dissect/squashfs/exceptions.py +0 -0
  21. {dissect_squashfs-1.9.dev2 → dissect_squashfs-1.10.dev2}/dissect.squashfs.egg-info/dependency_links.txt +0 -0
  22. {dissect_squashfs-1.9.dev2 → dissect_squashfs-1.10.dev2}/dissect.squashfs.egg-info/top_level.txt +0 -0
  23. {dissect_squashfs-1.9.dev2 → dissect_squashfs-1.10.dev2}/setup.cfg +0 -0
  24. {dissect_squashfs-1.9.dev2 → dissect_squashfs-1.10.dev2}/tests/__init__.py +0 -0
  25. {dissect_squashfs-1.9.dev2/tests/data → dissect_squashfs-1.10.dev2/tests/_data}/gzip-opts.sqfs +0 -0
  26. {dissect_squashfs-1.9.dev2/tests/data → dissect_squashfs-1.10.dev2/tests/_data}/gzip.sqfs +0 -0
  27. {dissect_squashfs-1.9.dev2/tests/data → dissect_squashfs-1.10.dev2/tests/_data}/lz4.sqfs +0 -0
  28. {dissect_squashfs-1.9.dev2/tests/data → dissect_squashfs-1.10.dev2/tests/_data}/lzma.sqfs +0 -0
  29. {dissect_squashfs-1.9.dev2/tests/data → dissect_squashfs-1.10.dev2/tests/_data}/lzo.sqfs +0 -0
  30. {dissect_squashfs-1.9.dev2/tests/data → dissect_squashfs-1.10.dev2/tests/_data}/xz.sqfs +0 -0
  31. {dissect_squashfs-1.9.dev2/tests/data → dissect_squashfs-1.10.dev2/tests/_data}/zstd.sqfs +0 -0
  32. {dissect_squashfs-1.9.dev2/tests/docs → dissect_squashfs-1.10.dev2/tests/_docs}/Makefile +0 -0
  33. {dissect_squashfs-1.9.dev2/tests/docs → dissect_squashfs-1.10.dev2/tests/_docs}/index.rst +0 -0
  34. {dissect_squashfs-1.9.dev2 → dissect_squashfs-1.10.dev2}/tests/test_exceptions.py +0 -0
@@ -0,0 +1 @@
1
+ tests/_data/** filter=lfs diff=lfs merge=lfs -text
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.2
1
+ Metadata-Version: 2.4
2
2
  Name: dissect.squashfs
3
- Version: 1.9.dev2
3
+ Version: 1.10.dev2
4
4
  Summary: A Dissect module implementing a parser for the SquashFS file system, commonly used in appliance or device firmware
5
5
  Author-email: Dissect Team <dissect@fox-it.com>
6
6
  License: Affero General Public License v3
@@ -26,14 +26,11 @@ Requires-Dist: dissect.cstruct<5,>=4
26
26
  Requires-Dist: dissect.util<4,>=3
27
27
  Provides-Extra: full
28
28
  Requires-Dist: zstandard; extra == "full"
29
- Provides-Extra: lzo
30
- Requires-Dist: python-lzo; (platform_system != "Windows" or platform_python_implementation != "PyPy") and extra == "lzo"
31
- Provides-Extra: lz4
32
- Requires-Dist: lz4; extra == "lz4"
33
29
  Provides-Extra: dev
34
30
  Requires-Dist: dissect.squashfs[full]; extra == "dev"
35
31
  Requires-Dist: dissect.cstruct<5.0.dev,>=4.0.dev; extra == "dev"
36
32
  Requires-Dist: dissect.util<4.0.dev,>=3.0.dev; extra == "dev"
33
+ Dynamic: license-file
37
34
 
38
35
  # dissect.squashfs
39
36
 
@@ -54,17 +51,10 @@ Information on the supported Python versions can be found in the Getting Started
54
51
  pip install dissect.squashfs
55
52
  ```
56
53
 
57
- This project decompresses lzo and lz4 compressed file systems and can use the faster, native (C-based) lz4 and lzo
58
- implementations when installed, instead of the slower pure Python implementation provided by `dissect.util`. To use
59
- these faster implementations, install the package with the lzo and lz4 extras:
60
-
61
- ```bash
62
- pip install "dissect.squashfs[lz4,lzo]"
63
- ```
64
-
65
- Unfortunately there is no binary `python-lzo` wheel for PyPy installations on Windows, so it won't be installed there
66
-
67
- This module including the lz4 and lzo extras is also automatically installed if you install the `dissect` package.
54
+ This project decompresses LZO and LZ4 compressed file systems and can use a faster, native (Rust-based) LZO or LZ4 implementation,
55
+ instead of a slower pure Python implementation. Both implementations are provided by `dissect.util`.
56
+ Pre-build wheels are available for most common platforms and the native implementation will automatically be used if available.
57
+ In the rare case that a pre-build wheel is not available, please refer to `dissect.util` for build instructions.
68
58
 
69
59
  ## Build and test instructions
70
60
 
@@ -17,17 +17,10 @@ Information on the supported Python versions can be found in the Getting Started
17
17
  pip install dissect.squashfs
18
18
  ```
19
19
 
20
- This project decompresses lzo and lz4 compressed file systems and can use the faster, native (C-based) lz4 and lzo
21
- implementations when installed, instead of the slower pure Python implementation provided by `dissect.util`. To use
22
- these faster implementations, install the package with the lzo and lz4 extras:
23
-
24
- ```bash
25
- pip install "dissect.squashfs[lz4,lzo]"
26
- ```
27
-
28
- Unfortunately there is no binary `python-lzo` wheel for PyPy installations on Windows, so it won't be installed there
29
-
30
- This module including the lz4 and lzo extras is also automatically installed if you install the `dissect` package.
20
+ This project decompresses LZO and LZ4 compressed file systems and can use a faster, native (Rust-based) LZO or LZ4 implementation,
21
+ instead of a slower pure Python implementation. Both implementations are provided by `dissect.util`.
22
+ Pre-build wheels are available for most common platforms and the native implementation will automatically be used if available.
23
+ In the rare case that a pre-build wheel is not available, please refer to `dissect.util` for build instructions.
31
24
 
32
25
  ## Build and test instructions
33
26
 
@@ -5,7 +5,8 @@ import stat
5
5
  from dissect.cstruct import cstruct
6
6
 
7
7
  squashfs_def = """
8
- #define SQUASHFS_MAGIC 0x73717368
8
+ #define SQUASHFS_MAGIC 0x73717368
9
+ #define SQUASHFS_MAGIC_SWAP 0x68737173
9
10
 
10
11
  /* size of metadata (inode and directory) blocks */
11
12
  #define SQUASHFS_METADATA_SIZE 8192
@@ -33,6 +33,9 @@ class SquashFS:
33
33
 
34
34
  sb = c_squashfs.squashfs_super_block(fh)
35
35
  if sb.s_magic != c_squashfs.SQUASHFS_MAGIC:
36
+ if sb.s_magic == c_squashfs.SQUASHFS_MAGIC_SWAP:
37
+ raise NotImplementedError("Unsupported squashfs pre-4.0 big-endian filesystem")
38
+
36
39
  raise ValueError("Invalid squashfs superblock")
37
40
 
38
41
  # Only support squashfs 4.x for now
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.2
1
+ Metadata-Version: 2.4
2
2
  Name: dissect.squashfs
3
- Version: 1.9.dev2
3
+ Version: 1.10.dev2
4
4
  Summary: A Dissect module implementing a parser for the SquashFS file system, commonly used in appliance or device firmware
5
5
  Author-email: Dissect Team <dissect@fox-it.com>
6
6
  License: Affero General Public License v3
@@ -26,14 +26,11 @@ Requires-Dist: dissect.cstruct<5,>=4
26
26
  Requires-Dist: dissect.util<4,>=3
27
27
  Provides-Extra: full
28
28
  Requires-Dist: zstandard; extra == "full"
29
- Provides-Extra: lzo
30
- Requires-Dist: python-lzo; (platform_system != "Windows" or platform_python_implementation != "PyPy") and extra == "lzo"
31
- Provides-Extra: lz4
32
- Requires-Dist: lz4; extra == "lz4"
33
29
  Provides-Extra: dev
34
30
  Requires-Dist: dissect.squashfs[full]; extra == "dev"
35
31
  Requires-Dist: dissect.cstruct<5.0.dev,>=4.0.dev; extra == "dev"
36
32
  Requires-Dist: dissect.util<4.0.dev,>=3.0.dev; extra == "dev"
33
+ Dynamic: license-file
37
34
 
38
35
  # dissect.squashfs
39
36
 
@@ -54,17 +51,10 @@ Information on the supported Python versions can be found in the Getting Started
54
51
  pip install dissect.squashfs
55
52
  ```
56
53
 
57
- This project decompresses lzo and lz4 compressed file systems and can use the faster, native (C-based) lz4 and lzo
58
- implementations when installed, instead of the slower pure Python implementation provided by `dissect.util`. To use
59
- these faster implementations, install the package with the lzo and lz4 extras:
60
-
61
- ```bash
62
- pip install "dissect.squashfs[lz4,lzo]"
63
- ```
64
-
65
- Unfortunately there is no binary `python-lzo` wheel for PyPy installations on Windows, so it won't be installed there
66
-
67
- This module including the lz4 and lzo extras is also automatically installed if you install the `dissect` package.
54
+ This project decompresses LZO and LZ4 compressed file systems and can use a faster, native (Rust-based) LZO or LZ4 implementation,
55
+ instead of a slower pure Python implementation. Both implementations are provided by `dissect.util`.
56
+ Pre-build wheels are available for most common platforms and the native implementation will automatically be used if available.
57
+ In the rare case that a pre-build wheel is not available, please refer to `dissect.util` for build instructions.
68
58
 
69
59
  ## Build and test instructions
70
60
 
@@ -1,4 +1,5 @@
1
1
  .git-blame-ignore-revs
2
+ .gitattributes
2
3
  COPYRIGHT
3
4
  LICENSE
4
5
  MANIFEST.in
@@ -19,13 +20,13 @@ tests/__init__.py
19
20
  tests/conftest.py
20
21
  tests/test_exceptions.py
21
22
  tests/test_squashfs.py
22
- tests/data/gzip-opts.sqfs
23
- tests/data/gzip.sqfs
24
- tests/data/lz4.sqfs
25
- tests/data/lzma.sqfs
26
- tests/data/lzo.sqfs
27
- tests/data/xz.sqfs
28
- tests/data/zstd.sqfs
29
- tests/docs/Makefile
30
- tests/docs/conf.py
31
- tests/docs/index.rst
23
+ tests/_data/gzip-opts.sqfs
24
+ tests/_data/gzip.sqfs
25
+ tests/_data/lz4.sqfs
26
+ tests/_data/lzma.sqfs
27
+ tests/_data/lzo.sqfs
28
+ tests/_data/xz.sqfs
29
+ tests/_data/zstd.sqfs
30
+ tests/_docs/Makefile
31
+ tests/_docs/conf.py
32
+ tests/_docs/index.rst
@@ -8,11 +8,3 @@ dissect.util<4.0.dev,>=3.0.dev
8
8
 
9
9
  [full]
10
10
  zstandard
11
-
12
- [lz4]
13
- lz4
14
-
15
- [lzo]
16
-
17
- [lzo:platform_system != "Windows" or platform_python_implementation != "PyPy"]
18
- python-lzo
@@ -39,14 +39,6 @@ repository = "https://github.com/fox-it/dissect.squashfs"
39
39
  full = [
40
40
  "zstandard",
41
41
  ]
42
- lzo = [
43
- # There are no Windows PyPy wheels available for python-lzo
44
- # So we use a pure python fallback for it.
45
- "python-lzo; platform_system != 'Windows' or platform_python_implementation != 'PyPy'",
46
- ]
47
- lz4 = [
48
- "lz4",
49
- ]
50
42
  dev = [
51
43
  "dissect.squashfs[full]",
52
44
  "dissect.cstruct>=4.0.dev,<5.0.dev",
@@ -98,7 +90,7 @@ select = [
98
90
  ignore = ["E203", "B904", "UP024", "ANN002", "ANN003", "ANN204", "ANN401", "SIM105", "TRY003"]
99
91
 
100
92
  [tool.ruff.lint.per-file-ignores]
101
- "tests/docs/**" = ["INP001"]
93
+ "tests/_docs/**" = ["INP001"]
102
94
 
103
95
  [tool.ruff.lint.isort]
104
96
  known-first-party = ["dissect.squashfs"]
@@ -1,3 +1,5 @@
1
+ project = "dissect.squashfs"
2
+
1
3
  extensions = [
2
4
  "autoapi.extension",
3
5
  "sphinx.ext.autodoc",
@@ -26,34 +26,34 @@ def open_file_gz(name: str, mode: str = "rb") -> Iterator[BinaryIO]:
26
26
 
27
27
  @pytest.fixture
28
28
  def gzip_sqfs() -> Iterator[BinaryIO]:
29
- yield from open_file("data/gzip.sqfs")
29
+ yield from open_file("_data/gzip.sqfs")
30
30
 
31
31
 
32
32
  @pytest.fixture
33
33
  def gzip_opts_sqfs() -> Iterator[BinaryIO]:
34
- yield from open_file("data/gzip-opts.sqfs")
34
+ yield from open_file("_data/gzip-opts.sqfs")
35
35
 
36
36
 
37
37
  @pytest.fixture
38
38
  def lz4_sqfs() -> Iterator[BinaryIO]:
39
- yield from open_file("data/lz4.sqfs")
39
+ yield from open_file("_data/lz4.sqfs")
40
40
 
41
41
 
42
42
  @pytest.fixture
43
43
  def lzma_sqfs() -> Iterator[BinaryIO]:
44
- yield from open_file("data/lzma.sqfs")
44
+ yield from open_file("_data/lzma.sqfs")
45
45
 
46
46
 
47
47
  @pytest.fixture
48
48
  def lzo_sqfs() -> Iterator[BinaryIO]:
49
- yield from open_file("data/lzo.sqfs")
49
+ yield from open_file("_data/lzo.sqfs")
50
50
 
51
51
 
52
52
  @pytest.fixture
53
53
  def xz_sqfs() -> Iterator[BinaryIO]:
54
- yield from open_file("data/xz.sqfs")
54
+ yield from open_file("_data/xz.sqfs")
55
55
 
56
56
 
57
57
  @pytest.fixture
58
58
  def zstd_sqfs() -> Iterator[BinaryIO]:
59
- yield from open_file("data/zstd.sqfs")
59
+ yield from open_file("_data/zstd.sqfs")
@@ -1,5 +1,7 @@
1
1
  from __future__ import annotations
2
2
 
3
+ from io import BytesIO
4
+
3
5
  import pytest
4
6
 
5
7
  from dissect.squashfs.c_squashfs import c_squashfs
@@ -75,3 +77,20 @@ def test_squashfs(sqfs: str, compression_id: int, request: pytest.FixtureRequest
75
77
  sqfs = SquashFS(request.getfixturevalue(sqfs))
76
78
  assert sqfs.sb.compression == compression_id
77
79
  _verify_filesystem(sqfs)
80
+
81
+
82
+ def test_squashfs_unsupported_bigendian_3_0() -> None:
83
+ """Test if we correctly detect a SquashFS 3.0 big-endian filesystem."""
84
+
85
+ # Random SquashFS version 3.0 big-endian header found on binwalk GitHub issue tracker.
86
+ buf = bytes.fromhex(
87
+ "73717368000000b60000002042010d364200bc844200339440016800000300006b0400104003004ae64f330000000000"
88
+ "001623000100000000001177ff8e0800000000000e303100000000000e3025000000000000000000000000000e234c00"
89
+ )
90
+
91
+ sb = c_squashfs.squashfs_super_block(buf)
92
+ assert sb.s_magic == c_squashfs.SQUASHFS_MAGIC_SWAP
93
+ assert sb.s_major == 0x300
94
+
95
+ with pytest.raises(NotImplementedError, match="Unsupported squashfs pre-4.0 big-endian filesystem"):
96
+ SquashFS(BytesIO(buf))
@@ -55,12 +55,12 @@ deps =
55
55
  sphinx-design
56
56
  furo
57
57
  commands =
58
- make -C tests/docs clean
59
- make -C tests/docs html
58
+ make -C tests/_docs clean
59
+ make -C tests/_docs html
60
60
 
61
61
  [testenv:docs-linkcheck]
62
62
  allowlist_externals = make
63
63
  deps = {[testenv:docs-build]deps}
64
64
  commands =
65
- make -C tests/docs clean
66
- make -C tests/docs linkcheck
65
+ make -C tests/_docs clean
66
+ make -C tests/_docs linkcheck