Example #1
0
def createCustomIPSW32(fname):
    if os.path.exists("resources/restoreFiles/futurerestore"):
        shutil.move("resources/restoreFiles/futurerestore", "futurerestore")
    print("Starting iBSS/iBEC patching")
    kloader10location = "resources/restoreFiles/kloader10"
    kloaderlocation = "resources/restoreFiles/kloader"
    patch_folder = Path("resources/patches/")
    phone5ibss = patch_folder / "ibss.iphone5.patch"
    phone4sibss6 = patch_folder / "ibss.iphone4,1.6.1.3.patch"
    phone4sibss8 = patch_folder / "ibss.iphone4,1.8.4.1.patch"
    if "iPhone5,2" in fname or "iPhone5,1" in fname and "8.4.1" in fname:
        print("Looks like you are downgrading an iPhone 5 to 8.4.1!")
        bsdiff4.file_patch_inplace("iBSS.n42.RELEASE.dfu", phone5ibss)
        shutil.copy("iBSS.n42.RELEASE.dfu", "ibss")
        ibsslocation = "ibss"
        device = "iPhone5"
        if "iPhone5,2" in fname:
            model = "iPhone5,2"
        elif "iPhone5,1" in fname:
            model = "iPhone5,1"
    elif "6.1.3" in fname or "8.4.1" in fname and "iPhone4,1" in fname:
        device = "iPhone4s"
        model = "iPhone4,1"
    else:
        print('\033[91m' + "Im tired" + '\033[0m')
        exit(24)

    if device == "iPhone5":
        iosversion = "8.4.1"
        shutil.copy(fname, "custom.ipsw")
        localdevice.enterkdfumode(kloaderlocation, kloader10location,
                                  ibsslocation)
        restore32(model, iosversion)
    elif device == "iPhone4s":
        if "8.4.1" in fname:
            print("Looks like you are downgrading an iPhone 4s to 8.4.1!")
            iosversion = "8.4.1"
            bsdiff4.file_patch_inplace("iBSS.n94.RELEASE.dfu", phone4sibss8)
            shutil.copy("iBSS.n94.RELEASE.dfu", "ibss")
            ibsslocation = "ibss"
            shutil.copy(fname, "custom.ipsw")
            localdevice.enterkdfumode(kloaderlocation, kloader10location,
                                      ibsslocation)
            restore32(model, iosversion)
        elif "6.1.3" in fname:
            print("Looks like you are downgrading an iPhone 4s to 6.1.3!")
            iosversion = "6.1.3"
            bsdiff4.file_patch_inplace("iBSS.n94ap.RELEASE.dfu", phone4sibss6)
            shutil.copy("iBSS.n94ap.RELEASE.dfu", "ibss")
            ibsslocation = "ibss"
            shutil.copy(fname, "custom.ipsw")
            localdevice.enterkdfumode(kloaderlocation, kloader10location,
                                      ibsslocation)
            restore32(model, iosversion)
        else:
            print("=(")
            exit(2)
    else:
        print("=(")
        exit(2)
