From aff6a7ae29477dd506e43e35724ce95c99a544db Mon Sep 17 00:00:00 2001 From: Quentin Kaiser Date: Tue, 8 Aug 2023 12:07:30 +0200 Subject: [PATCH] feat(handler): add support for non-standard squashfs v2 signature. --- unblob/handlers/__init__.py | 1 + unblob/handlers/filesystem/squashfs.py | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/unblob/handlers/__init__.py b/unblob/handlers/__init__.py index d06fe54061..1a120b2b9d 100644 --- a/unblob/handlers/__init__.py +++ b/unblob/handlers/__init__.py @@ -44,6 +44,7 @@ ntfs.NTFSHandler, romfs.RomFSFSHandler, squashfs.SquashFSv2Handler, + squashfs.SquashFSv2NonStandardHandler, squashfs.SquashFSv3Handler, squashfs.SquashFSv3DDWRTHandler, squashfs.SquashFSv3BroadcomHandler, diff --git a/unblob/handlers/filesystem/squashfs.py b/unblob/handlers/filesystem/squashfs.py index b5a3f6920f..afc991750f 100644 --- a/unblob/handlers/filesystem/squashfs.py +++ b/unblob/handlers/filesystem/squashfs.py @@ -115,6 +115,25 @@ class SquashFSv2Handler(_SquashFSBase): HEADER_STRUCT = "squashfs2_super_block_t" +class SquashFSv2NonStandardHandler(SquashFSv2Handler): + NAME = "squashfs_v2_nonstandard" + + BIG_ENDIAN_MAGIC = 0x73_71_6C_7A + + EXTRACTOR = SquashFSExtractor(0x73_71_6C_7A) + + PATTERNS = [ + HexString( + """ + // 00000000 73 71 6c 7a 00 00 03 3f 00 21 99 d7 00 21 99 c7 |sqlz...?........| + // 00000010 00 00 00 00 00 21 71 7c 00 21 82 89 00 02 00 01 |.!...!.......!q.| + // squashfs_v2_magic_non_standard_be + 73 71 6c 7a [24] 00 02 + """ + ), + ] + + class SquashFSv3Handler(_SquashFSBase): NAME = "squashfs_v3"