Exemple #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)
Exemple #2
0
def createCustomIPSW64(devicemodel):  # my2
    print("Starting iBSS/iBEC patching")

    patch_folder = Path("resources/patches/")

    phoneibec = patch_folder / "ibec5s.patch"  #

    phoneibss = patch_folder / "ibss5s.patch"  #

    version = True
    versionManifest = readmanifest("IPSW/BuildManifest.plist", version)
    version = False

    deviceManifest = readmanifest("IPSW/BuildManifest.plist", version)

    #--------------------------------------------------------------------------
    bsdiff4.file_patch_inplace("iBEC.iphone6.RELEASE.im4p", phoneibec)

    bsdiff4.file_patch_inplace("iBSS.iphone6.RELEASE.im4p", phoneibss)

    device = "iPhone5s"

    print("iBSS/iBEC patched")

    #--------------------------------------------------------------------------
    print("Re-building IPSW")

    shutil.move("iBEC.iphone6.RELEASE.im4p", "IPSW/Firmware/dfu/")
    shutil.move("iBSS.iphone6.RELEASE.im4p", "IPSW/Firmware/dfu/")

    shutil.move("IPSW/Firmware/Mav7Mav8-7.60.00.Release.bbfw",
                "resources/other/baseband.bbfw")

    shutil.move("IPSW/Firmware/all_flash/sep-firmware.n53.RELEASE.im4p",
                "resources/other/sep.im4p")

    touch("IPSW/Firmware/usr/local/standalone/blankfile")

    with ZipFile('custom.ipsw', 'w') as zipObj2:
        os.chdir("IPSW")

        zipObj2.write('Restore.plist')

        zipObj2.write('kernelcache.release.iphone8b')

        zipObj2.write('kernelcache.release.iphone6')

        zipObj2.write('BuildManifest.plist')

        zipObj2.write('058-75381-062.dmg')

        zipObj2.write('058-74940-063.dmg')

        zipObj2.write('058-74917-062.dmg')

        zipObj2.write('._058-74917-062.dmg')  # !!!

        for folderName, subfolders, filenames in os.walk("Firmware"):
            for filename in filenames:
                filePath = os.path.join(folderName, filename)

                zipObj2.write(filePath)

        os.chdir("..")

        if os.path.exists("IPSW/custom.ipsw"):
            shutil.move("IPSW/custom.ipsw", "custom.ipsw")  # main dir

    restore64(devicemodel)
