#!/usr/bin/env python3 """trust-append-module.py IN OUT CDHASH [CDHASH ...]: copy a trust bundle (bundle-ipsw-trust.py layout) and append one version-2 module with the given CDHashes (hash type 2). The IPSW modules stay byte for byte; the kernel loads the new one as an engineering module.""" import struct import sys import uuid from pathlib import Path if len(sys.argv) < 4: sys.exit(__doc__) data = Path(sys.argv[1]).read_bytes() count = struct.unpack_from(' {len(modules)} modules, last has {len(hashes)} hashes')