Ejemplo n.º 1
0
def unzipIPSW():
    devicemodel = str(localdevice.getmodel())

    arm64check = ('iPhone6,2')

    if any(ext in devicemodel for ext in arm64check):
        pwndfumode()

        restore64(devicemodel)
    else:
        print("ERROR: Unsupported model or device not connected!")
        exit(82)
Ejemplo n.º 2
0
def unzipIPSW(fname):

    if os.path.exists("custom.ipsw"):
        os.remove("custom.ipsw")

    print("Starting IPSW unzipping")
    outputFolder = os.getcwd()
    newpath = fname.rstrip()
    fname = str(newpath)
    testFile = os.path.exists(fname)

    while not testFile or not fname.endswith != (".ipsw"):
        print(
            "Invalid filepath/filename.\nPlease try again with a valid filepath/filename."
        )
        fname = input(
            "Enter the path to the IPSW file (Or drag and drop the IPSW into this window):\n"
        )
        newpath = fname.rstrip()
        fname = str(newpath)
        testFile = os.path.exists(fname)
    else:
        #Will now continue with new valid file
        print("Continuing...")
    if testFile and fname.endswith(".ipsw"):
        if os.path.exists("resources/restoreFiles/igetnonce"):
            shutil.move("resources/restoreFiles/igetnonce", "igetnonce")
        if os.path.exists("resources/restoreFiles/tsschecker"):
            shutil.move("resources/restoreFiles/tsschecker", "tsschecker")
        if os.path.exists("resources/restoreFiles/futurerestore"):
            shutil.move("resources/restoreFiles/futurerestore",
                        "futurerestore")
        if os.path.exists("resources/restoreFiles/irecovery"):
            shutil.move("resources/restoreFiles/irecovery", "irecovery")
        print("IPSW found at given path...")
        print("Cleaning up old files...")
        removeFiles()
        print("Unzipping..")
        with ZipFile(fname, 'r') as zip_ref:
            zip_ref.extractall(outputFolder)

        source = ("Firmware/dfu/")
        dest1 = os.getcwd()

        files = os.listdir(source)

        for f in files:
            shutil.move(source + f, dest1)
        devicemodel = str(localdevice.getmodel())
        t = localdevice.pick3264(devicemodel, fname)
        if t == 32:
            createCustomIPSW32(fname)
        elif t == 64:
            pwndfumode()
            createCustomIPSW64(fname, devicemodel)
        else:
            exit(2)

    else:
        print('\033[91m' + "ERROR: Not valid filepath...")
        print("ERROR: Try again" + '\033[0m')
Ejemplo n.º 3
0
def unzipIPSW_ORG(fname):  # from: vieux my1
    armv7 = [
        'iPhone4,1', 'iPad2,1', 'iPad2,2', 'iPad2,3', 'iPad2,4', 'iPad2,5',
        'iPad2,6', 'iPad2,7', 'iPod5,1'
    ]
    armv7s = [
        'iPhone5,1', 'iPhone5,2', 'iPad3,4', 'iPad3,5', 'iPad3,6', 'iPad3,1',
        'iPad3,2', 'iPad3,3'
    ]

    #if os.path.exists("custom.ipsw"):
    #os.remove("custom.ipsw")

    outputFolder = "IPSW"

    newpath = fname.rstrip()

    fname = str(newpath)

    testFile = os.path.exists(fname)

    if not os.path.exists('IPSW'):
        os.mkdir('IPSW')

    while not testFile or not fname.endswith != (".ipsw"):
        print(
            "Invalid filepath/filename.\nPlease try again with a valid filepath/filename."
        )

        fname = input(
            "Enter the path to the IPSW file (Or drag and drop the IPSW into this window):\n"
        )

        newpath = fname.rstrip()

        fname = str(newpath)

        testFile = os.path.exists(fname)

    if testFile and fname.endswith(".ipsw"):
        if not os.path.exists('IPSW'):
            removeFiles()

            with ZipFile(fname, 'r') as zip_ref:
                zip_ref.extractall(outputFolder)

            source = ("IPSW/Firmware/dfu/")

            dest1 = os.getcwd()

            files = os.listdir(source)

            for f in files:
                shutil.move(source + f, dest1)

        devicemodel = str(localdevice.getmodel())

        version = False
        supportedModels = str(readmanifest("IPSW/BuildManifest.plist",
                                           version))

        arm64check = ('iPhone6,2')

        if any(ext in devicemodel for ext in
               arm64check):  # devicemodel == NULL if something wrong
            pwndfumode()  # my1

            createCustomIPSW64(devicemodel)
        else:
            print("ERROR: Unsupported model or device not connected!")
            exit(82)
    else:
        print('\033[91m' + "Invalid filepath!")
