Take the 2-minute tour ×
Reverse Engineering Stack Exchange is a question and answer site for researchers and developers who explore the principles of a system through analysis of its structure, function, and operation. It's 100% free, no registration required.

I am trying to extract the squashfs filesystem of my router. Here is firmware.

First, I unzipped the file. Next, I ran binwalk to get some information about the file.

DECIMAL     HEX         DESCRIPTION
-------------------------------------------------------------------------------------------------------
58          0x3A        TRX firmware header, little endian, header size: 28 bytes,  image size: 6656000 bytes, CRC32: 0x2B1713B2 flags/version: 0x10000
86          0x56        LZMA compressed data, properties: 0x5D, dictionary size: 65536 bytes, uncompressed size: 3614368 bytes
1282426     0x13917A    Squashfs filesystem, little endian, non-standard signature,  version 3.0, size: 5367357 bytes,  853 inodes, blocksize: 65536 bytes, created: Wed Aug  7 05:08:47 2013 

I then ran binwalk -e to extract the contents of the file. I got three files:

.
├── 13917A.squashfs
├── 56
└── 56.7z

Running unsquashfs on 13917A.squashfs failed, saying it was unable to find the magic block. This was because the file was using a non standard magic. Changing the magic to a standard one made unsquashfs and file detect it as a squashfs file system. But unsquashfs did not complete successfully:

caff@UbunutuX2:~/Netgear/test$ unsquashfs 13917A.squashfs 
Reading a different endian SQUASHFS filesystem on 13917A.squashfs
Filesystem on 13917A.squashfs is (768:0), which is a later filesystem version than I support!

I also tried extracting the file system by using Jeremy Collake’s Firmware Mod Kit. This failed also:

caff@UbunutuX2:~/Netgear/test$ /opt/firmware-mod-kit/trunk/unsquashfs_all.sh 13917A.squashfs 
Attempting to extract SquashFS .X file system...


Trying ./src/others/squashfs-3.4-nb4/unsquashfs-lzma... Skipping others/squashfs-hg55x-bin (wrong version)...
File extraction failed!

How do I extract this squashfs file system?

share|improve this question

1 Answer 1

up vote 2 down vote accepted

After unziping the arhive, run binwalk with

binwalk -eM *.chm

Flag e stands for extract automatically,and M for --matryoshka or recursively scanning and extracting.

After a few recursive unpackings, you'll get a squashfs-root dir with what you want I guess.

For what it's worth, I tried this with binwalk version 1.2.1.

share|improve this answer
    
Thanks! It must be my binwalk version. The one in the Ubuntu repositories is V1.0. –  caffinatedmonkey Apr 7 at 16:45
    
Thanks! Seems to have worked. –  caffinatedmonkey Apr 7 at 16:49

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.