Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- clone the repo
- git clone https://github.com/devttys0/sasquatch.git
- then cd in to sasquatch directory
- the README mentions this as a pre-req, so do this
- sudo apt-get install build-essential liblzma-dev liblzo2-dev zlib1g-dev
- if you run ./build.sh at this point you will get a bunch of errors related to xz_wrapper and LZMA
- eventually it ends in something like this:
- 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: 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:503:1: error: control reaches end of non-void function [-Werror=return-type]
- 503 | }
- | ^
- cc1: all warnings being treated as errors
- make: *** [<builtin>: xz_wrapper.o] Error 1
- open the patch file in ./patches/patch0.txt and find this section
- # To build using XZ Utils liblzma - install the library and uncomment
- # the XZ_SUPPORT line below.
- #
- -#XZ_SUPPORT = 1
- +XZ_SUPPORT = 1
- It will be around line 38087 of the 38726, so pretty close to the bottom of the file
- change the line from
- +XZ_SUPPORT = 1
- to
- +XZ_SUPPORT = 0
- then run ./build.sh again
- this time it works successfully and end in something like this
- make[1]: Entering directory '/AC1200/sasquatch/squashfs4.3/squashfs-tools/LZMA/lzmadaptive/C/7zip/Compress/LZMA_Lib'
- make[1]: Nothing to be done for 'all'.
- make[1]: Leaving directory '/AC1200/sasquatch/squashfs4.3/squashfs-tools/LZMA/lzmadaptive/C/7zip/Compress/LZMA_Lib'
- 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 -DLZO_SUPPORT -DXATTR_SUPPORT -DXATTR_DEFAULT -c -o lzma_wrapper.o lzma_wrapper.c
- 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 lzo_wrapper.o read_xattrs.o unsquashfs_xattr.o -lpthread -lm -lz -L./LZMA/lzmadaptive/C/7zip/Compress/LZMA_Lib -llzmalib -llzo2 -o sasquatch
- mkdir -p /usr/local/bin
- cp sasquatch /usr/local/bin
- now when you run binwalk on the firmware dump file it will extract as expected
- binwalk -eM flash.bin
- now the squashfs-root directory contains the files from the router
- notably, check out the passwd and shadow files
- $ find . | egrep "passwd|shadow"
- ./squashfs-root/etc_ro/passwd
- ./squashfs-root/etc_ro/passwd_private
- ./squashfs-root/etc_ro/shadow
- ./squashfs-root/etc_ro/shadow_private
- ./squashfs-root/usr/bin/passwd
- ./squashfs-root/usr/sbin/chpasswd
- ./squashfs-root/var/etc/passwd
- ./squashfs-root/var/etc/passwd_private
- ./squashfs-root/var/etc/shadow
- ./squashfs-root/var/etc/shadow_private
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement