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.

Binwalk recursively extracting files without respecting tree structure to the extracted folder

See original GitHub issue

Binwalk is recursively extracting all the files inside the subfolders to the _firmware-name.extracted/folder instead of respecting the directory structure and then placing the files inside squashfs-root.

Output below :

root@kali:# binwalk -e Dlink_firmware.bin 

DECIMAL       HEXADECIMAL     DESCRIPTION
--------------------------------------------------------------------------------
48            0x30            Unix path: /dev/mtdblock/2
96            0x60            uImage header, header size: 64 bytes, header CRC: 0x7FE9E826, created: 2010-11-23 11:58:41, image size: 878029 bytes, Data Address: 0x80000000, Entry Point: 0x802B5000, data CRC: 0x7C3CAE85, OS: Linux, CPU: MIPS, image type: OS Kernel Image, compression type: lzma, image name: "Linux Kernel Image"
160           0xA0            LZMA compressed data, properties: 0x5D, dictionary size: 33554432 bytes, uncompressed size: 2956312 bytes
917600        0xE0060         PackImg section delimiter tag, little endian size: 7348736 bytes; big endian size: 2256896 bytes
917632        0xE0080         Squashfs filesystem, little endian, non-standard signature, version 3.0, size: 2256151 bytes, 1119 inodes, blocksize: 65536 bytes, created: 2010-11-23 11:58:47

root@kali:# ls _Dlink_firmware.bin.extracted/
[                                            h_adv_dmz.php                          qos.sh
0                                            h_adv_firewall.php                     qos.xml
0ro                                          h_adv_mac_filter.php                   random
1                                            h_adv_network.php                      rcS
1ro                                          h_adv_port.php                         reboot
2                                            h_adv_qos.php                          __rebooting_msg.php
2ro                                          h_adv_routing.php                      Reboot.php

The above is happening with all the firmwares and not just for this specific example. At the same time, the extract-firmware.sh is working perfectly and extracting the files correctly in the subfolder tree structure.

Binwalk version : Binwalk v2.1.2b Tried using both the github version, as well as the kali repo one. Any pointers will be highly appreciated.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:1
  • Comments:10

github_iconTop GitHub Comments

2reactions
LuKePiccicommented, May 28, 2020

I simply uninstalled p7zip, so it’s clearly something that should be fixed in binwalk.

The screenshot is from the good old htop in tree view.

0reactions
vincentcoxcommented, May 29, 2020

Thanks for the reply!

The screenshot is from the good old htop in tree view.

I still learn Linux every day!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Use binwalk to extract all files - Stack Overflow
Now I want to extract all these files to see the real contents of them. I try the command binwalk -e music.mp3 but...
Read more >
Firmware dump extraction with binwalk and bsdtar
It's therefore worth re-running binwalk to recursively extract contents from the firmware dump: $ binwalk -Me W25Q32_endoscope_merged.eeprom ...
Read more >
binwalk man - Linux Command Library
binwalk linux command man page: tool for searching binary images for embedded files and ... Extract files from a binary, specifying the output...
Read more >
binwalk on reversing switch firmware
first i extract the .bin file from the switch and use binwalk to analyse. but it shows nothing. then i rename the bin...
Read more >
Towards Automatic Firmware Extraction From Update ...
This is useful for further filtering the applications from which it is not possible to extract the binary files directly, thus speeding up...
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