Example #2
0
def createCustomIPSW32(fname):
    if os.path.exists("resources/bin/futurerestore"):
        shutil.move("resources/bin/futurerestore", "futurerestore")

    print("Starting iBSS/iBEC patching")
    kloaderlocation = "resources/bin/kloader"
    kloaderlocation10 = "resources/bin/kloader10"
    patch_folder = Path("resources/patches/")
    phone52ibss = patch_folder / "ibss.iphone52.patch"
    phone51ibss = patch_folder / "ibss.iphone51.patch"
    phone4sibss6 = patch_folder / "ibss.iphone4,1.6.1.3.patch"
    phone4sibss8 = patch_folder / "ibss.iphone4,1.8.4.1.patch"
    version = True
    versionManifest = readmanifest("IPSW/BuildManifest.plist", version)
    version = False
    deviceManifest = readmanifest("IPSW/BuildManifest.plist", version)

    if "iPhone5,2" in deviceManifest or "iPhone5,1" in deviceManifest and "8.4.1" in versionManifest:
        print("Looks like you are downgrading an iPhone 5 to 8.4.1!")

        if "iPhone5,2" in deviceManifest:
            bsdiff4.file_patch_inplace("iBSS.n42.RELEASE.dfu", phone52ibss)
            shutil.copy("iBSS.n42.RELEASE.dfu", "ibss")
            model = "iPhone5,2"

        elif "iPhone5,1" in deviceManifest:
            bsdiff4.file_patch_inplace("iBSS.n41.RELEASE.dfu", phone51ibss)
            shutil.copy("iBSS.n41.RELEASE.dfu", "ibss")
            model = "iPhone5,1"
        ibsslocation = "ibss"
        device = "iPhone5"

    elif "6.1.3" in versionManifest or "8.4.1" in versionManifest and "iPhone4,1" in deviceManifest:
        device = "iPhone4s"
        model = "iPhone4,1"

    else:
        print('\033[91m' + "Im tired" + '\033[0m')
        exit(24)

    if device == "iPhone5":
        iosversion = "8.4.1"
        shutil.copy(fname, "custom.ipsw")
        localdevice.enterkdfumode(kloaderlocation, kloaderlocation10, ibsslocation)
        restore32(model, iosversion)

    elif device == "iPhone4s":
        if "8.4.1" in versionManifest:
            print("Looks like you are downgrading an iPhone 4s to 8.4.1!")
            iosversion = "8.4.1"
            bsdiff4.file_patch_inplace("iBSS.n94.RELEASE.dfu", phone4sibss8)
            shutil.copy("iBSS.n94.RELEASE.dfu", "ibss")
            ibsslocation = "ibss"
            shutil.copy(fname, "custom.ipsw")
            localdevice.enterkdfumode(kloaderlocation, ibsslocation)
            restore32(model, iosversion)

        elif "6.1.3" in versionManifest:
            print("Looks like you are downgrading an iPhone 4s to 6.1.3!")
            iosversion = "6.1.3"
            bsdiff4.file_patch_inplace("iBSS.n94ap.RELEASE.dfu", phone4sibss6)
            shutil.copy("iBSS.n94ap.RELEASE.dfu", "ibss")
            ibsslocation = "ibss"
            shutil.copy(fname, "custom.ipsw")
            localdevice.enterkdfumode(kloaderlocation, ibsslocation)
            restore32(model, iosversion)

        else:
            print("=(")
            exit(2)

    else:
        print("=(")
        exit(2)
