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 |
Add the following to your Cargo.toml file:
toml
[dependencies]
backhand = "0.7.0"
```rust, ignore use std::fs::File; use backhand::{Filesystem, FilesystemHeader};
// read let file = File::open("file.squashfs").unwrap(); let mut filesystem = Filesystem::from_reader(file).unwrap();
// add file with data from slice let d = FilesystemHeader::default(); let bytes = &mut b"Fear is the mind-killer.".asslice(); filesystem.pushfile(bytes, "a/d/e/new_file", d);
// add file with data from file let mut newfile = File::open("dune").unwrap(); filesystem.pushfile(&mut new_file, "/root/dune", d);
// modify file let file = filesystem.mutfile("/a/b/c/d/e/firstfile").unwrap(); file.bytes = b"The sleeper must awaken.\n".to_vec();
// write let bytes = filesystem.to_bytes().unwrap(); ```
This library is tested with unpacking and packing SquashFS firmwares and testing that result with unsquashfs.
openwrt binaries are primarily being tested.
These are currently under development and are missing features, MR's welcome!
To install, run cargo install backhand.
```console tool to uncompress, extract and list squashfs filesystems
Usage: unsquashfs [OPTIONS]
Arguments:
Options:
-o, --offset
```console tool to add files to squashfs filesystems
Usage: add
Arguments:
Options: -h, --help Print help information -V, --version Print version information ```