def test_inplace(self): a = 1000 * to_bytes('ABCDE') b = 1000 * to_bytes('XYZ') self.write_data('src', a + random_bytes(100) + b) self.write_data('dst', a + random_bytes(100) + b) file_diff(self.path('src'), self.path('dst'), self.path('patch')) file_patch_inplace(self.path('src'), self.path('patch')) self.assert_same_file_content('src', 'dst')
def test_inplace(self): a = 1000 * b'ABCDE' b = 1000 * b'XYZ' self.write_data('src', a + os.urandom(100) + b) self.write_data('dst', a + os.urandom(100) + b) file_diff(self.path('src'), self.path('dst'), self.path('patch')) file_patch_inplace(self.path('src'), self.path('patch')) self.assert_same_file_content('src', 'dst')
def test_inplace(self): a = 1000 * to_bytes('ABCDE') b = 1000 * to_bytes('XYZ') self.write_data('src', a + random_bytes(100) + b) self.write_data('dst', a + random_bytes(100) + b) file_diff(self.path('src'), self.path('dst'), self.path('patch')) file_patch_inplace(self.path('src'), self.path('patch')) self.assert_same_file_content('src', 'dst')
def patch_bootchain( firm_bundle, ipsw_path, firm_bundle_number, verbose=None): # Applies patches from firmware bundle onto bootchain os.makedirs('work/patched_files', exist_ok=True) with open(f'{firm_bundle}/Info.json') as f: data = json.load(f) if firm_bundle_number != 1337: ibss = [ data['devices'][firm_bundle_number]['files']['ibss']['file'], data['devices'][firm_bundle_number]['files']['ibss']['patch'] ] ibec = [ data['devices'][firm_bundle_number]['files']['ibec']['file'], data['devices'][firm_bundle_number]['files']['ibec']['patch'] ] kernelcache = [ data['files']['kernelcache']['file'], data['files']['kernelcache']['patch'] ] ramdisk = [ data['files']['ramdisk']['file'], data['files']['ramdisk']['patch'] ] else: ibss = [ data['files']['ibss']['file'], data['files']['ibss']['patch'] ] ibec = [ data['files']['ibec']['file'], data['files']['ibec']['patch'] ] kernelcache = [ data['files']['kernelcache']['file'], data['files']['kernelcache']['patch'] ] ramdisk = [ data['files']['ramdisk']['file'], data['files']['ramdisk']['patch'] ] bsdiff4.file_patch_inplace(f'work/ipsw/{ibss[0]}', f'{firm_bundle}/{ibss[1]}') if verbose: print(f'[VERBOSE] iBSS patched and put in work/ipsw/{ibss[0]}') bsdiff4.file_patch_inplace(f'work/ipsw/{ibec[0]}', f'{firm_bundle}/{ibec[1]}') if verbose: print(f'[VERBOSE] iBEC patched and put in work/ipsw/{ibec[0]}') bsdiff4.file_patch_inplace(f'work/ipsw/{kernelcache[0]}', f'{firm_bundle}/{kernelcache[1]}') if verbose: print( f'[VERBOSE] Kernelcache patched and put in work/ipsw/{kernelcache[0]}' ) bsdiff4.file_patch_inplace(f'work/ipsw/{ramdisk[0]}', f'{firm_bundle}/{ramdisk[1]}') if verbose: print(f'[VERBOSE] Ramdisk patched and put in work/ipsw/{ramdisk[0]}')
def patch_bootchain( firm_bundle, firm_bundle_number, buildid, is_verbose): # Applies patches from firmware bundle onto bootchain os.makedirs('work/patched_files', exist_ok=True) with open(f'{firm_bundle}/Info.json') as f: data = json.load(f) if buildid: for x in range(0, len(data['files'])): if data['files'][x]['buildid'] == buildid: ramdisk_path = data['files']['ramdisk'][x]['file'] ramdisk_patch = data['files']['ramdisk'][x]['patch'] kernelcache_path = data['files']['kernelcache'][x]['file'] kernelcache_patch = data['files']['kernelcache'][x]['patch'] break else: ramdisk_path = data['files']['ramdisk']['file'] ramdisk_patch = data['files']['ramdisk']['patch'] kernelcache_path = data['files']['kernelcache']['file'] kernelcache_patch = data['files']['kernelcache']['patch'] if firm_bundle_number != 1337: ibss = [ data['devices'][firm_bundle_number]['files']['ibss']['file'], data['devices'][firm_bundle_number]['files']['ibss']['patch'] ] ibec = [ data['devices'][firm_bundle_number]['files']['ibec']['file'], data['devices'][firm_bundle_number]['files']['ibec']['patch'] ] kernelcache = [kernelcache_path, kernelcache_patch] ramdisk = [ramdisk_path, ramdisk_patch] else: ibss = [data['files']['ibss']['file'], data['files']['ibss']['patch']] ibec = [data['files']['ibec']['file'], data['files']['ibec']['patch']] kernelcache = [kernelcache_path, kernelcache_patch] ramdisk = [ramdisk_path, ramdisk_patch] bsdiff4.file_patch_inplace(f'work/ipsw/{ibss[0]}', f'{firm_bundle}/{ibss[1]}') utils.log(f'[VERBOSE] iBSS patched and put in work/ipsw/{ibss[0]}', is_verbose) bsdiff4.file_patch_inplace(f'work/ipsw/{ibec[0]}', f'{firm_bundle}/{ibec[1]}') utils.log(f'[VERBOSE] iBEC patched and put in work/ipsw/{ibec[0]}', is_verbose) bsdiff4.file_patch_inplace(f'work/ipsw/{kernelcache[0]}', f'{firm_bundle}/{kernelcache[1]}') utils.log( f'[VERBOSE] Kernelcache patched and put in work/ipsw/{kernelcache[0]}', is_verbose) bsdiff4.file_patch_inplace(f'work/ipsw/{ramdisk[0]}', f'{firm_bundle}/{ramdisk[1]}') utils.log(f'[VERBOSE] Ramdisk patched and put in work/ipsw/{ramdisk[0]}', is_verbose)
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)
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)
def apply(self): patch_path = Path(str(self.file_path) + ".patch") if os.path.exists(patch_path): bsdiff4.file_patch_inplace(self.file_path, patch_path) os.remove(patch_path)
for filename in files: local_path = os.path.join(current_directory, filename) url = os.path.join(files_path, "files", f"{filename}.gz").replace("\\", "/") if os.path.isfile(local_path): old_hash = hash(local_path) if old_hash != files[filename]: print(f"{filename} is old, looking for patch") while old_hash != files[filename]: patch_url = os.path.join(files_path, "patch", filename, old_hash).replace("\\", "/") if download_file(patch_url, f"{filename}.patch"): print(f"\npatching {filename}") file_patch_inplace(filename, f"{filename}.patch") os.remove(f"{filename}.patch") else: print("no patch found, downloading entire file") download_file(url, f"{filename}.gz") print("\ndecompressing") with gzip.open(f"{filename}.gz", "rb") as compressed_file: with open(filename, "wb+") as new_file: shutil.copyfileobj(compressed_file, new_file) os.remove(f"{filename}.gz") old_hash = hash(local_path) continue print(f"{filename} is missing, downloading") download_file(url, f"{filename}.gz")
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)
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)
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)