Advertisement
metalx1000

Working with Firmware BIN files - wifi pineapple example

Oct 6th, 2013
431
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.52 KB | None | 0 0
  1. wget "http://wifipineapple.com/index.php?downloads&downloadUpgrade=2.8.0" -O upgrade.bin
  2.  
  3. binwalk upgrade.bin  
  4.  
  5. example output:
  6. DECIMAL     HEX         DESCRIPTION
  7. -------------------------------------------------------------------------------------------------------
  8. 0           0x0         Squashfs filesystem, little endian, version 4.0, compression:  size: 5197504 bytes,  1579 inodes, blocksize: 262144 bytes, created: Sun Mar  3 08:24:39 2013
  9. 6291456     0x600000    uImage header, header size: 64 bytes, header CRC: 0xD22A6633, created: Sun Mar  3 08:24:44 2013, image size: 913361 bytes, Data Address: 0x80060000, Entry Point: 0x80060000, data CRC: 0x3085D0DC, OS: Linux, CPU: MIPS, image type: OS Kernel Image, compression type: lzma, image name: "MIPS OpenWrt Linux-3.7.9"
  10. 6291520     0x600040    LZMA compressed data, properties: 0x6D, dictionary size: 8388608 bytes, uncompressed size: 2808940 bytes
  11.  
  12.  
  13.  
  14. we want the first partition in this case, so we will extract it using ‘dd
  15.  
  16. dd if=upgrade.bin of=pineapple.img bs=1 count=5197504 #the 5197504 is from the binwalk output.
  17.  
  18. unsquashfs pineapple.img #creates and extracts to folder ‘squashfs-root’
  19.  
  20.  
  21. If you want to put the extracted files into an img file:
  22. du squashfs-root #find out how big the squashfs-root dir is (Just over 20M in this case)
  23. dd bs=512 count=50000 if=/dev/zero of=openwrt.img #creates a empty IMG file that is about 26M
  24.  
  25. mkdir op
  26. sudo mount -o loop openwrt.img op
  27. sudo cp -pfr squashfs-root/* op/   #copies with permissions intact
  28. sudo umount op
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement