question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

whether binwalk don't extract the binary files correctly or something wrong with bin package

See original GitHub issue

I download firmware of D’link DIR-645 from here

ftp://ftp2.dlink.com/PRODUCTS/DIR-645/REVA/DIR-645_FIRMWARE_1.04.B11.ZIP

When I use binwalk to extract the firmware directly:

$ binwalk -Me DIR-645_FIRMWARE_1.04.B11.ZIP

Scan Time:     2018-09-19 19:40:43
Target File:   /home//DIR645A1_FW104B11.bin
MD5 Checksum:  76705b8eff53bace85a0b79d6e1b44dc
Signatures:    344

DECIMAL       HEXADECIMAL     DESCRIPTION
--------------------------------------------------------------------------------
0             0x0             DLOB firmware header, boot partition: "dev=/dev/mtdblock/2"
112           0x70            LZMA compressed data, properties: 0x5D, dictionary size: 33554432 bytes, uncompressed size: 4237652 bytes
1441904       0x160070        PackImg section delimiter tag, little endian size: 2121216 bytes; big endian size: 6168576 bytes
1441936       0x160090        Squashfs filesystem, little endian, version 4.0, compression:lzma, size: 6164554 bytes, 2205 inodes, blocksize: 262144 bytes, created: 2013-06-14 07:05:15


Scan Time:     2018-09-19 19:40:44
Target File:   /home/_DIR645A1_FW104B11.bin.extracted/70
MD5 Checksum:  ab12ea2766e23c7e63734d658f0cd446
Signatures:    344

DECIMAL       HEXADECIMAL     DESCRIPTION
--------------------------------------------------------------------------------
3334176       0x32E020        Linux kernel version "2.6.33.2 (joely@109) (gcc version 4.3.3 (GCC) ) #2 Thu Jun 13 17:58:38 CST 2013"
3394528       0x33CBE0        CRC32 polynomial table, little endian
3763227       0x396C1B        Unix path: /S70/S75/505V/F505/F707/F717/P8
3799832       0x39FB18        Neighborly text, "NeighborSolicitstunnel6 init(): can't add protocol"
3799852       0x39FB2C        Neighborly text, "NeighborAdvertisementst add protocol"
3803667       0x3A0A13        Neighborly text, "neighbor %.2x%.2x.%.2x:%.2x:%.2x:%.2x:%.2x:%.2x lost on port %d(%s)(%s)"

I got filesystem below:

$ ls -lh _DIR645A1_FW104B11.bin.extracted/squashfs-root/

total 52K
drwxr-xr-x  2 broderna broderna 4.0K Jun 14  2013 bin
drwxr-xr-x  9 broderna broderna 4.0K Jun 14  2013 dev
drwxr-xr-x 16 broderna broderna 4.0K Jun 14  2013 etc
lrwxrwxrwx  1 broderna broderna    9 Sep 19 19:40 home -> /var/home
drwxr-xr-x 14 broderna broderna 4.0K Jun 14  2013 htdocs
drwxr-xr-x  2 broderna broderna 4.0K Jun 14  2013 include
drwxr-xr-x  4 broderna broderna 4.0K Jun 14  2013 lib
drwxr-xr-x  2 broderna broderna 4.0K Jun 14  2013 mnt
drwxr-xr-x  2 broderna broderna 4.0K Jun 14  2013 proc
drwxr-xr-x  2 broderna broderna 4.0K Jun 14  2013 sbin
drwxr-xr-x  2 broderna broderna 4.0K Jun 14  2013 sys
lrwxrwxrwx  1 broderna broderna    8 Sep 19 19:40 tmp -> /var/tmp
drwxr-xr-x  5 broderna broderna 4.0K Jun 14  2013 usr
drwxr-xr-x  2 broderna broderna 4.0K Jun 14  2013 var
drwxr-xr-x  2 broderna broderna 4.0K Jun 14  2013 www

But I can not find any html pages except etc/admin-root/index.html:

$ cd _DIR645A1_FW104B11.bin.extracted/squashfs-root/
$ find -name *htm*

./htdocs/phplib/html.php
./htdocs/web/webaccess/webfile_images/html.png
./etc/admin-root/index.html
./etc/l7-protocols/file_types/html.pat

So, is there something wrong with Binwalk or just no html pages in DIR645A1_FW104B11.bin?

Issue Analytics

  • State:open
  • Created 5 years ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
E3V3Acommented, Nov 27, 2018

@joingh123 I’m no longer sure what you need to do. But to emulate PHP, should be easy since it’s a scripting language and all you need to do, is tracking down any calls to system binaries and try to replace them with fake input or ones suitable for your OS.

I just don’t know how to emulate this firmware

Ha! If you’re trying to emulate the entire DIR router, I doubt you can do that since its completely different HW. But you should be able to emulate the processor and most of the non-HW specific binaries. Perhaps you’re having trouble with QEMU (like everyone else has because of crappy techno-jargon documentation) , in which case I suggest you open a ticket with their annoying email list issue tracker system.

0reactions
joingh123commented, Nov 30, 2018

@E3V3A That a good idea! Thanks a lot! LOL

Read more comments on GitHub >

github_iconTop Results From Across the Web

Binwalk not extracting files from binary - Stack Overflow
Above command instructs Binwalk to extract any file type. It seems Binwalk with -e just extract files with known or complete header.
Read more >
binary analysis - Binwalk could not extract the full content
1 Answer 1 ... If the output of the Binwalk is not explicit enough, it is worth to see the content of the...
Read more >
How To Open BIN Files | .BIN File Opener Tools
This Tutorial Explains What is a .BIN File. You will learn How to Open BIN Files with & without using a Program, Convert...
Read more >
How to extract bios bin file - sono naturale
Bin File : A Binary or BIN file in Ubuntu refers to installation packages that ... destination dir… no matter how I specify...
Read more >
Forensics · CTF Field Guide
MacOS is not a bad environment to substitute for Linux, if you can accept that some ... Here are some examples of working...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found