backhand
Library and binaries for the reading, creating, and modification of SquashFS file systems.
| :warning: WARNING |
|---|
| The API for this library isn't complete. I will most likely break this for improvements |
Library
See cargo doc, but here are some examples
Reading + Writing Firmware
use File;
use args;
use Squashfs;
// read
let file = open.unwrap;
let squashfs = from_reader.unwrap;
let filesystem = squashfs.into_filesystem.unwrap;
// write
let bytes = filesystem.to_bytes.unwrap;
Modifying Firmware
// add files
let d = default;
filesystem.push_file;
filesystem.push_file;
// modify file
let file = filesystem.mut_file.unwrap;
file.bytes = b"The sleeper must awaken.\n".to_vec;
// write
let bytes = filesystem.to_bytes.unwrap;
Testing
This library is tested with unpacking and packing SquashFS firmwares and testing that result with unsquashfs.
openwrt binaries are primarily being tested.
Binaries
These are currently under development and are missing features, MR's welcome!
unsquashfs
Usage: unsquashfs [OPTIONS] <INPUT> <COMMAND>
Commands:
extract-all Extract all files(Symlink/Files/Dirs) from image
help Print this message or the help of the given subcommand(s)
Arguments:
<INPUT> squashfs file
Options:
-o, --offset <OFFSET> [default: 0]
-h, --help Print help information
-V, --version Print version information
add
Binary to add file to squashfs filesystem
Usage: add <INPUT> <FILE> <FILE_PATH>
Arguments:
<INPUT> Squashfs file
<FILE>
<FILE_PATH>
Options:
-h, --help Print help information
-V, --version Print version information