Nitescu Lucian
Nitescu Lucian

Reputation: 285

Extracting from bin file

So I tried this:

root@kali:~/Desktop/fmk# binwalk upgrade-2.4.0.bin 

DECIMAL       HEXADECIMAL     DESCRIPTION
--------------------------------------------------------------------------------
512           0x200           LZMA compressed data, properties: 0x6D, dictionary size: 8388608 bytes, uncompressed size: 2805816 bytes
927576        0xE2758         Squashfs filesystem, little endian, version 4.0, compression:xz, size: 12316692 bytes, 2963 inodes, blocksize: 262144 bytes, created: 2015-08-04 02:40:49

And then I used the following dd:

sudo dd if=upgrade-2.4.0.bin of=pineapple.squashfs bs=1 count=12316692

And I can't unsquashfs pineapple.squashfs. Can't find a SQUASHFS superblock on pineapple.squashfs

Upvotes: 2

Views: 7862

Answers (2)

sinkmanu
sinkmanu

Reputation: 1102

You have to set the offset where the squashfs is

Usage: dd [OPERAND]...
   or:  dd OPTION
Copy a file, converting and formatting according to the operands.

   bs=BYTES        read and write up to BYTES bytes at a time
   cbs=BYTES       convert BYTES bytes at a time
   conv=CONVS      convert the file as per the comma separated symbol list
   count=N         copy only N input blocks
   ibs=BYTES       read up to BYTES bytes at a time (default: 512)
   if=FILE         read from FILE instead of stdin
   iflag=FLAGS     read as per the comma separated symbol list
   obs=BYTES       write BYTES bytes at a time (default: 512)
   of=FILE         write to FILE instead of stdout
   oflag=FLAGS     write as per the comma separated symbol list
   seek=N          skip N obs-sized blocks at start of output
   skip=N          skip N ibs-sized blocks at start of input
   status=LEVEL    The LEVEL of information to print to stderr;
                   'none' suppresses everything but error messages,
                   'noxfer' suppresses the final transfer statistics,
                   'progress' shows periodic transfer statistics

...

So, to extract the filesystem

dd if=upgrade-2.4.0.bin of=pineapple.squashfs bs=1 skip=927576

Upvotes: 1

Nitescu Lucian
Nitescu Lucian

Reputation: 285

I did it with:

binwalk -Me upgrade-2.4.0.bin

Upvotes: 1

Related Questions