Example #3
0
def createCustomIPSW32(fname):

    print("Starting iBSS/iBEC patching")
    kloaderlocation = "resources/bin/kloader"
    kloaderlocation10 = "resources/bin/kloader10"
    patch_folder = Path("resources/patches/")
    phone52ibss = patch_folder / "ibss.iphone52.patch"
    phone51ibss = patch_folder / "ibss.iphone51.patch"
    phone4sibss6 = patch_folder / "ibss.iphone4,1.613.patch"
    phone4sibss8 = patch_folder / "ibss.iphone4,1.841.patch"
    pad21ibss6 = patch_folder / "ibss.ipad2,1.613.patch"
    pad22ibss6 = patch_folder / "ibss.ipad2,2.613.patch"
    pad23ibss6 = patch_folder / "ibss.ipad2,3.613.patch"
    pad21ibss8 = patch_folder / "ibss.ipad2,1.841.patch"
    pad22ibss8 = patch_folder / "ibss.ipad2,2.841.patch"
    pad23ibss8 = patch_folder / "ibss.ipad2,3.841.patch"
    pad24ibss8 = patch_folder / "ibss.ipad2,4.841.patch"
    pad31ibss = patch_folder / "ibss.ipad31.patch"
    pad32ibss = patch_folder / "ibss.ipad32.patch"
    pad33ibss = patch_folder / "ibss.ipad33.patch"
    pad34ibss = patch_folder / "ibss.ipad34.patch"
    pad35ibss = patch_folder / "ibss.ipad35.patch"
    pad36ibss = patch_folder / "ibss.ipad36.patch"
    pad25ibss = patch_folder / "ibss.ipad25.patch"
    pad26ibss = patch_folder / "ibss.ipad26.patch"
    pad27ibss = patch_folder / "ibss.ipad27.patch"
    podibss = patch_folder / "ibss.ipod51.patch"


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

    if "iPhone5,2" in deviceManifest and "8.4.1" in versionManifest or "iPhone5,1" in deviceManifest and "8.4.1" in versionManifest:
        print("Looks like you are downgrading an iPhone 5 to 8.4.1!")

        if "iPhone5,2" in deviceManifest:
            bsdiff4.file_patch_inplace("iBSS.n42.RELEASE.dfu", phone52ibss)
            shutil.copy("iBSS.n42.RELEASE.dfu", "ibss")
            model = "iPhone5,2"

        elif "iPhone5,1" in deviceManifest:
            bsdiff4.file_patch_inplace("iBSS.n41.RELEASE.dfu", phone51ibss)
            shutil.copy("iBSS.n41.RELEASE.dfu", "ibss")
            model = "iPhone5,1"
        ibsslocation = "ibss"
        device = "iPhone5"

    elif "6.1.3" in versionManifest and "iPhone4,1" in deviceManifest:
        device = "iPhone4s"
        model = "iPhone4,1"
    elif "8.4.1" in versionManifest and "iPhone4,1" in deviceManifest:
        device = "iPhone4s"
        model = "iPhone4,1"

    elif "8.4.1" in versionManifest and "iPad3,4" in deviceManifest:
        bsdiff4.file_patch_inplace("iBSS.p101.RELEASE.dfu", pad34ibss)
        shutil.copy("iBSS.p101.RELEASE.dfu", "ibss")
        model = "iPad3,4"
        ibsslocation = "ibss"
        device = "iPad4"
    elif "8.4.1" in versionManifest and "iPad3,5" in deviceManifest:
        bsdiff4.file_patch_inplace("iBSS.p102.RELEASE.dfu", pad35ibss)
        shutil.copy("iBSS.p102.RELEASE.dfu", "ibss")
        model = "iPad3,5"
        ibsslocation = "ibss"
        device = "iPad4"
    elif "8.4.1" in versionManifest and "iPad3,6" in deviceManifest:
        bsdiff4.file_patch_inplace("iBSS.p103.RELEASE.dfu", pad36ibss)
        shutil.copy("iBSS.p103.RELEASE.dfu", "ibss")
        model = "iPad3,6"
        ibsslocation = "ibss"
        device = "iPad4"
    elif "6.1.3" in versionManifest and "iPad2,1" in deviceManifest:
        bsdiff4.file_patch_inplace("iBSS.k93ap.RELEASE.dfu", pad21ibss6)
        shutil.copy("iBSS.k93ap.RELEASE.dfu", "ibss")
        model = "iPad2,1"
        ibsslocation = "ibss"
        device = "iPad2"
    elif "6.1.3" in versionManifest and "iPad2,2" in deviceManifest:
        bsdiff4.file_patch_inplace("iBSS.k94ap.RELEASE.dfu", pad22ibss6)
        shutil.copy("iBSS.k94ap.RELEASE.dfu", "ibss")
        model = "iPad2,2"
        ibsslocation = "ibss"
        device = "iPad2"
    elif "6.1.3" in versionManifest and "iPad2,3" in deviceManifest:
        bsdiff4.file_patch_inplace("iBSS.k95ap.RELEASE.dfu", pad23ibss6)
        shutil.copy("iBSS.k95ap.RELEASE.dfu", "ibss")
        model = "iPad2,3"
        ibsslocation = "ibss"
        device = "iPad2"
    elif "8.4.1" in versionManifest and "iPad2,1" in deviceManifest:
        bsdiff4.file_patch_inplace("iBSS.k93.RELEASE.dfu", pad21ibss8)
        shutil.copy("iBSS.k93.RELEASE.dfu", "ibss")
        model = "iPad2,1"
        ibsslocation = "ibss"
        device = "iPad2"
    elif "8.4.1" in versionManifest and "iPad2,2" in deviceManifest:
        bsdiff4.file_patch_inplace("iBSS.k94.RELEASE.dfu", pad22ibss8)
        shutil.copy("iBSS.k94.RELEASE.dfu", "ibss")
        model = "iPad2,2"
        ibsslocation = "ibss"
        device = "iPad2"
    elif "8.4.1" in versionManifest and "iPad2,3" in deviceManifest:
        bsdiff4.file_patch_inplace("iBSS.k95.RELEASE.dfu", pad23ibss8)
        shutil.copy("iBSS.k95.RELEASE.dfu", "ibss")
        model = "iPad2,3"
        ibsslocation = "ibss"
        device = "iPad2"
    elif "8.4.1" in versionManifest and "iPad2,4" in deviceManifest:
        bsdiff4.file_patch_inplace("iBSS.k93a.RELEASE.dfu", pad24ibss8)
        shutil.copy("iBSS.k93a.RELEASE.dfu", "ibss")
        model = "iPad2,4"
        ibsslocation = "ibss"
        device = "iPad2"
    elif "8.4.1" in versionManifest and "iPad3,1" in deviceManifest:
        bsdiff4.file_patch_inplace("iBSS.j1.RELEASE.dfu", pad31ibss)
        shutil.copy("iBSS.j1.RELEASE.dfu", "ibss")
        model = "iPad3,1"
        ibsslocation = "ibss"
        device = "iPad3"
    elif "8.4.1" in versionManifest and "iPad3,2" in deviceManifest:
        bsdiff4.file_patch_inplace("iBSS.j2.RELEASE.dfu", pad32ibss)
        shutil.copy("iBSS.j2.RELEASE.dfu", "ibss")
        model = "iPad3,2"
        ibsslocation = "ibss"
        device = "iPad3"
    elif "8.4.1" in versionManifest and "iPad3,3" in deviceManifest:
        bsdiff4.file_patch_inplace("iBSS.j3.RELEASE.dfu", pad33ibss)
        shutil.copy("iBSS.j3.RELEASE.dfu", "ibss")
        model = "iPad3,3"
        ibsslocation = "ibss"
        device = "iPad3"
    elif "8.4.1" in versionManifest and "iPod5,1" in deviceManifest:
        bsdiff4.file_patch_inplace("iBSS.n78.RELEASE.dfu", podibss)
        shutil.copy("iBSS.n78.RELEASE.dfu", "ibss")
        model = "iPod5,1"
        ibsslocation = "ibss"
        device = "iPod5"
    elif "8.4.1" in versionManifest and "iPad2,5" in deviceManifest:
        bsdiff4.file_patch_inplace("iBSS.p105.RELEASE.dfu", pad25ibss)
        shutil.copy("iBSS.p105.RELEASE.dfu", "ibss")
        model = "iPad2,5"
        ibsslocation = "ibss"
        device = "iPadmini"
    elif "8.4.1" in versionManifest and "iPad2,6" in deviceManifest:
        bsdiff4.file_patch_inplace("iBSS.p106.RELEASE.dfu", pad26ibss)
        shutil.copy("iBSS.p106.RELEASE.dfu", "ibss")
        model = "iPad2,6"
        ibsslocation = "ibss"
        device = "iPadmini"
    elif "8.4.1" in versionManifest and "iPad2,7" in deviceManifest:
        bsdiff4.file_patch_inplace("iBSS.p107.RELEASE.dfu", pad27ibss)
        shutil.copy("iBSS.p107.RELEASE.dfu", "ibss")
        model = "iPad2,7"
        ibsslocation = "ibss"
        device = "iPadmini"
    else:
        print('\033[91m' + "Im tired" + '\033[0m')
        exit(24)

    if device == "iPhone5":
        iosversion = "8.4.1"
        shutil.copy(fname, "custom.ipsw")
        localdevice.enterkdfumode(kloaderlocation, kloaderlocation10, ibsslocation)
        restore32(model, iosversion)

    elif device == "iPhone4s":
        if "8.4.1" in versionManifest:
            print("Looks like you are downgrading an iPhone 4s to 8.4.1!")
            iosversion = "8.4.1"
            bsdiff4.file_patch_inplace("iBSS.n94.RELEASE.dfu", phone4sibss8)
            shutil.copy("iBSS.n94.RELEASE.dfu", "ibss")
            ibsslocation = "ibss"
            shutil.copy(fname, "custom.ipsw")
            localdevice.enterkdfumode(kloaderlocation, kloaderlocation10, ibsslocation)
            restore32(model, iosversion)

        elif "6.1.3" in versionManifest:
            print("Looks like you are downgrading an iPhone 4s to 6.1.3!")
            iosversion = "6.1.3"
            bsdiff4.file_patch_inplace("iBSS.n94ap.RELEASE.dfu", phone4sibss6)
            shutil.copy("iBSS.n94ap.RELEASE.dfu", "ibss")
            ibsslocation = "ibss"
            shutil.copy(fname, "custom.ipsw")
            localdevice.enterkdfumode(kloaderlocation, kloaderlocation10, ibsslocation)
            restore32(model, iosversion)

        else:
            print("=(")
            exit(2)
    elif device == "iPad4":
        print("Looks like you are downgrading an iPad4 to 8.4.1!")
        iosversion = "8.4.1"
        shutil.copy(fname, "custom.ipsw")
        localdevice.enterkdfumode(kloaderlocation, kloaderlocation10, ibsslocation)
        restore32(model, iosversion)
    elif device == "iPadmini":
        print("Looks like you are downgrading an iPad Mini 1 to 8.4.1!")
        iosversion = "8.4.1"
        shutil.copy(fname, "custom.ipsw")
        localdevice.enterkdfumode(kloaderlocation, kloaderlocation10, ibsslocation)
        restore32(model, iosversion)
    elif device == "iPad3":
        print("Looks like you are downgrading an iPad3 to 8.4.1!")
        iosversion = "8.4.1"
        shutil.copy(fname, "custom.ipsw")
        localdevice.enterkdfumode(kloaderlocation, kloaderlocation10, ibsslocation)
        restore32(model, iosversion)
    elif device == "iPad2":
        if "8.4.1" in versionManifest:
            print("Looks like you are downgrading an iPad2 to 8.4.1!")
            iosversion = "8.4.1"
            shutil.copy(fname, "custom.ipsw")
            localdevice.enterkdfumode(kloaderlocation, kloaderlocation10, ibsslocation)
            restore32(model, iosversion)
        elif "6.1.3" in versionManifest:
            print("Looks like you are downgrading an iPad2 to 6.1.3!")
            iosversion = "6.1.3"
            shutil.copy(fname, "custom.ipsw")
            localdevice.enterkdfumode(kloaderlocation, kloaderlocation10, ibsslocation)
            restore32(model, iosversion)
        else:
            exit(2)
    elif device == "iPod5":
        print("Looks like you are downgrading an iPod5 to 8.4.1!")
        iosversion = "8.4.1"
        shutil.copy(fname, "custom.ipsw")
        localdevice.enterkdfumode(kloaderlocation, kloaderlocation10, ibsslocation)
        restore32(model, iosversion)
    else:
        print("=(")
        exit(2)