# image4-util [![Crate][crate-image]][crate-link] Pure Rust tool for handling [Image4](https://www.theiphonewiki.com/wiki/IMG4_File_Format) files (aka IMG4, IM4P, IM4M, IM4R). ## Features - Extract payload contents from either Image4 containers (IMG4) or Image4 payload files (IM4P). - Create either full Image4 containers or Image4 payload files. - Decrypt encrypted images using known AES key and IV. - Decompress images compressed using LZSS and LZFSE (LZVN is not supported yet). - Parse, create and sign Image4 manifests. Both signed and unsigned manifests are supported. - Create certificates for signing Image4 manifests. ## Installation ```shell cargo install image4-util ``` ## Logging The logging implementation is based on the [`env_logger`](https://crates.io/crates/env_logger) crate. There are 3 log levels: `info`, `warn` and `error` (non-release builds support the `debug` log level). By default, only `warning` and `error` levels are enabled. You can set a different minimum log level using the `IMAGE4_LOG` environment variable (set to `off` to turn off the logging completely). ### Example: By default `image4-util` isn't verbose: ```shell $ image4-util extract --iv xxx --key xxx -v llb.im4p [?] File at llb.bin exists. Do you want to replace it? yes $ ``` It's quite verbose, however, if you enable the `info` log level. ```shell $ IMAGE4_LOG=info image4-util extract --iv xxx --key xxx llb.im4p [*] Extracting file at 'llb.im4p' to 'llb.bin'. [*] 4CC tag: illb [*] Builder string: iBoot-7429.41.5 [?] File at llb.bin exists. Do you want to replace it? yes [*] Decompressed 606278 bytes into 1319704 bytes. [*] Success. $ ``` Here instead of `xxx` will be your actual key and IV. ## Minimum Supported Rust Version This crate requires at least **Rust 1.65**. An MSRV change will be accompanied by a minor version bump ## License Licensed under either of * Apache License, Version 2.0 ([LICENSE-APACHE](LICENSE-APACHE) or http://www.apache.org/licenses/LICENSE-2.0) * MIT license ([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT) at your option. ## Contribution Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions. [crate-image]: https://img.shields.io/crates/v/image4-util.svg [crate-link]: https://crates.io/crates/image4-util [docs-rs-image]: https://docs.rs/image4-util/badge.svg [docs-rs-link]: https://docs.rs/image4-util/