Giter VIP home page Giter VIP logo

ipsw_keys's Introduction

This script was originally written by @MCJack123, posted on this Gist: https://gist.github.com/MCJack123/b7ded5a4b2a221e13dd3492f2971ae34

How to use this

  1. Download the script to the same folder as ipwndfu
  2. Boot the device in DFU mode and run checkm8 exploit
  3. Run the script using the arguments listed below

Usage

Usage: ipsw_key.py <-i <input>|-d <identifier>> [-ajpw] [-v <version>] [-b <bdid>] [options] [-a] [-o <output>]
Extracts iOS encryption keys from an IPSW using a physical device's AES engine.

Required arguments:
    -d, --device <identifier>    Device identifier to download IPSW for
    -i, --input <input>          Local IPSW file to read from
    -o, --output <output>        Location to store output keys
    
Optional arguments:
    -a, --auto-name              Automatically name output based on version and device, and save in folder at <output> if specified
    -b, --bdid <bdid>            Use a custom board ID instead of the current device's BDID
    -h, --help                   Show this help prompt
    -j, --json                   Store output as JSON file
    -p, --plist                  Store output as property list file
    -v, --version <version>      Version of iOS to download (without this, downloads all versions and implies -a)
    -w, --wiki                   Format output for iPhone Wiki upload

Examples

  • ./ipsw_keys.py -d iPad4,5 -v 12.4.2 --auto-name - Downloads the keys for iOS 12.4.2 for iPad4,5 to iPad4,5_12.4.2_16G114_Keys.json
  • ./ipsw_keys.py -d iPhone5,1 -o iPhone5Keys -w - Downloads the keys for all versions for iPhone5,1 to iPhone5Keys/iPhone5,1_<version>_<build>_Keys.wiki
  • ./ipsw_keys.py -i iPhone10,3,iPhone10,6_12.4.1_16G102_Restore.ipsw -o iPhoneXKeys_12.4.1.plist --plist - Extracts keys from iPhone10,3,iPhone10,6_12.4.1_16G102_Restore.ipsw to iPhoneXKeys_12.4.1.plist

Notes

  • If you specify -d without -v, all iOS versions will be downloaded, and -a is implied. THIS WILL TAKE A LONG TIME!
  • If you specify -a, the -o option will instead be used for the output folder. In this case, you can skip -o to save in the current directory.
  • This will not get the keys for the RootFS before 10.0 since it was stored in a different non-IMG4 format that I can't parse. These keys are mostly available on the iPhone Wiki anyway, so it shouldn't matter too much; plus, iOS 10 and later don't encrypt the RootFS at all.
  • The output JSON and plist files will be in a format similar to this:
{
    "BatteryLow0": {
        "Path": "Firmware/all_flash/batterylow0@2x~ipad.im4p",
        "Encrypted": false
    },
    [...]
    "iBSS": {
        "Path": "Firmware/dfu/iBSS.ipad4b.RELEASE.im4p",
        "Encrypted": true,
        "IV": "00112233445566778899aabbccddeeff",
        "Key": "00112233445566778899aabbccddeeff00112233445566778899aabbccddeeff"
    }
}

ipsw_keys's People

Contributors

mcjack123 avatar nicolas17 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

ipsw_keys's Issues

Error fetching keys for the iOS 16.0 beta

Hey Nicolas, i get this when i try to get keys for the iOS 16 beta. but the script works fine for earlier firmware versions. <15.x

OS: Ubuntu 20.04 LTS
Device: iPhone 8 Plus (D21AP) - T8015

Here's the console log, any resolution or advice would be appreciated. thanks!

daniel@DansPPC2011:~/Documents/ipwndfuA11$ ./ipswkeys.py -i '/media/daniel/1402A75102A736A0/Users/Daniel/Downloads/Beta Firmware/iPhone_4.7_P3_16.0_20A5283p_Restore.ipsw' -w -o ~/Desktop/Keys/A11/SydneySeed_20A5283p_iPhone10,1.txt -m iPhone10,1 -b 02
Found:CPID:8015 CPRV:11 CPFM:03 SCEP:01 BDID:04 ECID:0000000000000000 IBFL:3C SRTG:[iBoot-3332.0.0.1.23] PWND:[checkm8]
Reading manifest...
Reading keys...
Traceback (most recent call last):
  File "./ipswkeys.py", line 549, in <module>
    extractKeys(inputName, outputName, outtype=outputType, delete=inputDevice != None, infodict=infoDict)
  File "./ipswkeys.py", line 224, in extractKeys
    output.update(convertKeys(zip, identity, identityType))
  File "./ipswkeys.py", line 200, in convertKeys
    kbag = getRawKeybag(zipfile.read(v["Info"]["Path"]))
  File "./ipswkeys.py", line 150, in getRawKeybag
    dec = asn1_node_next(der, asn1_node_next(der, asn1_node_next(der, asn1_node_first_child(der, asn1_node_root(der)))))
  File "./ipswkeys.py", line 32, in asn1_node_next
    return asn1_read_length(der,ixl+1)
  File "./ipswkeys.py", line 101, in asn1_read_length
    first= ord(der[ix+1])
IndexError: cannot fit 'long' into an index-sized integer

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.