dissect.squashfs 1.9.dev1__tar.gz → 1.10.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.
Files changed (34) hide show
  1. dissect_squashfs-1.10.dev1/.git-blame-ignore-revs +6 -0
  2. dissect_squashfs-1.10.dev1/.gitattributes +1 -0
  3. {dissect_squashfs-1.9.dev1/dissect.squashfs.egg-info → dissect_squashfs-1.10.dev1}/PKG-INFO +3 -2
  4. {dissect_squashfs-1.9.dev1 → dissect_squashfs-1.10.dev1}/dissect/squashfs/c_squashfs.py +2 -1
  5. {dissect_squashfs-1.9.dev1 → dissect_squashfs-1.10.dev1}/dissect/squashfs/squashfs.py +3 -0
  6. {dissect_squashfs-1.9.dev1 → dissect_squashfs-1.10.dev1/dissect.squashfs.egg-info}/PKG-INFO +3 -2
  7. {dissect_squashfs-1.9.dev1 → dissect_squashfs-1.10.dev1}/dissect.squashfs.egg-info/SOURCES.txt +12 -10
  8. {dissect_squashfs-1.9.dev1 → dissect_squashfs-1.10.dev1}/pyproject.toml +1 -1
  9. {dissect_squashfs-1.9.dev1/tests/docs → dissect_squashfs-1.10.dev1/tests/_docs}/conf.py +2 -0
  10. {dissect_squashfs-1.9.dev1 → dissect_squashfs-1.10.dev1}/tests/conftest.py +7 -7
  11. {dissect_squashfs-1.9.dev1 → dissect_squashfs-1.10.dev1}/tests/test_squashfs.py +19 -0
  12. {dissect_squashfs-1.9.dev1 → dissect_squashfs-1.10.dev1}/tox.ini +4 -4
  13. {dissect_squashfs-1.9.dev1 → dissect_squashfs-1.10.dev1}/COPYRIGHT +0 -0
  14. {dissect_squashfs-1.9.dev1 → dissect_squashfs-1.10.dev1}/LICENSE +0 -0
  15. {dissect_squashfs-1.9.dev1 → dissect_squashfs-1.10.dev1}/MANIFEST.in +0 -0
  16. {dissect_squashfs-1.9.dev1 → dissect_squashfs-1.10.dev1}/README.md +0 -0
  17. {dissect_squashfs-1.9.dev1 → dissect_squashfs-1.10.dev1}/dissect/squashfs/__init__.py +0 -0
  18. {dissect_squashfs-1.9.dev1 → dissect_squashfs-1.10.dev1}/dissect/squashfs/compression.py +0 -0
  19. {dissect_squashfs-1.9.dev1 → dissect_squashfs-1.10.dev1}/dissect/squashfs/exceptions.py +0 -0
  20. {dissect_squashfs-1.9.dev1 → dissect_squashfs-1.10.dev1}/dissect.squashfs.egg-info/dependency_links.txt +0 -0
  21. {dissect_squashfs-1.9.dev1 → dissect_squashfs-1.10.dev1}/dissect.squashfs.egg-info/requires.txt +0 -0
  22. {dissect_squashfs-1.9.dev1 → dissect_squashfs-1.10.dev1}/dissect.squashfs.egg-info/top_level.txt +0 -0
  23. {dissect_squashfs-1.9.dev1 → dissect_squashfs-1.10.dev1}/setup.cfg +0 -0
  24. {dissect_squashfs-1.9.dev1 → dissect_squashfs-1.10.dev1}/tests/__init__.py +0 -0
  25. {dissect_squashfs-1.9.dev1/tests/data → dissect_squashfs-1.10.dev1/tests/_data}/gzip-opts.sqfs +0 -0
  26. {dissect_squashfs-1.9.dev1/tests/data → dissect_squashfs-1.10.dev1/tests/_data}/gzip.sqfs +0 -0
  27. {dissect_squashfs-1.9.dev1/tests/data → dissect_squashfs-1.10.dev1/tests/_data}/lz4.sqfs +0 -0
  28. {dissect_squashfs-1.9.dev1/tests/data → dissect_squashfs-1.10.dev1/tests/_data}/lzma.sqfs +0 -0
  29. {dissect_squashfs-1.9.dev1/tests/data → dissect_squashfs-1.10.dev1/tests/_data}/lzo.sqfs +0 -0
  30. {dissect_squashfs-1.9.dev1/tests/data → dissect_squashfs-1.10.dev1/tests/_data}/xz.sqfs +0 -0
  31. {dissect_squashfs-1.9.dev1/tests/data → dissect_squashfs-1.10.dev1/tests/_data}/zstd.sqfs +0 -0
  32. {dissect_squashfs-1.9.dev1/tests/docs → dissect_squashfs-1.10.dev1/tests/_docs}/Makefile +0 -0
  33. {dissect_squashfs-1.9.dev1/tests/docs → dissect_squashfs-1.10.dev1/tests/_docs}/index.rst +0 -0
  34. {dissect_squashfs-1.9.dev1 → dissect_squashfs-1.10.dev1}/tests/test_exceptions.py +0 -0
