Extractor-Kernel and filesystem extractor.
Introduction
This is a recursive firmware extractor that aims to extract a kernel image and/or compressed filesystem from a Linux-based firmware image. A number of heuristics are included to avoid extraction of certain blacklisted file types, and to avoid unproductive extraction beyond certain breadth and depth limitations.Firmware images with multiple filesystems are not fully supported; this tool cannot reassemble them and will instead extract the first filesystem that has sufficient UNIX-like root directories (e.g.
/bin
, /etc/
, etc.)For the impatients: Dockerize all the things!
- Install Docker
- Run the dockerized extractor
git clone https://github.com/firmadyne/extractor.git
cd extractor
./extract.sh path/to/firmware.img path/to/output/directory
Dependencies Please use the latest version of
binwalk
. Note that there are two Python modules that both share the name python-magic
; both should be usable, but only the one linked above has been tested extensively.Binwalk When installing
binwalk
, it is optional to use the forked version of the sasquatch
tool, which has been modified to make SquashFS file extraction errors fatal to prevent false positives.During execution, the extractor will temporarily extract files into Usage
/tmp
while recursing. Since firmware images can be large, preferably mount this mount point as tmpfs
backed by a large amount of memory, to optimize performance.To preserve filesystem permissions during extraction, while avoiding execution with root privileges, wrap execution of this extractor within
fakeroot
. This will emulate privileged operations.
Post a Comment