Ejemplo n.º 4
0
def unzipIPSW(fname):
    armv7 = ['iPhone4,1']
    armv7s = ['iPhone5,1', 'iPhone5,2']

    if is_zipfile(fname): # First of all, check to see if fname is an actual ipsw, by verifying the file is a zip archive (ipsw's are just zip files).
        print(f'{fname} is a zip archive!')
    else:
        sys.exit(f'{fname} is not a zip archive! Are you sure you inserted the correct ipsw path?')

    if os.path.exists("custom.ipsw"):
        os.remove("custom.ipsw")

    print("Starting IPSW unzipping")
    outputFolder = "IPSW"
    newpath = fname.rstrip()
    fname = str(newpath)
    testFile = os.path.exists(fname)

    if os.path.exists('IPSW'):
        shutil.rmtree('IPSW')
        os.mkdir('IPSW')
    elif not os.path.exists('IPSW'):
        os.mkdir('IPSW')

    while not testFile or not fname.endswith!=(".ipsw"):
        print("Invalid filepath/filename.\nPlease try again with a valid filepath/filename.")
        fname = input("Enter the path to the IPSW file (Or drag and drop the IPSW into this window):\n")
        newpath = fname.rstrip()
        fname = str(newpath)
        testFile = os.path.exists(fname)

    else:
        print("Continuing...")

    if testFile and fname.endswith(".ipsw"):
        if os.path.exists("resources/bin/igetnonce"):
            shutil.move("resources/bin/igetnonce", "igetnonce")
        if os.path.exists("resources/bin/tsschecker"):
            shutil.move("resources/bin/tsschecker", "tsschecker")
        if os.path.exists("resources/bin/futurerestore"):
            shutil.move("resources/bin/futurerestore", "futurerestore")
        if os.path.exists("resources/bin/irecovery"):
            shutil.move("resources/bin/irecovery", "irecovery")

        print("IPSW found at given path...")
        print("Cleaning up old files...")
        removeFiles()
        print("Unzipping..")

        with ZipFile(fname, 'r') as zip_ref:
            zip_ref.extractall(outputFolder)
        source = ("IPSW/Firmware/dfu/")
        dest1 = os.getcwd()

        files = os.listdir(source)

        for f in files:
            shutil.move(source + f, dest1)
        devicemodel = str(localdevice.getmodel())
        version = False
        supportedModels = str(readmanifest("IPSW/BuildManifest.plist", version))

        if supportedModels in armv7:
            createCustomIPSW32(fname)

        else:
            if supportedModels in armv7s:
                createCustomIPSW32(fname)

            else:
                arm64check = ('iPhone6,1', 'iPhone6,2', 'iPad4,1', 'iPad4,2', 'iPad4,3', 'iPad4,4', 'iPad4,5')

                if any(ext in supportedModels for ext in arm64check):
                    if any(ext in devicemodel for ext in arm64check):
                        pwndfumode()
                        createCustomIPSW64(fname, devicemodel)

                    else:
                        print("ERROR: Unsupported model...\nExiting...")
                        exit(82)

                else:
                    print("ERROR: Unsupported model...\nExiting...")
                    exit(82)

    else:
        print('\033[91m' + "ERROR: Not valid filepath...")
        print("ERROR: Try again" + '\033[0m')