Example #1
0
def create_ipsw():
    utils.log('Verifying IPSW. This may take a while, please wait...', True)
    is_stock = ipsw.verify_ipsw(device_identifier, args.version[0],
                                args.ipsw[0], buildid, is_verbose)
    if not is_stock:
        sys.exit(
            f'[ERROR] IPSW {args.ipsw[0]} is not verified! Redownload your IPSW, and try again.\nExiting...'
        )

    utils.log('IPSW verified! Extracting IPSW...', True)
    ipsw.extract_ipsw(args.ipsw[0], is_verbose)

    utils.log('IPSW extracted! Patching bootchain...', True)
    patch.patch_bootchain(firmware_bundle, firm_bundle_number, buildid,
                          is_verbose)

    utils.log(
        'Bootchain patched! Grabbing latest LLB and iBoot to put into custom IPSW...',
        True)
    ipsw.grab_latest_llb_iboot(device_identifier, args.version[0],
                               firmware_bundle, firm_bundle_number, is_verbose)

    utils.log(
        'Packing everything into custom IPSW. This may take a while, please wait...',
        True)
    ipsw_name = ipsw.make_ipsw(firmware_bundle, is_verbose)

    utils.log(f'Done!\nCustom IPSW at: {ipsw_name}', True)

    if not args.restore:
        utils.cleanup(True)

    return ipsw_name
Example #2
0
def restore_ipsw(fresh_ipsw, ipsw_path):
    processor = ipsw.fetch_processor(firmware_bundle)

    if fresh_ipsw:
        utils.log('------------RESTORE-BEGINNING------------', False)
        utils.log('Restoring freshly created custom IPSW', is_verbose)
    else:
        utils.log('Inferius Restore Log', False)
        utils.log('Checking if IPSW is custom...', False)
        is_stock = ipsw.verify_ipsw(device_identifier, args.version[0], ipsw_path, buildid, is_verbose)
        if is_stock:
            utils.log('[ERROR] IPSW is stock!\nExiting...', False)
            sys.exit()

    if args.update:
        keep_data = True
    else:
        keep_data = False

    device_check = input('Is your device is connected in Pwned DFU mode with signature checks removed? [Y/N]: ')
    utils.log(f'Is your device is connected in Pwned DFU mode with signature checks removed? [Y/N]: {device_check}', False)

    if not 'y' in device_check.lower():
        utils.log('[ERROR] Specified device is not in pwndfu!\nExiting...', is_verbose)
        sys.exit()

    lsusb = subprocess.run('./resources/bin/lsusb', stdout=subprocess.PIPE, universal_newlines=True, shell=True)
    utils.log(lsusb.stdout, False)

    if not 'Apple Mobile Device (DFU Mode)' in lsusb.stdout:
        utils.log('[ERROR] Specified device is not in pwndfu!\nExiting...', is_verbose)
        sys.exit()

    os.makedirs('work/ipsw', exist_ok=True)
    utils.log('Fetching some required info...', True)
    restore.save_blobs(device_identifier, firm_bundle_number, board_configs, downgrade_10, is_verbose)

    utils.log('Extracting iBSS and iBEC from custom IPSW...', True)
    ibss_path, ibec_path = ipsw.extract_bootchain(ipsw_path, firmware_bundle, firm_bundle_number, is_verbose)

    utils.log('Signing iBSS and iBEC with SHSH blob...', True)
    restore.sign_bootchain(ibss_path, ibec_path, is_verbose)

    utils.log('Preparations done! Beginning restore...', True)
    if downgrade_10:
        ipsw.fetch_1033_sepbb(device_identifier, args.version[0], is_verbose)

    restore.send_bootchain(processor, is_verbose)
    futurerestore = restore.restore(ipsw_path, ipsw.is_cellular(device_identifier), keep_data, downgrade_10, is_verbose)
    if not futurerestore:
        sys.exit()
    else:
        utils.cleanup(True)

    utils.log('Done.\nExiting...', True)
Example #3
0
#!/usr/bin/env python3

from resources import ipsw, patch, restore, utils
import argparse
import atexit
import glob
import json
import os
import platform
import requests
import subprocess
import sys
import time

atexit.register(utils.cleanup)
utils.cleanup()

if not platform.system() == 'Darwin':
    sys.exit('[ERROR] This script can only be ran on macOS. Please run this on a macOS computer.\nExiting...')

if not platform.architecture()[0] == '64bit':
    sys.exit('[ERROR] This script can only be ran on a 64bit computer.\nExiting...')

parser = argparse.ArgumentParser(description='Inferius - Create custom IPSWs for your 64bit iOS device!', usage="./inferius.py -d 'device' -i 'iOS version' -f 'IPSW' [-c/-r] [-v]")
parser.add_argument('-c', '--create', help='Create custom IPSW', action='store_true')
parser.add_argument('-d', '--device', help='Device identifier (e.g. iPhone10,2)', nargs=1)
parser.add_argument('-f', '--ipsw', help='Path to custom IPSW', nargs=1)
parser.add_argument('-i', '--version', help='The version of your stock IPSW', nargs=1)
parser.add_argument('-r', '--restore', help='Restore custom IPSW after creation', action='store_true')
parser.add_argument('-u', '--update', help='Restore device without losing data (requires --restore)', action='store_true')
parser.add_argument('-v', '--verbose', help='Print verbose output for debugging', action='store_true')
Example #4
0
#!/usr/bin/env python3

from resources import ipsw, patch, restore, utils
import argparse
import atexit
import os
import platform
import subprocess
import sys

atexit.register(utils.cleanup)
utils.cleanup(True)

if not platform.system() == 'Darwin':
    sys.exit(
        '[ERROR] This script can only be ran on macOS. Please run this on a macOS computer.\nExiting...'
    )

if not platform.architecture()[0] == '64bit':
    sys.exit(
        '[ERROR] This script can only be ran on a 64bit computer.\nExiting...')

parser = argparse.ArgumentParser(
    description='Inferius - Create custom IPSWs for your 64bit iOS device!',
    usage="./inferius.py -d 'device' -i 'iOS version' -f 'IPSW' [-c/-r] [-v]")
parser.add_argument('-c',
                    '--create',
                    help='Create custom IPSW',
                    action='store_true')
parser.add_argument('-d',
                    '--device',