A IMG2/IMG3 parser

Overview

oldimgtool

A img2/3 parser, made in rust

Usage

oldimgtool [OPTIONS] <INPUT> [OUTPUT]

Arguments:
    <INPUT>     Input filename
    <OUTPUT>    Output filename

Options:
    -2                         (IMG2 only) Keep the IMG2 header, but remove the S5L header
    -a                         Output all info about the image
    -d                         Only decrypt, do not extract (overrides -e)
    -e                         Only extracts, do not decompress (only applies to kernel)
    -h, --help                 Print help information
        --iv <IV>              Specify iv for decryption
    -k, --key <KEY|IVKEY>      Specify key for decryption
    -m, --create <S5L|IMG3>    Create a image with a image type (setters will be used)
    -v, --verify               Verify the image
        --version              Print version information

Getters:
    -b               Output keybags
    -c <FILE>        Save the cert chain to a file
    -s <FILE>        Save the signature to a file
    -t               Output image type
        --ver        Print version in IMG3

Setters:
    -B                          Only set the keybag, do not encrypt
    -C <FILE>                   Set or replace the cert chain from a file
    -D <TYPE>                   Set or replace the data buffer from a file
    -K <IV> <KEY> <TYPE>        Set the keybag and encrypt data with it, type can be prod or dev
    -S <FILE>                   Set or replace the signature from a file
    -T <TYPE>                   Set or rename the image type (4cc)
    -V <VERSION>                Set the version string in IMG3

Examples

Extracting a image:
oldimgtool applelogo@2x~iphone.s5l8950x.img3 logo.bin

Extracting a image using a decryption IV and keys:
oldimgtool --iv e8744b87c6b4c134c00432a5b8af302b -k 7b2764a96f1ab43ebc73e2167c774cefaed671d5c4522bae12d7e0e9da3e7e3a iBoot.n94ap.RELEASE.img3 iboot.bin

Extracting a image's keybags:
oldimgtool -b iBoot.n94ap.RELEASE.img3

Verifying a image's integrity and output the image's type:
oldimgtool -v -t iBoot.n94ap.RELEASE.img3

Building

First, install cargo if you haven't already, instructions are here. Then, run cargo install, and finally use it with oldimgtool.

Credits

  • iphone-dataprotection for the IMG3 SHSH verifier logic
  • @pingw33n for the LZSS decoder made in Rust
You might also like...
A XML parser written in Rust

RustyXML Documentation RustyXML is a namespace aware XML parser written in Rust. Right now it provides a basic SAX-like API, and an ElementBuilder bas

A CSV parser for Rust, with Serde support.

csv A fast and flexible CSV reader and writer for Rust, with support for Serde. Dual-licensed under MIT or the UNLICENSE. Documentation https://docs.r

High-performance browser-grade HTML5 parser

html5ever API Documentation html5ever is an HTML parser developed as part of the Servo project. It can parse and serialize HTML according to the WHATW

A native Rust port of Google's robots.txt parser and matcher C++ library.

robotstxt A native Rust port of Google's robots.txt parser and matcher C++ library. Native Rust port, no third-part crate dependency Zero unsafe code

Rust parser combinator framework

nom, eating data byte by byte nom is a parser combinators library written in Rust. Its goal is to provide tools to build safe parsers without compromi

url parameter parser for rest filter inquiry
url parameter parser for rest filter inquiry

inquerest Inquerest can parse complex url query into a SQL abstract syntax tree. Example this url: /person?age=lt.42&(student=eq.true|gender=eq.'M')&

Parsing Expression Grammar (PEG) parser generator for Rust

Parsing Expression Grammars in Rust Documentation | Release Notes rust-peg is a simple yet flexible parser generator that makes it easy to write robus

A fast monadic-style parser combinator designed to work on stable Rust.

Chomp Chomp is a fast monadic-style parser combinator library designed to work on stable Rust. It was written as the culmination of the experiments de

A parser combinator library for Rust

combine An implementation of parser combinators for Rust, inspired by the Haskell library Parsec. As in Parsec the parsers are LL(1) by default but th

LR(1) parser generator for Rust

