Jump to content
aelius

Tool pentru analiza imagini routere (firmware)

Recommended Posts

Ma plictiseam la cafea si cautam cu ce sa ma joc, asa ca am dat de binwalk

1. Descarcam binwalk si extragem fisierele din arhiva


root@pluto:~# wget https://github.com/devttys0/binwalk/archive/v1.3.0.tar.gz
root@pluto:~# tar zxvf v1.3.0.tar.gz
root@pluto:~# cd binwalk-1.3.0/

2. Instalam dependintele principale pentru binwalk cat si ceva tool-uri pentru dezarhivare


root@pluto:~/binwalk-1.3.0# apt-get install python-magic
root@pluto:~/binwalk-1.3.0# apt-get install libfuzzy2
root@pluto:~/binwalk-1.3.0# apt-get install python-opengl python-qt4 python-qt4-gl python-numpy python-scipy
root@pluto:~/binwalk-1.3.0# apt-get install mtd-utils zlib1g-dev liblzma-dev ncompress gzip bzip2 tar arj p7zip p7zip-full openjdk-6-jdk squashfs-tools
root@pluto:~/binwalk-1.3.0# wget http://www.pyqtgraph.org/downloads/pyqtgraph-0.9.8.tar.gz
root@pluto:~/binwalk-1.3.0# tar zxvf pyqtgraph-0.9.8.tar.gz
root@pluto:~/binwalk-1.3.0# cd pyqtgraph-0.9.8/
root@pluto:~/binwalk-1.3.0/pyqtgraph-0.9.8# python setup.py install

3. Instalam binwalk


root@pluto:~/binwalk-1.3.0/pyqtgraph-0.9.8# cd ../src/
root@pluto:~/binwalk-1.3.0/src# python setup.py install

4. Stergem arhiva si directorul cu sursele din care am compilat


root@pluto:~/binwalk-1.3.0/src# cd
root@pluto:~# rm -rf v1.3.0.tar.gz binwalk-1.3.0/

5. Sa facem cateva teste pe o imagine de Router luata de pe dd wrt


root@pluto:~# su - marian
marian@pluto:~$ cd work/
marian@pluto:~/work$ wget ftp://ftp.dd-wrt.com/stable/dd-wrt.v23/standard/dd-wrt.v23_generic.bin

marian@pluto:~/work$ binwalk dd-wrt.v23_generic.bin

DECIMAL HEX DESCRIPTION
-------------------------------------------------------------------------------------------------------------------
0 0x0 TRX firmware header, little endian, header size: 28 bytes, image size: 3522560 bytes, CRC32: 0x54888AF2 flags: 0x0, version: 1
28 0x1C gzip compressed data, maximum compression, from Unix, NULL date: Thu Jan 1 01:00:00 1970
2264 0x8D8 LZMA compressed data, properties: 0x5D, dictionary size: 8388608 bytes, uncompressed size: 1941504 bytes
604396 0x938EC Squashfs filesystem, little endian, version 2.1, size: 2912869 bytes, 793 inodes, blocksize: 65536 bytes, created: Sun Dec 25 17:00:26 2005

6. Ce ne intereseaza pe noi, este in filesystem. O sa extragem tot ce este dupa 604396 cu dd-ul intr-o imagine.


marian@pluto:~/work$ dd if=dd-wrt.v23_generic.bin bs=1 skip=604396 of=ddwrt.squashfs
2918164+0 records in
2918164+0 records out
2918164 bytes (2.9 MB) copied, 2.72447 s, 1.1 MB/s

7. Sa vedem cum arata imaginea extrasa cu dd-ul spre diferenta de cea originala.


marian@pluto:~/work$ binwalk ddwrt.squashfs

DECIMAL HEX DESCRIPTION
-------------------------------------------------------------------------------------------------------------------
0 0x0 Squashfs filesystem, little endian, version 2.1, size: 2912869 bytes, 793 inodes, blocksize: 65536 bytes, created: Sun Dec 25 17:00:26 2005
marian@pluto:~/work$ file ddwrt.squashfs
ddwrt.squashfs: Squashfs filesystem, little endian, version 2.1, 2912869 bytes, 793 inodes, blocksize: 65536 bytes, created: Sun Dec 25 17:00:26 2005

De aici cred ca va puteti juca si voi (squashfs/unsquashfs). Sfanta documentatie o puteti gasi aici: Wiki | Binwalk

Spor la joaca ;-)

Edited by aelius
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...