@@ -0,0 +1,6 @@
1
+ # Formatting commits. You can ignore them during git-blame with `--ignore-rev` or `--ignore-revs-file`.
2
+ #
3
+ # $ git config --add 'blame.ignoreRevsFile' '.git-blame-ignore-revs'
4
+ #
5
+ # Change linter to Ruff (#30)
6
+ d57d43cb4851f1f70040bc10e2b00b88eb8dc35a
@@ -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.dev1
3
+ Version: 1.10.dev1
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
@@ -34,6 +34,7 @@ Provides-Extra: dev
34
34
  Requires-Dist: dissect.squashfs[full]; extra == "dev"
35
35
  Requires-Dist: dissect.cstruct<5.0.dev,>=4.0.dev; extra == "dev"
36
36
  Requires-Dist: dissect.util<4.0.dev,>=3.0.dev; extra == "dev"
37
+ Dynamic: license-file
37
38
 
38
39
  # dissect.squashfs
39
40
 
@@ -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.dev1
3
+ Version: 1.10.dev1
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
@@ -34,6 +34,7 @@ Provides-Extra: dev
34
34
  Requires-Dist: dissect.squashfs[full]; extra == "dev"
35
35
  Requires-Dist: dissect.cstruct<5.0.dev,>=4.0.dev; extra == "dev"
36
36
  Requires-Dist: dissect.util<4.0.dev,>=3.0.dev; extra == "dev"
37
+ Dynamic: license-file
37
38
 
38
39
  # dissect.squashfs
39
40
 
@@ -1,3 +1,5 @@
1
+ .git-blame-ignore-revs
2
+ .gitattributes
1
3
  COPYRIGHT
2
4
  LICENSE
3
5
  MANIFEST.in
@@ -18,13 +20,13 @@ tests/__init__.py
18
20
  tests/conftest.py
19
21
  tests/test_exceptions.py
20
22
  tests/test_squashfs.py
21
- tests/data/gzip-opts.sqfs
22
- tests/data/gzip.sqfs
23
- tests/data/lz4.sqfs
24
- tests/data/lzma.sqfs
25
- tests/data/lzo.sqfs
26
- tests/data/xz.sqfs
27
- tests/data/zstd.sqfs
28
- tests/docs/Makefile
29
- tests/docs/conf.py
30
- 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
@@ -98,7 +98,7 @@ select = [
98
98
  ignore = ["E203", "B904", "UP024", "ANN002", "ANN003", "ANN204", "ANN401", "SIM105", "TRY003"]
99
99
 
100
100
  [tool.ruff.lint.per-file-ignores]
101
- "tests/docs/**" = ["INP001"]
101
+ "tests/_docs/**" = ["INP001"]
102
102
 
103
103
  [tool.ruff.lint.isort]
104
104
  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