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 |
See cargo doc
, but here are some examples
```rust, ignore use std::fs::File; use std::env::args; use backhand::Squashfs;
// read let file = File::open("file.squashfs").unwrap(); let squashfs = Squashfs::fromreader(file).unwrap(); let filesystem = squashfs.intofilesystem().unwrap();
// write let bytes = filesystem.to_bytes().unwrap(); ```
```rust, ignore // add files let d = FilesystemHeader::default(); filesystem.pushfile("Fear is the mind-killer.", "a/d/e/newfile", d); filesystem.pushfile("It is by will alone I set my mind in motion.", "rootfile", 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!
```console
Usage: unsquashfs [OPTIONS]
Commands: extract-all Extract all files(Symlink/Files/Dirs) from image help Print this message or the help of the given subcommand(s)
Arguments: squashfs file
Options:
-o, --offset
```console Binary to add file to squashfs filesystem
Usage: add
Arguments:
Squashfs file
Options: -h, --help Print help information -V, --version Print version information ```