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
Add the following to your Cargo.toml file:
[]
= "0.9.1"
Reading/Writing/Modifying Firmware
use File;
use Cursor;
use ;
// read
let file = open.unwrap;
let read_filesystem = from_reader.unwrap;
// convert to writer
let mut write_filesystem = from_fs_reader.unwrap;
// add file with data from slice
let d = default;
let bytes = new;
write_filesystem.push_file;
// add file with data from file
let new_file = open.unwrap;
write_filesystem.push_file;
// modify file
let bytes = new;
write_filesystem.replace_file.unwrap;
// write into a new file
let mut output = create.unwrap;
write_filesystem.write.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!
To install, run cargo install backhand.
unsquashfs
tool to uncompress, extract and list squashfs filesystems
Usage: unsquashfs [OPTIONS] <FILESYSTEM>
Arguments:
<FILESYSTEM> Squashfs file
Options:
-o, --offset <BYTES> Skip BYTES at the start of FILESYSTEM [default: 0]
-l, --list List filesystem, do not write to DEST
-d, --dest <PATHNAME> Extract to [PATHNAME] [default: squashfs-root]
-i, --info Print files as they are extracted
-f, --force If file already exists then overwrite
-s, --stat Display filesystem superblock information
-h, --help Print help information
-V, --version Print version information
add
tool to add files to squashfs filesystems
Usage: add <FILESYSTEM> <FILE> <FILE_PATH>
Arguments:
<FILESYSTEM> Squashfs file
<FILE>
<FILE_PATH>
Options:
-h, --help Print help information
-V, --version Print version information