Skip to content

Commit cb415e4

Browse files
jstuckeqkaiser
authored andcommitted
feat(handler): add support for squashfs v4 broadcom variants
Adds support for unpacking broadcom variants of squashfs v4 images (e.g. found in D-Link DSL-2640B and Asus DSL-N12HP).
1 parent 54fb3ef commit cb415e4

File tree

21 files changed

+118
-0
lines changed

21 files changed

+118
-0
lines changed

docs/handlers.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@
5959
| [`SQUASHFS (V3-DDWRT)`](#squashfs-v3-ddwrt) | FILESYSTEM | :octicons-check-16: |
6060
| [`SQUASHFS (V3-NON-STANDARD)`](#squashfs-v3-non-standard) | FILESYSTEM | :octicons-check-16: |
6161
| [`SQUASHFS (V4-BE)`](#squashfs-v4-be) | FILESYSTEM | :octicons-check-16: |
62+
| [`SQUASHFS (V4-BROADCOM)`](#squashfs-v4-broadcom) | FILESYSTEM | :octicons-check-16: |
6263
| [`SQUASHFS (V4-LE)`](#squashfs-v4-le) | FILESYSTEM | :octicons-check-16: |
6364
| [`STUFFIT SIT`](#stuffit-sit) | ARCHIVE | :octicons-check-16: |
6465
| [`STUFFIT SIT (V5)`](#stuffit-sit-v5) | ARCHIVE | :octicons-check-16: |
@@ -1032,6 +1033,23 @@
10321033
- **Handler type:** FileSystem
10331034
10341035

1036+
=== "References"
1037+
1038+
- [SquashFS Documentation](https://dr-emann.github.io/squashfs/){ target="_blank" }
1039+
- [SquashFS Wikipedia](https://en.wikipedia.org/wiki/SquashFS){ target="_blank" }
1040+
## SquashFS (v4-broadcom)
1041+
1042+
!!! success "Fully supported"
1043+
1044+
=== "Description"
1045+
1046+
SquashFS version 4 is a compressed, read-only file system format designed for minimal storage usage. It is widely used in embedded systems and Linux distributions for efficient storage and fast access.
1047+
1048+
---
1049+
1050+
- **Handler type:** FileSystem
1051+
- **Vendor:** Broadcom
1052+
10351053
=== "References"
10361054

10371055
- [SquashFS Documentation](https://dr-emann.github.io/squashfs/){ target="_blank" }

python/unblob/handlers/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@
7171
squashfs.SquashFSv3NSHandler,
7272
squashfs.SquashFSv4LEHandler,
7373
squashfs.SquashFSv4BEHandler,
74+
squashfs.SquashFSv4BroadcomHandler,
7475
ubi.UBIHandler,
7576
ubi.UBIFSHandler,
7677
yaffs.YAFFSHandler,

python/unblob/handlers/filesystem/squashfs.py

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -498,3 +498,48 @@ class SquashFSv4BEHandler(SquashFSv4LEHandler):
498498
],
499499
limitations=[],
500500
)
501+
502+
503+
class SquashFSv4BroadcomHandler(SquashFSv4LEHandler):
504+
NAME = "squashfs_v4_broadcom"
505+
506+
BIG_ENDIAN_MAGIC = 0x71_73_68_73
507+
508+
EXTRACTOR = SquashFSExtractor(4, 0x71_73_68_73)
509+
510+
PATTERNS = [
511+
HexString(
512+
"""
513+
// 00000000 71 73 68 73 00 00 00 05 62 1f 5e 09 00 02 00 00 |qshs....b.^.....|
514+
// 00000010 00 00 00 01 00 01 00 11 00 c0 00 01 00 04 00 00 |................|
515+
// squashfs_v4_magic_broadcom_be
516+
71 73 68 73 [24] 00 04
517+
"""
518+
),
519+
HexString(
520+
"""
521+
// 00000000 73 68 73 71 03 00 00 00 00 c1 9c 61 00 00 02 00 |shsq.......a....|
522+
// 00000010 01 00 00 00 01 00 11 00 c0 00 01 00 04 00 00 00 |................|
523+
// squashfs_v4_magic_broadcom_le
524+
73 68 73 71 [24] 04 00
525+
"""
526+
),
527+
]
528+
529+
DOC = HandlerDoc(
530+
name="SquashFS (v4-broadcom)",
531+
description="SquashFS version 4 is a compressed, read-only file system format designed for minimal storage usage. It is widely used in embedded systems and Linux distributions for efficient storage and fast access.",
532+
handler_type=HandlerType.FILESYSTEM,
533+
vendor="Broadcom",
534+
references=[
535+
Reference(
536+
title="SquashFS Documentation",
537+
url="https://dr-emann.github.io/squashfs/",
538+
),
539+
Reference(
540+
title="SquashFS Wikipedia",
541+
url="https://en.wikipedia.org/wiki/SquashFS",
542+
),
543+
],
544+
limitations=[],
545+
)
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
version https://git-lfs.github.com/spec/v1
2+
oid sha256:283f074b6415b4105d3ec76861b823106c82b96724df30da7f9620e56549c6e6
3+
size 4096
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
version https://git-lfs.github.com/spec/v1
2+
oid sha256:46f7c57770f62692fdc22ad8ed65739242f43aafa5e62a4be075ed899e21e75f
3+
size 307
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
version https://git-lfs.github.com/spec/v1
2+
oid sha256:b7963fba31962c614e439f4f7a43a1eddec43afe1bdb1ffb059e72f8a15bd10b
3+
size 4096
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
version https://git-lfs.github.com/spec/v1
2+
oid sha256:8ef3815d87a50c32ed5c540003ecaa4e383604708efc2916ad2ba8644b9e8487
3+
size 308
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
version https://git-lfs.github.com/spec/v1
2+
oid sha256:6181259c6b2ca629a56920b422e9a8f212a4d0bcead923df92dbd66fbb7e1c30
3+
size 7
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
version https://git-lfs.github.com/spec/v1
2+
oid sha256:919fc82d6f1031d305dbce2fc5a74a6df5ddf2da472ee4d137c681cef28d4aff
3+
size 7
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
version https://git-lfs.github.com/spec/v1
2+
oid sha256:2d95014ed3f24e86ce5fc3a4529f057d7b2318d9b24b54f2e9476b154bd21ec6
3+
size 7

0 commit comments

Comments
 (0)