LALRPOP LALRPOP is a Rust parser generator framework with usability as its primary goal. You should be able to write compact, DRY, readable grammars.

The Elegant Parser

pest. The Elegant Parser pest is a general purpose parser written in Rust with a focus on accessibility, correctness, and performance. It uses parsing

A typed parser generator embedded in Rust code for Parsing Expression Grammars

Oak Compiled on the nightly channel of Rust. Use rustup for managing compiler channels. You can download and set up the exact same version of the comp

Rust query string parser with nesting support

What is Queryst? This is a fork of the original, with serde and serde_json updated to 0.9 A query string parsing library for Rust inspired by https://

A fast, extensible, command-line arguments parser

parkour A fast, extensible, command-line arguments parser. Introduction 📚 The most popular argument parser, clap, allows you list all the possible ar

Soon to be AsciiDoc parser implemented in rust!

pagliascii "But ASCII Doc, I am Pagliascii" Soon to be AsciiDoc parser implemented in rust! This project is the current implementation of the requeste

Super-fast float parser in Rust

fast-float This crate provides a super-fast decimal number parser from strings into floats.

Neural network transition-based dependency parser (in Rust)

dpar Introduction dpar is a neural network transition-based dependency parser. The original Go version can be found in the oldgo branch. Dependencies

Get JSON values quickly - JSON parser for Rust
Get JSON values quickly - JSON parser for Rust

get json values quickly GJSON is a Rust crate that provides a fast and simple way to get values from a json document. It has features such as one line

Pure-Rust rewrite of the Linux fontconfig library (no system dependencies) - using ttf-parser and allsorts

rust-fontconfig Pure-Rust rewrite of the Linux fontconfig library (no system dependencies) - using allsorts as a font parser in order to parse .woff,

Owner
plx
@plzdonthaxme
plx
A low-level gltf parser implemented on nanoserde

Goth-gltf aims to be a low-level, unopinionated reader for glTF files. In comparison with gltf-rs, it: Represents the glTF JSON structure transparentl

Ashley 18 Dec 27, 2022
Yet Another Parser library for Rust. A lightweight, dependency free, parser combinator inspired set of utility methods to help with parsing strings and slices.

Yap: Yet another (rust) parsing library A lightweight, dependency free, parser combinator inspired set of utility methods to help with parsing input.

James Wilson 117 Dec 14, 2022
Website for Microformats Rust parser (using 'microformats-parser'/'mf2')

Website for Microformats Rust parser (using 'microformats-parser'/'mf2')

Microformats 5 Jul 19, 2022
A language parser tool to build recursive descent top down parser.

lang-pt A language parser tool to generate recursive descent top down parser. Overview Parsers written for the languages like Javascript are often cus

Creative Forest 7 Jan 4, 2023
Djotters is a Djot parser and translater written via parser combinators, in rust.

?? Djotters Turning your Djot (markdown) into lovely HTML! Djotters is here to let you draft up a document and watch it render in real time. If you wa

Anthony Alaribe 4 Mar 26, 2024
Rust DLT (Diagnostic Log and Trace) packet parser

dlt_parse A zero allocation rust library for basic parsing & writing DLT (Diagnostic Log and Trace) packets. Currently only the parsing and writing of

Julian Schmid 23 Dec 16, 2022
Rust dbc parser

can-dbc A CAN-dbc format parser written with Rust's nom parser combinator library. 1. Example Read dbc file and generate Rust structs based on the mes

Marcel 38 Dec 19, 2022
A full featured, fast Command Line Argument Parser for Rust

clap Command Line Argument Parser for Rust It is a simple-to-use, efficient, and full-featured library for parsing command line arguments and subcomma

null 10.4k Jan 10, 2023
Docopt for Rust (command line argument parser).

THIS CRATE IS UNMAINTAINED This crate is unlikely to see significant future evolution. The primary reason to choose this crate for a new project is if

null 743 Jan 1, 2023
JSON parser which picks up values directly without performing tokenization in Rust

Pikkr JSON parser which picks up values directly without performing tokenization in Rust Abstract Pikkr is a JSON parser which picks up values directl

Pikkr 615 Dec 29, 2022