sasquatch's People
Forkers
17twenty cappiewu lucabongiorni miuvlad pombreda chronum idkwim lopessec shiham101 flyawaytang firmadyne jilir lwgboy hertzg bryanchriswhite team-firebugs nightcap79 ycktw dzamine zachriggle palyzx sigma-random gansakumar shekkbuilder shuixi2013 ygemici dellsun damiankaczkowski stayliv3 totetotetotem l0rda tesuji mzpqnxow e3v3a svieg yqyunjie kartheeklade banfarns666 wooy0ung hxlszxy xiaobai4g wisdark dudufangor pombredanne nevercodecorrect chintrin vxer-lee gitreny kinglee1982 becauro svenschwermer tadryanom mattickus 5l1v3r1 zcye4647 anoop142 firmianay locksley1337 jopde6vovgedsahzux eacmen useidel keyman9848 rkwaysltd liuxing9848 jackyvan agusdallalba decidedlygray cole-h icekhaos ashish-kaushik flexlolo mscalindt aihacker amazingout patazerty otilrac sunjiaying lhaisu drive-slow-homie szymonorz eliminater74 hackerthinktank sevrb trofi rstular jrhopper sporadicthought river-li ninhnn2 threadexio kopfjager007 martonilles ze9295 adlra ting668 taiji-xo alsotoes speidy huynhngockhanh52 souravbaghzsasquatch's Issues
I've done something wrong
What version of debian/ubuntu can you build this on?
cc -g -O2 -I. -I./LZMA/lzma465/C -I./LZMA/lzmalt -I./LZMA/lzmadaptive/C/7zip/Compress/LZMA_Lib -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_GNU_SOURCE -DCOMP_DEFAULT=\"gzip\" -Wall -Werror -DGZIP_SUPPORT -DLZMA_SUPPORT -DXZ_SUPPORT -DLZO_SUPPORT -DXATTR_SUPPORT -DXATTR_DEFAULT -c -o xz_wrapper.o xz_wrapper.c
In file included from xz_wrapper.c:31:0:
xz_wrapper.h:50:2: error: unknown type name ‘lzma_vli’
lzma_vli id;
^
xz_wrapper.h:56:2: error: unknown type name ‘lzma_filter’
lzma_filter filter[3];
^
xz_wrapper.h:64:2: error: unknown type name ‘lzma_options_lzma’
lzma_options_lzma opt;
^
xz_wrapper.c:35:11: error: ‘LZMA_FILTER_X86’ undeclared here (not in a function)
{ "x86", LZMA_FILTER_X86, 0 },
^
xz_wrapper.c:36:15: error: ‘LZMA_FILTER_POWERPC’ undeclared here (not in a function)
{ "powerpc", LZMA_FILTER_POWERPC, 0 },
^
xz_wrapper.c:37:12: error: ‘LZMA_FILTER_IA64’ undeclared here (not in a function)
{ "ia64", LZMA_FILTER_IA64, 0 },
^
xz_wrapper.c:38:11: error: ‘LZMA_FILTER_ARM’ undeclared here (not in a function)
{ "arm", LZMA_FILTER_ARM, 0 },
^
xz_wrapper.c:39:16: error: ‘LZMA_FILTER_ARMTHUMB’ undeclared here (not in a function)
{ "armthumb", LZMA_FILTER_ARMTHUMB, 0 },
Small changes so that the build.sh runs on the latest of Kali Linux
So over the past few days I've had some trouble getting this to build on Kali Linux but have resolved it simply by running
CFLAGS=-fcommon ./build.sh
Rather than
./build.sh
If anyone else has been having issues like I have hopefully this at least gives them a easy to find fix for it.
License?
Hi,
First of all, thanks for your patch!
There is no License in the repo, so it is unclear for people wanting to reuse your work to know to which extent they can.
In particular, I am looking to make it available as a package on NixOS (NixOS/nixpkgs#66600).
Cheers,
filesystem newer than what sasquatch 4.3 can handle?
I'm working with a squashfs-encrypted file that was created June 14, 2012:
ONKAVR0003_MA00MAMAMA00SAM7MA.of3 <- ignore the file extension
It's one of three files that Onkyo (A/V receiver mfgr) uses for firmware updates.
This is what I get when trying to display superblock info (also when I try to extract):
$ sasquatch -s ONKAVR0003_MA00MAMAMA00SAM7MA.of3
SquashFS version [64690.53089] / inode count [263635247] suggests a SquashFS image of a different endianess
Non-standard SquashFS Magic: BW
Reading a different endian SQUASHFS filesystem on ONKAVR0003_MA00MAMAMA00SAM7MA.of3
Filesystem on ONKAVR0003_MA00MAMAMA00SAM7MA.of3 is (45820:25039), which is a later filesystem version than I support!
Anyone one to take a stab at this? I can email the zipped file containing the three *.of# files.
Segmentation fault
Trying to unsquash a slightly modified ddwrt squashfs image:
http://lolcathost.org/b/out.fs
$ $ gdb --args /tmp/sasquatch out.fs
GNU gdb (GDB) 7.8
Copyright (C) 2014 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-unknown-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from /tmp/sasquatch...done.
(gdb) r
Starting program: /tmp/sasquatch out.fs
warning: Could not load shared library symbols for linux-vdso.so.1.
Do you need "set solib-search-path" or "set sysroot"?
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/usr/lib/libthread_db.so.1".
SquashFS version [3.0] / inode count [554] suggests a SquashFS image of the same endianess
[New Thread 0x7ffff6bba700 (LWP 5583)]
[New Thread 0x7ffff63b9700 (LWP 5584)]
[New Thread 0x7ffff5bb8700 (LWP 5585)]
[New Thread 0x7ffff53b7700 (LWP 5586)]
[New Thread 0x7ffff4bb6700 (LWP 5587)]
[New Thread 0x7ffff43b5700 (LWP 5588)]
[New Thread 0x7ffff3bb4700 (LWP 5589)]
[New Thread 0x7ffff33b3700 (LWP 5590)]
[New Thread 0x7ffff2bb2700 (LWP 5591)]
[New Thread 0x7ffff23b1700 (LWP 5592)]
[New Thread 0x7ffff1bb0700 (LWP 5593)]
[New Thread 0x7ffff13af700 (LWP 5594)]
[New Thread 0x7ffff0bae700 (LWP 5595)]
[New Thread 0x7ffff03ad700 (LWP 5596)]
[New Thread 0x7fffefbac700 (LWP 5597)]
[New Thread 0x7fffef3ab700 (LWP 5598)]
Parallel unsquashfs: Using 12 processors
Trying to decompress using default gzip decompressor...
Trying to decompress with lzma...
Trying to decompress with lzma-adaptive...
Program received signal SIGSEGV, Segmentation fault.
0x000000000041dfaf in NCompress::NLZMA::CDecoder::CodeReal(ISequentialInStream*, ISequentialOutStream*, unsigned long long const*, unsigned long long const*, ICompressProgressInfo*) ()
(gdb) disassemble $rip, $rip+20
Dump of assembler code from 0x41dfaf to 0x41dfc3:
=> 0x000000000041dfaf <_ZN9NCompress5NLZMA8CDecoder8CodeRealEP19ISequentialInStreamP20ISequentialOutStreamPKyS7_P21ICompressProgressInfo+367>: callq *0x10(%rax)
0x000000000041dfb2 <_ZN9NCompress5NLZMA8CDecoder8CodeRealEP19ISequentialInStreamP20ISequentialOutStreamPKyS7_P21ICompressProgressInfo+370>: movq $0x0,0x68(%rbx)
0x000000000041dfba <_ZN9NCompress5NLZMA8CDecoder8CodeRealEP19ISequentialInStreamP20ISequentialOutStreamPKyS7_P21ICompressProgressInfo+378>: add $0x10,%rsp
0x000000000041dfbe <_ZN9NCompress5NLZMA8CDecoder8CodeRealEP19ISequentialInStreamP20ISequentialOutStreamPKyS7_P21ICompressProgressInfo+382>: mov %ebp,%eax
0x000000000041dfc0 <_ZN9NCompress5NLZMA8CDecoder8CodeRealEP19ISequentialInStreamP20ISequentialOutStreamPKyS7_P21ICompressProgressInfo+384>: pop %rbx
0x000000000041dfc1 <_ZN9NCompress5NLZMA8CDecoder8CodeRealEP19ISequentialInStreamP20ISequentialOutStreamPKyS7_P21ICompressProgressInfo+385>: pop %rbp
0x000000000041dfc2 <_ZN9NCompress5NLZMA8CDecoder8CodeRealEP19ISequentialInStreamP20ISequentialOutStreamPKyS7_P21ICompressProgressInfo+386>: pop %r12
End of assembler dump.
(gdb) info registers
rax 0xdcdcdcdcdcdcdcdc -2531906049332683556
rbx 0x7e0b40 8260416
rcx 0x800000 8388608
rdx 0x29a 666
rsi 0x29a 666
rdi 0x7e0ac0 8260288
rbp 0x1 0x1
rsp 0x7fffffffe260 0x7fffffffe260
r8 0x7e0830 8259632
r9 0x800 2048
r10 0x7e0830 8259632
r11 0x10 16
r12 0x7e0b58 8260440
r13 0x7fffffffe2d8 140737488347864
r14 0x7e0b00 8260352
r15 0x0 0
rip 0x41dfaf 0x41dfaf <NCompress::NLZMA::CDecoder::CodeReal(ISequentialInStream*, ISequentialOutStream*, unsigned long long const*, unsigned long long const*, ICompressProgressInfo*)+367>
eflags 0x10206 [ PF IF RF ]
cs 0x33 51
ss 0x2b 43
ds 0x0 0
es 0x0 0
fs 0x0 0
gs 0x0 0
(gdb) bt
#0 0x000000000041dfaf in NCompress::NLZMA::CDecoder::CodeReal(ISequentialInStream*, ISequentialOutStream*, unsigned long long const*, unsigned long long const*, ICompressProgressInfo*) ()
#1 0x000000000041ab0a in NCompress::NLZMA::CDecoder::Code(ISequentialInStream*, ISequentialOutStream*, unsigned long long const*, unsigned long long const*, ICompressProgressInfo*) ()
#2 0x000000000041a2d9 in lzmaspec_uncompress ()
#3 0x0000000000410011 in lzma_adaptive_uncompress (dest=0x7e06e0, src=0x7fffffffe420, size=144, outsize=640,
error=0x7fffffffe4dc) at lzma_wrapper.c:292
#4 0x000000000040ef76 in compressor_uncompress (comp=0x6473c0 <lzma_adaptive_comp_ops>, dest=dest@entry=0x7e06e0,
src=src@entry=0x7fffffffe420, size=144, block_size=block_size@entry=320, error=error@entry=0x7fffffffe4dc)
at compressor.c:193
#5 0x0000000000408144 in read_block (fd=3, start=2149509, next=next@entry=0x0, expected=expected@entry=320,
block=0x7e06e0) at unsquashfs.c:703
#6 0x000000000040c575 in read_fragment_table_3 (directory_table_end=0x7fffffffe5d8) at unsquash-3.c:78
#7 0x0000000000402a83 in main (argc=<optimized out>, argv=0x7fffffffe6f8) at unsquashfs.c:2953
uses outdated version of squashfs-tools
sasquatch is currently using an old version of squashfs-tools, which contains the bug described here: plougher/squashfs-tools#125 that was fixed in a later version.
https://github.com/ReFirmLabs/binwalk depends on this package, and after it (silently) failed to extract a squashfs binary while running in a docker container with an almost infinite open file limit, I tracked the upstream issue to here.
In summary: just bump the squashfs version in the build script
multiple definition of `verbose';
/usr/bin/ld: unsquash-1.o:/home/user/sasquatch-master/squashfs4.3/squashfs-tools/error.h:34: multiple definition of verbose'; unsquashfs.o:/home/user/sasquatch-master/squashfs4.3/squashfs-tools/error.h:34: first defined here /usr/bin/ld: unsquash-2.o:/home/user/sasquatch-master/squashfs4.3/squashfs-tools/error.h:34: multiple definition of
verbose'; unsquashfs.o:/home/user/sasquatch-master/squashfs4.3/squashfs-tools/error.h:34: first defined here
/usr/bin/ld: unsquash-3.o:/home/user/sasquatch-master/squashfs4.3/squashfs-tools/error.h:34: multiple definition of verbose'; unsquashfs.o:/home/user/sasquatch-master/squashfs4.3/squashfs-tools/error.h:34: first defined here /usr/bin/ld: unsquash-4.o:/home/user/sasquatch-master/squashfs4.3/squashfs-tools/error.h:34: multiple definition of
verbose'; unsquashfs.o:/home/user/sasquatch-master/squashfs4.3/squashfs-tools/error.h:34: first defined here
/usr/bin/ld: compressor.o:/home/user/sasquatch-master/squashfs4.3/squashfs-tools/error.h:34: multiple definition of verbose'; unsquashfs.o:/home/user/sasquatch-master/squashfs4.3/squashfs-tools/error.h:34: first defined here /usr/bin/ld: unsquashfs_info.o:/home/user/sasquatch-master/squashfs4.3/squashfs-tools/error.h:34: multiple definition of
verbose'; unsquashfs.o:/home/user/sasquatch-master/squashfs4.3/squashfs-tools/error.h:34: first defined here
/usr/bin/ld: lzma_wrapper.o:/home/user/sasquatch-master/squashfs4.3/squashfs-tools/error.h:34: multiple definition of verbose'; unsquashfs.o:/home/user/sasquatch-master/squashfs4.3/squashfs-tools/error.h:34: first defined here /usr/bin/ld: read_xattrs.o:/home/user/sasquatch-master/squashfs4.3/squashfs-tools/error.h:34: multiple definition of
verbose'; unsquashfs.o:/home/user/sasquatch-master/squashfs4.3/squashfs-tools/error.h:34: first defined here
/usr/bin/ld: unsquashfs_xattr.o:/home/user/sasquatch-master/squashfs4.3/squashfs-tools/error.h:34: multiple definition of `verbose'; unsquashfs.o:/home/user/sasquatch-master/squashfs4.3/squashfs-tools/error.h:34: first defined here
collect2: error: ld returned 1 exit status
make: *** [Makefile:298: sasquatch] Error 1
loSame issue on Kali/Debian with `gcc (Debian 10.2.1-6) 10.2.1`
Same issue on Kali/Debian with gcc (Debian 10.2.1-6) 10.2.1
Both solutions did not work for me.
@Jegeva I changed in sasquatch/squashfs4.3/squashfs-tools/error.h int verbose;
to extern int verbose;
and added in unsquashfs.c int verbose;
after int user_xattrs = FALSE;
.
Are these steps right?
Afterwards I get these errors:
/usr/bin/ld: unsquash-1.o:/home/jk2210/sasquatch/squashfs4.3/squashfs-tools/error.h:34: multiple definition of `verbose'; unsquashfs.o:/home/jk2210/sasquatch/squashfs4.3/squashfs-tools/unsquashfs.c:85: first defined here
/usr/bin/ld: unsquash-2.o:/home/jk2210/sasquatch/squashfs4.3/squashfs-tools/error.h:34: multiple definition of `verbose'; unsquashfs.o:/home/jk2210/sasquatch/squashfs4.3/squashfs-tools/unsquashfs.c:85: first defined here
/usr/bin/ld: unsquash-3.o:/home/jk2210/sasquatch/squashfs4.3/squashfs-tools/error.h:34: multiple definition of `verbose'; unsquashfs.o:/home/jk2210/sasquatch/squashfs4.3/squashfs-tools/unsquashfs.c:85: first defined here
/usr/bin/ld: unsquash-4.o:/home/jk2210/sasquatch/squashfs4.3/squashfs-tools/error.h:34: multiple definition of `verbose'; unsquashfs.o:/home/jk2210/sasquatch/squashfs4.3/squashfs-tools/unsquashfs.c:85: first defined here
/usr/bin/ld: compressor.o:/home/jk2210/sasquatch/squashfs4.3/squashfs-tools/error.h:34: multiple definition of `verbose'; unsquashfs.o:/home/jk2210/sasquatch/squashfs4.3/squashfs-tools/unsquashfs.c:85: first defined here
/usr/bin/ld: unsquashfs_info.o:/home/jk2210/sasquatch/squashfs4.3/squashfs-tools/error.h:34: multiple definition of `verbose'; unsquashfs.o:/home/jk2210/sasquatch/squashfs4.3/squashfs-tools/unsquashfs.c:85: first defined here
/usr/bin/ld: unsquashfs_xattr.o:/home/jk2210/sasquatch/squashfs4.3/squashfs-tools/error.h:34: multiple definition of `verbose'; unsquashfs.o:/home/jk2210/sasquatch/squashfs4.3/squashfs-tools/unsquashfs.c:85: first defined here
collect2: error: ld returned 1 exit status
make: *** [Makefile:298: sasquatch] Error 1
Originally posted by @JK2210 in #36 (comment)
FATAL ERROR:Line too long when reading extract file "***.bin", larger than 16384 bytes
FATAL ERROR:Line too long when reading extract file "***.bin", larger than 16384 bytes
Erro compile
cc -g -O2 -I. -I./LZMA/lzma465/C -I./LZMA/lzmalt -I./LZMA/lzmadaptive/C/7zip/Compress/LZMA_Lib -D_FILE_OFFSET_BITS =64 -D_LARGEFILE_SOURCE -D_GNU_SOURCE -DCOMP_DEFAULT=\"gzip\" -Wall -Werror -DGZIP_SUPPORT -DLZMA_SUPPORT -DXZ_SUP PORT -DLZO_SUPPORT -DXATTR_SUPPORT -DXATTR_DEFAULT -c -o xz_wrapper.o xz_wrapper.c
xz_wrapper.c:28:18: fatal error: lzma.h: No such file or directory
#include <lzma.h>
Different-endian filesystem not extractable
Binwalk says the following:
Squashfs filesystem, big endian, version 4.0, compression:xz, size: 15229650 bytes, 6054 inodes, blocksize: 65536 bytes, created: 1970-06-26 06:27:30
Alas, sasquatch fails at extracting the files:
sasquatch -major 4 -minor 0 -be -c xz -f ../mmcblk0p1
Non-standard SquashFS Magic:
Reading a different endian SQUASHFS filesystem on ../mmcblk0p1
FATAL ERROR:Block size or block_log too large. File system is corrupt.
I know the filesystem is not corrupt, so I can only hazard a guess that sasquatch gets the endianness wrong on one or another value.
Patching unsquashfs.c failing
Getting this error when trying to build:
patching file squashfs-tools/unsquashfs.c
cc -g -O2 -I. -I./LZMA/lzma465/C -I./LZMA/lzmalt -I./LZMA/lzmadaptive/C/7zip/Compress/LZMA_Lib -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_GNU_SOURCE -DCOMP_DEFAULT="gzip" -Wall -Werror -DGZIP_SUPPORT -DLZMA_SUPPORT -DXZ_SUPPORT -DLZO_SUPPORT -DXATTR_SUPPORT -DXATTR_DEFAULT -c -o unsquashfs.o unsquashfs.c
unsquashfs.c: In function ‘read_super’:
unsquashfs.c:1988:5: error: this ‘if’ clause does not guard... [-Werror=misleading-indentation]
if(!comp)
^~
unsquashfs.c:1990:2: note: ...this statement, but the latter is misleadingly indented as if it is guarded by the ‘if’
return TRUE;
^~~~~~
cc1: all warnings being treated as errors
: recipe for target 'unsquashfs.o' failed
make: *** [unsquashfs.o] Error 1
Build script downloading squashfs.4.3.tar.gz as HTML.
I don't know why, but when using this build script it fails. Upon investigating I found out the squashfs gzip files can't be extracted (tar zxvf output says "not a gzip file")
Then I did "file squashfs.4.3.tar.gz" and found out wget downloads it as HTML.
After downloading the file and applying the patch mannualy, I compiled it just fine.
./build.sh failed on Kali
cc -g -O2 -I. -I./LZMA/lzma465/C -I./LZMA/lzmalt -I./LZMA/lzmadaptive/C/7zip/Compress/LZMA_Lib -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_GNU_SOURCE -DCOMP_DEFAULT="gzip" -Wall -Werror -DGZIP_SUPPORT -DLZMA_SUPPORT -DXZ_SUPPORT -DLZO_SUPPORT -DXATTR_SUPPORT -DXATTR_DEFAULT -c -o unsquashfs.o unsquashfs.c
unsquashfs.c: In function ‘create_inode’:
unsquashfs.c:1140:13: error: In the GNU C Library, "makedev" is defined
by <sys/sysmacros.h>. For historical compatibility, it is
currently defined by <sys/types.h> as well, but we plan to
remove this soon. To use "makedev", include <sys/sysmacros.h>
directly. If you did not intend to use a system-defined macro
"makedev", you should undefine it after including <sys/types.h>. [-Werror]
i->data & 0xff)) == -1) {
^~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
: recipe for target 'unsquashfs.o' failed
make: *** [unsquashfs.o] Error 1
Sasquatch fails to build on Kali Linux
unsquashfs.c: In function ‘create_inode’:
unsquashfs.c:1140:13: error: In the GNU C Library, "makedev" is defined
by <sys/sysmacros.h>. For historical compatibility, it is
currently defined by <sys/types.h> as well, but we plan to
remove this soon. To use "makedev", include <sys/sysmacros.h>
directly. If you did not intend to use a system-defined macro
"makedev", you should undefine it after including <sys/types.h>. [-Werror]
i->data & 0xff)) == -1) {
^~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
<builtin>: recipe for target 'unsquashfs.o' failed
make: *** [unsquashfs.o] Error 1
Patched compilation fails
$ make
cc -g -O2 -I. -I./LZMA/lzma465/C -I./LZMA/lzmalt -I./LZMA/lzmadaptive/C/7zip/Compress/LZMA_Lib -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_GNU_SOURCE -DCOMP_DEFAULT=\"gzip\" -Wall -Werror -DGZIP_SUPPORT -DLZMA_SUPPORT -DXZ_SUPPORT -DLZO_SUPPORT -DXATTR_SUPPORT -DXATTR_DEFAULT -c -o unsquashfs.o unsquashfs.c
In file included from unsquashfs.c:26:0:
unsquashfs.h:51:0: error: "__BYTE_ORDER" redefined [-Werror]
#define __BYTE_ORDER BYTE_ORDER
In file included from /usr/include/machine/_endian.h:14:0,
from /usr/include/machine/endian.h:6,
from /usr/include/sys/types.h:67,
from /usr/include/stdio.h:61,
from unsquashfs.h:29,
from unsquashfs.c:26:
/usr/include/bits/endian.h:20:0: note: this is the location of the previous definition
# define __BYTE_ORDER __LITTLE_ENDIAN
In file included from unsquashfs.c:26:0:
unsquashfs.h:52:0: error: "__BIG_ENDIAN" redefined [-Werror]
#define __BIG_ENDIAN BIG_ENDIAN
In file included from /usr/include/machine/_endian.h:14:0,
from /usr/include/machine/endian.h:6,
from /usr/include/sys/types.h:67,
from /usr/include/stdio.h:61,
from unsquashfs.h:29,
from unsquashfs.c:26:
/usr/include/bits/endian.h:13:0: note: this is the location of the previous definition
# define __BIG_ENDIAN 4321
In file included from unsquashfs.c:26:0:
unsquashfs.h:53:0: error: "__LITTLE_ENDIAN" redefined [-Werror]
#define __LITTLE_ENDIAN LITTLE_ENDIAN
In file included from /usr/include/machine/_endian.h:14:0,
from /usr/include/machine/endian.h:6,
from /usr/include/sys/types.h:67,
from /usr/include/stdio.h:61,
from unsquashfs.h:29,
from unsquashfs.c:26:
/usr/include/bits/endian.h:16:0: note: this is the location of the previous definition
# define __LITTLE_ENDIAN 1234
unsquashfs.c: In function ‘matches’:
unsquashfs.c:1443:35: error: ‘FNM_EXTMATCH’ undeclared (first use in this function)
name, FNM_PATHNAME|FNM_PERIOD|FNM_EXTMATCH) ==
^~~~~~~~~~~~
unsquashfs.c:1443:35: note: each undeclared identifier is reported only once for each function it appears in
unsquashfs.c: In function ‘initialise_threads’:
unsquashfs.c:2299:12: error: ‘CTL_HW’ undeclared (first use in this function)
mib[0] = CTL_HW;
^~~~~~
unsquashfs.c:2303:12: error: ‘HW_NCPU’ undeclared (first use in this function)
mib[1] = HW_NCPU;
^~~~~~~
unsquashfs.c:2306:6: error: implicit declaration of function ‘sysctl’ [-Werror=implicit-function-declaration]
if(sysctl(mib, 2, &processors, &len, NULL, 0) == -1) {
^~~~~~
cc1: all warnings being treated as errors
make: *** [<builtin>: unsquashfs.o] Error 1
Any ideas?
Multiple bugs from fuzzing
I've been fuzzing sasquatch (in particular the fork by @gcanalesb, which fixes a number of bugs I found in this release) and ran into a number of crashes which persisted. There appear to be a few checks missing where values are passed to malloc() without validation, and at least one case that causes out-of-bounds access.
I've got 68 crashes, though I haven't run through them all to check what's a duplicate and what's not. From what I can tell, there are at least 4 crash sites (mostly in fragment table parsing), but I've honestly not done a lot of manual checking.
I've attached an archive with valgrind and strace output from each crash, each prepended with the filename which caused the crash. Unfortunately I can't upload the full archive of sample files here, as it ends up being a 150MB archive. I'll find an alternative upload location and post it as a comment shortly.
FNM_EXTMATCH error
on a void-linux-64, a musl-libc system:
unsquashfs.c: In function 'matches': unsquashfs.c:1442:35: error: 'FNM_EXTMATCH' undeclared (first use in this function) name, FNM_PATHNAME|FNM_PERIOD|FNM_EXTMATCH) ==
maybe this will help
FATAL ERROR:failed to read fragment table
Trying to extract a squashfs image which was extracted from a firmware bin but i get this error :
|read_fragment_table: failed to read fragment table block
FATAL ERROR:failed to read fragment table
i dont think the file is corrupted since it was extracted directly from the manufacture's firmware bin
maybe some trick ? that could be added to sasquatch if discovered
Does not compile
make -C ./LZMA/lzmalt
make: *** ./LZMA/lzmalt: No such file or directory. Stop.
make: *** [lzmalt] Error 2
script url to squashfs4.3 no longer exists
The link in the build script, no linger exists.
Where the heck is squashfs4.3
located these days?
https://downloads.sourceforge.net/project/squashfs/squashfs/squashfs4.3/squashfs4.3.tar.gz
could not create character device "foo" because you're not superuser!
Windows 7 under cygwin with XZ_SUPPORT disabled. what's the cause of this ?
SquashFS version [768.256] / inode count [1912733696] suggests a SquashFS image of a different endianess
Non-standard SquashFS Magic: qshs
Reading a different endian SQUASHFS filesystem on mtdblock3
Parallel unsquashfs: Using 1 processor
Trying to decompress using default gzip decompressor...
Trying to decompress with lzma...
Detected lzma compression
546 inodes (687 blocks) to write
create_inode: could not create character device squashfs-root/dev/console, because you're not superuser!
create_inode: could not create character device squashfs-root/dev/gpio, because you're not superuser!
create_inode: could not create character device squashfs-root/dev/led, because you're not superuser!
create_inode: could not create block device squashfs-root/dev/mtd, because you're not superuser!
create_inode: could not create character device squashfs-root/dev/mtd0, because you're not superuser!
create_inode: could not create character device squashfs-root/dev/mtd1, because you're not superuser!
create_inode: could not create character device squashfs-root/dev/mtd2, because you're not superuser!
create_inode: could not create character device squashfs-root/dev/mtd3, because you're not superuser!
create_inode: could not create character device squashfs-root/dev/mtd4, because you're not superuser!
create_inode: could not create character device squashfs-root/dev/mtd5, because you're not superuser!
create_inode: could not create block device squashfs-root/dev/mtdblock0, because you're not superuser!
create_inode: could not create block device squashfs-root/dev/mtdblock1, because you're not superuser!
create_inode: could not create block device squashfs-root/dev/mtdblock2, because you're not superuser!
create_inode: could not create block device squashfs-root/dev/mtdblock3, because you're not superuser!
create_inode: could not create block device squashfs-root/dev/mtdblock4, because you're not superuser!
create_inode: could not create block device squashfs-root/dev/mtdblock5, because you're not superuser!
create_inode: could not create character device squashfs-root/dev/null, because you're not superuser!
create_inode: could not create character device squashfs-root/dev/pmap, because you're not superuser!
create_inode: could not create character device squashfs-root/dev/ppp, because you're not superuser!
create_inode: could not create character device squashfs-root/dev/ptmx, because you're not superuser!
create_inode: could not create character device squashfs-root/dev/ptyp0, because you're not superuser!
create_inode: could not create character device squashfs-root/dev/ptyp1, because you're not superuser!
create_inode: could not create character device squashfs-root/dev/ptyp2, because you're not superuser!
create_inode: could not create character device squashfs-root/dev/qostype, because you're not superuser!
create_inode: could not create block device squashfs-root/dev/sda, because you're not superuser!
create_inode: could not create block device squashfs-root/dev/sda1, because you're not superuser!
create_inode: could not create block device squashfs-root/dev/sda2, because you're not superuser!
create_inode: could not create block device squashfs-root/dev/sdb, because you're not superuser!
create_inode: could not create block device squashfs-root/dev/sdb1, because you're not superuser!
create_inode: could not create block device squashfs-root/dev/sdb2, because you're not superuser!
create_inode: could not create character device squashfs-root/dev/tty, because you're not superuser!
create_inode: could not create character device squashfs-root/dev/tty0, because you're not superuser!
create_inode: could not create character device squashfs-root/dev/ttyS0, because you're not superuser!
create_inode: could not create character device squashfs-root/dev/ttyp0, because you're not superuser!
create_inode: could not create character device squashfs-root/dev/ttyp1, because you're not superuser!
create_inode: could not create character device squashfs-root/dev/ttyp2, because you're not superuser!
create_inode: could not create character device squashfs-root/dev/urandom, because you're not superuser!
create_inode: could not create character device squashfs-root/dev/watchdog, because you're not superuser!
create_inode: could not create character device squashfs-root/dev/zero, because you're not superuser!
648/687 94% ...
Doesn't build with docker latest ubuntu
I installed the required software packages but running ./build.sh gives the following errors
cc -g -O2 -I. -I./LZMA/lzma465/C -I./LZMA/lzmalt -I./LZMA/lzmadaptive/C/7zip/Compress/LZMA_Lib -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_GNU_SOURCE -DCOMP_DEFAULT=\"gzip\" -Wall -Werror -DGZIP_SUPPORT -DLZMA_SUPPORT -DXZ_SUPPORT -DLZO_SUPPORT -DXATTR_SUPPORT -DXATTR_DEFAULT -c -o xz_wrapper.o xz_wrapper.c
In file included from xz_wrapper.c:31:
xz_wrapper.h:50:2: error: unknown type name 'lzma_vli'
50 | lzma_vli id;
| ^~~~~~~~
xz_wrapper.h:56:2: error: unknown type name 'lzma_filter'
56 | lzma_filter filter[3];
| ^~~~~~~~~~~
xz_wrapper.h:64:2: error: unknown type name 'lzma_options_lzma'
64 | lzma_options_lzma opt;
| ^~~~~~~~~~~~~~~~~
xz_wrapper.c:35:11: error: 'LZMA_FILTER_X86' undeclared here (not in a function)
35 | { "x86", LZMA_FILTER_X86, 0 },
| ^~~~~~~~~~~~~~~
xz_wrapper.c:36:15: error: 'LZMA_FILTER_POWERPC' undeclared here (not in a function)
36 | { "powerpc", LZMA_FILTER_POWERPC, 0 },
| ^~~~~~~~~~~~~~~~~~~
xz_wrapper.c:37:12: error: 'LZMA_FILTER_IA64' undeclared here (not in a function)
37 | { "ia64", LZMA_FILTER_IA64, 0 },
| ^~~~~~~~~~~~~~~~
xz_wrapper.c:38:11: error: 'LZMA_FILTER_ARM' undeclared here (not in a function)
38 | { "arm", LZMA_FILTER_ARM, 0 },
| ^~~~~~~~~~~~~~~
xz_wrapper.c:39:16: error: 'LZMA_FILTER_ARMTHUMB' undeclared here (not in a function)
39 | { "armthumb", LZMA_FILTER_ARMTHUMB, 0 },
| ^~~~~~~~~~~~~~~~~~~~
xz_wrapper.c:40:13: error: 'LZMA_FILTER_SPARC' undeclared here (not in a function)
40 | { "sparc", LZMA_FILTER_SPARC, 0 },
| ^~~~~~~~~~~~~~~~~
xz_wrapper.c:41:10: error: 'LZMA_VLI_UNKNOWN' undeclared here (not in a function)
41 | { NULL, LZMA_VLI_UNKNOWN, 0 }
| ^~~~~~~~~~~~~~~~
xz_wrapper.c: In function 'xz_init':
xz_wrapper.c:404:21: error: request for member 'id' in something not a structure or union
404 | filter[0].filter[0].id = LZMA_FILTER_LZMA2;
| ^
xz_wrapper.c:404:27: error: 'LZMA_FILTER_LZMA2' undeclared (first use in this function)
404 | filter[0].filter[0].id = LZMA_FILTER_LZMA2;
| ^~~~~~~~~~~~~~~~~
xz_wrapper.c:404:27: note: each undeclared identifier is reported only once for each function it appears in
xz_wrapper.c:404:2: error: statement with no effect [-Werror=unused-value]
404 | filter[0].filter[0].id = LZMA_FILTER_LZMA2;
| ^~~~~~
xz_wrapper.c:405:21: error: request for member 'options' in something not a structure or union
405 | filter[0].filter[0].options = &stream->opt;
| ^
xz_wrapper.c:405:2: error: statement with no effect [-Werror=unused-value]
405 | filter[0].filter[0].options = &stream->opt;
| ^~~~~~
xz_wrapper.c:406:21: error: request for member 'id' in something not a structure or union
406 | filter[0].filter[1].id = LZMA_VLI_UNKNOWN;
| ^
xz_wrapper.c:406:2: error: statement with no effect [-Werror=unused-value]
406 | filter[0].filter[1].id = LZMA_VLI_UNKNOWN;
| ^~~~~~
xz_wrapper.c:413:23: error: request for member 'id' in something not a structure or union
413 | filter[j].filter[0].id = bcj[i].id;
| ^
xz_wrapper.c:413:4: error: statement with no effect [-Werror=unused-value]
413 | filter[j].filter[0].id = bcj[i].id;
| ^~~~~~
xz_wrapper.c:414:23: error: request for member 'id' in something not a structure or union
414 | filter[j].filter[1].id = LZMA_FILTER_LZMA2;
| ^
xz_wrapper.c:414:4: error: statement with no effect [-Werror=unused-value]
414 | filter[j].filter[1].id = LZMA_FILTER_LZMA2;
| ^~~~~~
xz_wrapper.c:415:23: error: request for member 'options' in something not a structure or union
415 | filter[j].filter[1].options = &stream->opt;
| ^
xz_wrapper.c:415:4: error: statement with no effect [-Werror=unused-value]
415 | filter[j].filter[1].options = &stream->opt;
| ^~~~~~
xz_wrapper.c:416:23: error: request for member 'id' in something not a structure or union
416 | filter[j].filter[2].id = LZMA_VLI_UNKNOWN;
| ^
xz_wrapper.c:416:4: error: statement with no effect [-Werror=unused-value]
416 | filter[j].filter[2].id = LZMA_VLI_UNKNOWN;
| ^~~~~~
xz_wrapper.c: In function 'xz_compress':
xz_wrapper.c:440:9: error: unknown type name 'lzma_ret'
440 | lzma_ret res = 0;
| ^~~~~~~~
xz_wrapper.c:449:13: error: implicit declaration of function 'lzma_lzma_preset' [-Werror=implicit-function-declaration]
449 | if(lzma_lzma_preset(&stream->opt, LZMA_PRESET_DEFAULT))
| ^~~~~~~~~~~~~~~~
xz_wrapper.c:449:44: error: 'LZMA_PRESET_DEFAULT' undeclared (first use in this function)
449 | if(lzma_lzma_preset(&stream->opt, LZMA_PRESET_DEFAULT))
| ^~~~~~~~~~~~~~~~~~~
xz_wrapper.c:452:14: error: request for member 'dict_size' in something not a structure or union
452 | stream->opt.dict_size = stream->dictionary_size;
| ^
xz_wrapper.c:452:3: error: statement with no effect [-Werror=unused-value]
452 | stream->opt.dict_size = stream->dictionary_size;
| ^~~~~~
xz_wrapper.c:455:9: error: implicit declaration of function 'lzma_stream_buffer_encode' [-Werror=implicit-function-declaration]
455 | res = lzma_stream_buffer_encode(filter->filter,
| ^~~~~~~~~~~~~~~~~~~~~~~~~
xz_wrapper.c:456:4: error: 'LZMA_CHECK_CRC32' undeclared (first use in this function)
456 | LZMA_CHECK_CRC32, NULL, src, size, filter->buffer,
| ^~~~~~~~~~~~~~~~
xz_wrapper.c:459:13: error: 'LZMA_OK' undeclared (first use in this function)
459 | if(res == LZMA_OK) {
| ^~~~~~~
xz_wrapper.c:459:10: error: comparison between pointer and integer [-Werror]
459 | if(res == LZMA_OK) {
| ^~
xz_wrapper.c:462:20: error: 'LZMA_BUF_ERROR' undeclared (first use in this function)
462 | } else if(res != LZMA_BUF_ERROR)
| ^~~~~~~~~~~~~~
xz_wrapper.c:462:17: error: comparison between pointer and integer [-Werror]
462 | } else if(res != LZMA_BUF_ERROR)
| ^~
xz_wrapper.c: In function 'xz_uncompress':
xz_wrapper.c:494:2: error: unknown type name 'lzma_ret'
494 | lzma_ret res = lzma_stream_buffer_decode(&memlimit, 0, NULL,
| ^~~~~~~~
xz_wrapper.c:494:17: error: implicit declaration of function 'lzma_stream_buffer_decode' [-Werror=implicit-function-declaration]
494 | lzma_ret res = lzma_stream_buffer_decode(&memlimit, 0, NULL,
| ^~~~~~~~~~~~~~~~~~~~~~~~~
xz_wrapper.c:497:12: error: 'LZMA_OK' undeclared (first use in this function)
497 | if(res == LZMA_OK && size == (int) src_pos)
| ^~~~~~~
xz_wrapper.c:497:9: error: comparison between pointer and integer [-Werror]
497 | if(res == LZMA_OK && size == (int) src_pos)
| ^~
cc1: all warnings being treated as errors
make: *** [<builtin>: xz_wrapper.o] Error 1
No way to compile (Linux Mint)
Hunk #1 succeeded at 32 with fuzz 1.
cc -fcommon -I. -I./LZMA/lzma465/C -I./LZMA/lzmalt -I./LZMA/lzmadaptive/C/7zip/Compress/LZMA_Lib -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_GNU_SOURCE -DCOMP_DEFAULT="gzip" -Wall -Werror -DGZIP_SUPPORT -DLZMA_SUPPORT -DXZ_SUPPORT -DLZO_SUPPORT -DXATTR_SUPPORT -DXATTR_DEFAULT -c -o unsquashfs.o unsquashfs.c
unsquashfs.c: In function ‘read_super’:
unsquashfs.c:1835:5: error: this ‘if’ clause does not guard... [-Werror=misleading-indentation]
1835 | if(swap)
| ^~
unsquashfs.c:1841:9: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘if’
1841 | read_fs_bytes(fd, SQUASHFS_START, sizeof(struct squashfs_super_block),
| ^~~~~~~~~~~~~
cc1: all warnings being treated as errors
make: *** [: unsquashfs.o] Erro 1
Debian / gcc / g++ gcc (Debian 10.2.0-15) 10.2.0 : fails to compile
On compilation, LD complains about multiple references to "verbose" at linking
Easy to solve, ensure in the patch that :
verbose is extern in sasquatch/squashfs4.3/squashfs-tools/error.h
add "int verbose;"
in unsquashfs.c
Error when build on debian 11
Hello,
When I try to compile squashcat on Debian 11 it gives an error
g++ ./LZMA/lzmalt/*.o unsquashfs.o unsquash-1.o unsquash-2.o unsquash-3.o unsquash-4.o swap.o compressor.o unsquashfs_info.o gzip_wrapper.o lzma_wrapper.o ./LZMA/lzma465/C/Alloc.o ./LZMA/lzma465/C/LzFind.o ./LZMA/lzma465/C/LzmaDec.o ./LZMA/lzma465/C/LzmaEnc.o ./LZMA/lzma465/C/LzmaLib.o xz_wrapper.o lzo_wrapper.o read_xattrs.o unsquashfs_xattr.o -lpthread -lm -lz -L./LZMA/lzmadaptive/C/7zip/Compress/LZMA_Lib -llzmalib -llzma -llzo2 -o sasquatch
/usr/bin/ld: unsquash-1.o:/home/hp/t10/sasquatch/squashfs4.3/squashfs-tools/error.h:34: multiple definition of `verbose'; unsquashfs.o:/home/hp/t10/sasquatch/squashfs4.3/squashfs-tools/error.h:34: first defined here
/usr/bin/ld: unsquash-2.o:/home/hp/t10/sasquatch/squashfs4.3/squashfs-tools/error.h:34: multiple definition of `verbose'; unsquashfs.o:/home/hp/t10/sasquatch/squashfs4.3/squashfs-tools/error.h:34: first defined here
/usr/bin/ld: unsquash-3.o:/home/hp/t10/sasquatch/squashfs4.3/squashfs-tools/error.h:34: multiple definition of `verbose'; unsquashfs.o:/home/hp/t10/sasquatch/squashfs4.3/squashfs-tools/error.h:34: first defined here
/usr/bin/ld: unsquash-4.o:/home/hp/t10/sasquatch/squashfs4.3/squashfs-tools/error.h:34: multiple definition of `verbose'; unsquashfs.o:/home/hp/t10/sasquatch/squashfs4.3/squashfs-tools/error.h:34: first defined here
/usr/bin/ld: compressor.o:/home/hp/t10/sasquatch/squashfs4.3/squashfs-tools/error.h:34: multiple definition of `verbose'; unsquashfs.o:/home/hp/t10/sasquatch/squashfs4.3/squashfs-tools/error.h:34: first defined here
/usr/bin/ld: unsquashfs_info.o:/home/hp/t10/sasquatch/squashfs4.3/squashfs-tools/error.h:34: multiple definition of `verbose'; unsquashfs.o:/home/hp/t10/sasquatch/squashfs4.3/squashfs-tools/error.h:34: first defined here
/usr/bin/ld: lzma_wrapper.o:/home/hp/t10/sasquatch/squashfs4.3/squashfs-tools/error.h:34: multiple definition of `verbose'; unsquashfs.o:/home/hp/t10/sasquatch/squashfs4.3/squashfs-tools/error.h:34: first defined here
/usr/bin/ld: read_xattrs.o:/home/hp/t10/sasquatch/squashfs4.3/squashfs-tools/error.h:34: multiple definition of `verbose'; unsquashfs.o:/home/hp/t10/sasquatch/squashfs4.3/squashfs-tools/error.h:34: first defined here
/usr/bin/ld: unsquashfs_xattr.o:/home/hp/t10/sasquatch/squashfs4.3/squashfs-tools/error.h:34: multiple definition of `verbose'; unsquashfs.o:/home/hp/t10/sasquatch/squashfs4.3/squashfs-tools/error.h:34: first defined here
collect2: error: ld returned 1 exit status
make: *** [Makefile:298: sasquatch] Błąd 1
please do not pollute my filesystem
You should not copy files over into my filesystem, especially in a script called build.sh. I could understand if install.sh did this.
Merge #18 for solving problem on C imports
Segmentation fault
Fails with this firmware:
http://downloads.linksys.com/downloads/firmware/1224681522523/FW_E900_v1.0.06.002_US_20150108.bin
When using -p 1
(single-threaded) this issue does not occur.
gdb --args ~/tmp/sasquatch/sasquatch -trace 14FE20.squashfs
...
squashfs: Attempting to decompress: [0x68 0x3B 0xDE 0xDE 0xA6 0x0F 0x23 0xDA]
squashfs: Trying LZMA settings [lc: 4, lp: 4, pb: 4, dict size: 0xFFFFFFFF offset: 10], squashfs: retval = -3, outsize = 131072/65536
squashfs: Attempting to decompress: [0x03 0xE0 0x35 0xE5 0x99 0xCB 0x0D 0x2B]
squashfs: Trying LZMA settings [lc: 4, lp: 4, pb: 2, dict size: 0xFFFFFFFF offset: 10], squashfs: retval = -3, outsize = 131072/65536
squashfs: Attempting to decompress: [0x03 0xE0 0x35 0xE5 0x99 0xCB 0x0D 0x2B]
squashfs: Trying LZMA settings [lc: 4, lp: 4, pb: 3, dict size: 0xFFFFFFFF offset: 10], squashfs: retval = -3, outsize = 131072/65536
squashfs: lzma-adaptive decompressor failed! [-1 -3]
Trying to decompress with lzma-alt...
squashfs: retval = -3, outsize = 131072/65536
squashfs: Attempting to decompress: [0x03 0xE0 0x35 0xE5 0x99 0xCB 0x0D 0x2B]
squashfs: Trying LZMA settings [lc: 4, lp: 4, pb: 4, dict size: 0xFFFFFFFF offset: 10], squashfs: retval = -3, outsize = 131072/65536
squashfs: lzma-adaptive decompressor failed! [-1 -3]
Trying to decompress with lzma-alt...
Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7ffff3f71700 (LWP 7417)]
0x0000000000405b2e in LzmaDecoderCodeReal (lzmaDecoder=0x647d20 <cc>, anInSize=0x7ffff3f60df0, anOutSize=0x7ffff3f60df8) at LZMADecoder.c:207
207 BYTE aMatchByte = OutWindowGetOneByte(0 - aRepDistances[0] - 1);
(gdb) i r
rax 0x8000f3f60e9f 140741581344415
rbx 0x10000 65536
rcx 0x0 0
rdx 0x7ffff3f60ea0 140737286377120
rsi 0x647f2c 6586156
rdi 0x7ffff4761d0d 140737294769421
rbp 0x7ffff4761d70 0x7ffff4761d70
rsp 0x7ffff4761ce0 0x7ffff4761ce0
r8 0xf2 242
r9 0x5 5
r10 0x4022 16418
r11 0x201 513
r12 0x5dab 23979
r13 0x7ffff4761ea0 140737294769824
r14 0x7ffff4771eac 140737294835372
r15 0x10000 65536
rip 0x405b2e 0x405b2e <LzmaDecoderCodeReal+325>
eflags 0x10206 [ PF IF RF ]
cs 0x33 51
ss 0x2b 43
ds 0x0 0
es 0x0 0
fs 0x0 0
gs 0x0 0
(gdb) bt
#0 0x0000000000405b2e in LzmaDecoderCodeReal (lzmaDecoder=0x647d20 <cc>, anInSize=0x7ffff4761df0, anOutSize=0x7ffff4761df8) at LZMADecoder.c:207
#1 0x0000000000406006 in LzmaDecoderCode (lzmaDecoder=0x647d20 <cc>, anInSize=0x7ffff4761df0, anOutSize=0x7ffff4761df8) at LZMADecoder.c:354
#2 0x00000000004041a4 in decompress_lzma_alt (in_data=0x83b160 "]", in_size=23979, out_data=0x7ffff4761ea0 "\177EL@ \362\065\065\065\065\065\065\065",
out_size=65536, offset=0) at 7zlzma.c:35
#3 0x0000000000410eb7 in lzma_alt_uncompress (dest=0x7ffff4761ea0, src=0x83b160, size=23979, outsize=65536, error=0x7ffff4771eac) at lzma_wrapper.c:139
#4 0x000000000040fb1e in compressor_uncompress (comp=0x647700 <gzip_comp_ops>, dest=dest@entry=0x7ffff4761ea0, src=0x83b160, size=23979, block_size=65536,
error=error@entry=0x7ffff4771eac) at compressor.c:170
#5 0x00000000004065ae in inflator (arg=<optimized out>) at unsquashfs.c:2195
#6 0x00007ffff7bc4182 in start_thread (arg=0x7ffff4772700) at pthread_create.c:312
#7 0x00007ffff6a7547d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:111
Bashism in build.sh
The UID check appears to be a bashism, as it doesn't run under sh
e.g.
$ if [ "$UID" == "0" ]
then
SUDO=""
else
SUDO="sudo"
fi> > > > >
sh: 6: [: unexpected operator
(actually, the problem is with the ==, which only works in double brackets)
failed to read uid/gid table
I am curently trying to extract a SquashFS filesystem of a firmware that I am working with for quite a while now. I had a lot of issues until this point but I managed to get a SquashFS file that looked promising to me.
When I first tried to extract it with the unsquashfs utility I got an error message. I guess this is a vendor hacked version.
So I tried to use sasquatch instead but I still get the following error message:
SquashFS version [4.0] / inode count [1957] suggests a SquashFS image of the same endianess Parallel unsquashfs: Using 1 processor read_uids_guids: failed to read id table block FATAL ERROR:failed to uid/gid table
Apparently there is something wrong with the id tables. Is there anything that I can do to work around this problem or is it not possible at all to extract the files like this?
Something that I also noticed is that the string ELF keeps popping up over the file system image.
Edit:
When I use the -s option of the unsquashfs utility I receive the following information:
Found a valid SQUASHFS 4:0 superblock on 0.squashfs. Creation or last append time Wed Nov 28 09:29:14 2018 Filesystem size 14015771 bytes (13687.28 Kbytes / 13.37 Mbytes) Compression lzo Block size 131072 Filesystem is exportable via NFS Inodes are compressed Data is compressed Uids/Gids (Id table) are compressed Fragments are compressed Always-use-fragments option is not specified Xattrs are compressed Duplicates are removed Number of fragments 69 Number of inodes 1957 Number of ids 5
‘if’ clause does not guard... [-Werror=misleading-indentation]
Error:
Hunk #1 succeeded at 32 with fuzz 1.
cc -g -O2 -I. -I./LZMA/lzma465/C -I./LZMA/lzmalt -I./LZMA/lzmadaptive/C/7zip/Compress/LZMA_Lib -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_GNU_SOURCE -DCOMP_DEFAULT=\"gzip\" -Wall -Werror -DGZIP_SUPPORT -DLZMA_SUPPORT -DXZ_SUPPORT -DLZO_SUPPORT -DXATTR_SUPPORT -DXATTR_DEFAULT -c -o unsquashfs.o unsquashfs.c
unsquashfs.c: In function ‘read_super’:
unsquashfs.c:1835:5: error: this ‘if’ clause does not guard... [-Werror=misleading-indentation]
1835 | if(swap)
| ^~
unsquashfs.c:1841:9: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘if’
1841 | read_fs_bytes(fd, SQUASHFS_START, sizeof(struct squashfs_super_block),
| ^~~~~~~~~~~~~
cc1: all warnings being treated as errors
make: *** [<builtin>: unsquashfs.o] Error 1
code from 1835 to 1845:
if(swap)
ERROR("Reading a different endian SQUASHFS filesystem on %s\n", source);
/*
* Try to read a Squashfs 4 superblock
*/
read_fs_bytes(fd, SQUASHFS_START, sizeof(struct squashfs_super_block),
&sBlk_4);
// CJH: swap detection already done generically above
//swap = sBlk_4.s_magic != SQUASHFS_MAGIC;
SQUASHFS_INSWAP_SUPER_BLOCK(&sBlk_4);
The patch doesn't apply to squashfs-tools-4.4
Is there any chance to fix the patch so it would be applied to squashfs-tools-4.4 ?
Errors when building for MacOS. 'sys/sysinfo.h' file not found
Running on MacOS Ventura: 13.6.2 (22G417)
./build.sh
gives this error after patching:
cc -g -O2 -I. -I./LZMA/lzma465/C -I./LZMA/lzmalt -I./LZMA/lzmadaptive/C/7zip/Compress/LZMA_Lib -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_GNU_SOURCE -DCOMP_DEFAULT=\"gzip\" -Wall -Werror -DGZIP_SUPPORT -DLZMA_SUPPORT -DXZ_SUPPORT -DLZO_SUPPORT -DXATTR_SUPPORT -DXATTR_DEFAULT -c -o unsquashfs.o unsquashfs.c
unsquashfs.c:34:10: fatal error: 'sys/sysinfo.h' file not found
#include <sys/sysinfo.h>
^~~~~~~~~~~~~~~
1 error generated.
make: *** [unsquashfs.o] Error 1
Error building for Ubuntu
Hunk #1 succeeded at 32 with fuzz 1. cc -g -O2 -I. -I./LZMA/lzma465/C -I./LZMA/lzmalt -I./LZMA/lzmadaptive/C/7zip/Compress/LZMA_Lib -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_GNU_SOURCE -DCOMP_DEFAULT=\"gzip\" -Wall -Werror -DGZIP_SUPPORT -DLZMA_SUPPORT -DXZ_SUPPORT -DLZO_SUPPORT -DXATTR_SUPPORT -DXATTR_DEFAULT -c -o unsquashfs.o unsquashfs.c unsquashfs.c: In function ‘read_super’: unsquashfs.c:1835:5: error: this ‘if’ clause does not guard... [-Werror=misleading-indentation] 1835 | if(swap) | ^~ unsquashfs.c:1841:9: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘if’ 1841 | read_fs_bytes(fd, SQUASHFS_START, sizeof(struct squashfs_super_block), | ^~~~~~~~~~~~~ cc1: all warnings being treated as errors
Hello i got such an error while installing the tool. It gave the same error on Ubuntu and Kali linux
Unable to extract squashfs
I am attempting to recover data from a flash chip removed from a proprietary device. I've dumped the chip and stripped out the OOB data.
Binwalk finds multiple squashfs partitions.
Sasquatch -s looks hopeful:
SquashFS version [4.0] / inode count [334] suggests a SquashFS image of the same endianess
Found a valid SQUASHFS 4:0 superblock on FF00000.squashfs.
Creation or last append time Mon Aug 9 13:01:47 2021
Filesystem size 15832.95 Kbytes (15.46 Mbytes) (16212941 [0xF763CD] bytes)
Compression lzma
Block size 262144
Filesystem is exportable via NFS
Inodes are compressed
Data is compressed
Fragments are compressed
Always-use-fragments option is specified
Xattrs are compressed
Duplicates are removed
Number of fragments 78
Number of inodes 334
Number of ids 1
sBlk.s.inode_table_start 0xf7430a
sBlk.s.directory_table_start 0xf75081
sBlk.s.fragment_table_start 0xf760ea
sBlk.s.lookup_table_start 0xf763b7
sBlk.s.id_table_start 0xf763c5
sBlk.s.xattr_id_table_start 0xffffffffffffffff
However attempting to extract files is failing:
sasquatch FF00000.squashfs
SquashFS version [4.0] / inode count [334] suggests a SquashFS image of the same endianess
Parallel unsquashfs: Using 1 processor
Trying to decompress using default lzma decompressor...
Trying to decompress with lzma-adaptive...
Trying to decompress with lzma-alt...
Trying to decompress with lzma-ddwrt...
Trying to decompress with lzo...
Trying to decompress with xz...
read_block: failed to read block @0xf75ef2
read_fragment_table: failed to read fragment table index
FATAL ERROR:failed to read fragment table
Any tips or pointers would be welcomed?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.