Exemple #3
0
def createCustomIPSW64(fname, devicemodel):
    print("Starting iBSS/iBEC patching")
    patch_folder = Path("resources/patches/")
    phoneibec = patch_folder / "ibec5s.patch"
    phoneibss = patch_folder / "ibss5s.patch"
    ipadminiibec = patch_folder / "ibec_ipad4b.patch"
    ipadminiibss = patch_folder / "ibss_ipad4b.patch"
    ipadairibec = patch_folder / "ibec_ipad4.patch"
    ipadairibss = patch_folder / "ibss_ipad4.patch"
    if "iPhone" in fname and "10.3.3" in fname:
        print("Looks like you are downgrading an iPhone 5s to 10.3.3!")
        bsdiff4.file_patch_inplace("iBEC.iphone6.RELEASE.im4p", phoneibec)
        bsdiff4.file_patch_inplace("iBSS.iphone6.RELEASE.im4p", phoneibss)
        device = "iPhone5s"
    elif "iPad" in fname and "10.3.3" in fname:
        if devicemodel == "iPad4,1" or devicemodel == "iPad4,2" or devicemodel == "iPad4,3":
            print("Looks like you are downgrading an iPad Air to 10.3.3!")
            bsdiff4.file_patch_inplace("iBEC.ipad4.RELEASE.im4p", ipadairibec)
            bsdiff4.file_patch_inplace("iBSS.ipad4.RELEASE.im4p", ipadairibss)
            device = "iPadAir"
        elif devicemodel == "iPad4,4" or devicemodel == "iPad4,5":
            print("Looks like you are downgrading an iPad Mini 2 to 10.3.3!")
            bsdiff4.file_patch_inplace("iBEC.ipad4b.RELEASE.im4p",
                                       ipadminiibec)
            bsdiff4.file_patch_inplace("iBSS.ipad4b.RELEASE.im4p",
                                       ipadminiibss)
            device = "iPadMini"
        else:
            print(
                "ERROR: Unknown input. Exiting purely because you can't read and that's sad..."
            )
            print("ERROR: Exiting...")
            exit(1)
    else:
        print(
            "Varible 'device' was not set. Please make sure IPSW file name is default/device is connected and try again"
        )
        exit(55555)

    print("Patched iBSS/iBEC")
    print("About to re-build IPSW")

    if device == "iPhone5s":
        shutil.move("iBEC.iphone6.RELEASE.im4p", "Firmware/dfu/")
        shutil.move("iBSS.iphone6.RELEASE.im4p", "Firmware/dfu/")
        shutil.move("Firmware/Mav7Mav8-7.60.00.Release.bbfw",
                    "resources/restoreFiles/baseband.bbfw")
        if devicemodel == "iPhone6,1":
            shutil.move("Firmware/all_flash/sep-firmware.n51.RELEASE.im4p",
                        "resources/restoreFiles/sep.im4p")
        elif devicemodel == "iPhone6,2":
            shutil.move("Firmware/all_flash/sep-firmware.n53.RELEASE.im4p",
                        "resources/restoreFiles/sep.im4p")
        touch("Firmware/usr/local/standalone/blankfile")
        with ZipFile('custom.ipsw', 'w') as zipObj2:
            zipObj2.write('Restore.plist')
            zipObj2.write('kernelcache.release.iphone8b')
            zipObj2.write('kernelcache.release.iphone6')
            zipObj2.write('BuildManifest.plist')
            zipObj2.write('058-75381-062.dmg')
            zipObj2.write('058-74940-063.dmg')
            zipObj2.write('058-74917-062.dmg')
            zipObj2.write('._058-74917-062.dmg')
            for folderName, subfolders, filenames in os.walk("Firmware"):
                for filename in filenames:
                    filePath = os.path.join(folderName, filename)
                    zipObj2.write(filePath)
        restore64(devicemodel)

    elif device == "iPadAir" or device == "iPadMini":
        if devicemodel == "iPad4,1" or devicemodel == "iPad4,2" or devicemodel == "iPad4,3":
            shutil.move("iBEC.ipad4.RELEASE.im4p", "Firmware/dfu/")
            shutil.move("iBSS.ipad4.RELEASE.im4p", "Firmware/dfu/")
            if devicemodel == "iPad4,1":
                shutil.move("Firmware/all_flash/sep-firmware.j71.RELEASE.im4p",
                            "resources/restoreFiles/sep.im4p")
            elif devicemodel == "iPad4,2":
                shutil.move("Firmware/all_flash/sep-firmware.j72.RELEASE.im4p",
                            "resources/restoreFiles/sep.im4p")
                shutil.move("Firmware/Mav7Mav8-7.60.00.Release.bbfw",
                            "resources/restoreFiles/baseband.bbfw")
            elif devicemodel == "iPad4,3":
                shutil.move("Firmware/all_flash/sep-firmware.j73.RELEASE.im4p",
                            "resources/restoreFiles/sep.im4p")
                shutil.move("Firmware/Mav7Mav8-7.60.00.Release.bbfw",
                            "resources/restoreFiles/baseband.bbfw")
        elif devicemodel == "iPad4,4" or devicemodel == "iPad4,5":
            shutil.move("iBEC.ipad4b.RELEASE.im4p", "Firmware/dfu/")
            shutil.move("iBSS.ipad4b.RELEASE.im4p", "Firmware/dfu/")
            if devicemodel == "iPad4,4":
                shutil.move("Firmware/all_flash/sep-firmware.j85.RELEASE.im4p",
                            "resources/restoreFiles/sep.im4p")
            elif devicemodel == "iPad4,5":
                shutil.move("Firmware/all_flash/sep-firmware.j86.RELEASE.im4p",
                            "resources/restoreFiles/sep.im4p")
                shutil.move("Firmware/Mav7Mav8-7.60.00.Release.bbfw",
                            "resources/restoreFiles/baseband.bbfw")
        touch("Firmware/usr/local/standalone/blankfile")

        with ZipFile('custom.ipsw', 'w') as zipObj2:
            zipObj2.write('Restore.plist')
            zipObj2.write('kernelcache.release.ipad4')
            zipObj2.write('kernelcache.release.ipad4b')
            zipObj2.write('BuildManifest.plist')
            zipObj2.write('058-75381-062.dmg')
            zipObj2.write('058-75094-062.dmg')
            zipObj2.write('058-74940-063.dmg')
            zipObj2.write('._058-75094-062.dmg')
            for folderName, subfolders, filenames in os.walk("Firmware"):
                for filename in filenames:
                    filePath = os.path.join(folderName, filename)
                    zipObj2.write(filePath)
        restore64(devicemodel)
    else:
        print('\033[91m' + "something broke lmao" + '\033[0m')
        exit(1)