Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
BackupRipper for iOS - Unpack an iOS iPhone Backup into its native files.
import sqlite3
import os
print('BackupRipper for iOS - v1.0')
def dict_factory(cursor, row):
d = {}
for idx, col in enumerate(cursor.description):
d[col[0]] = row[idx]
return d
backuppath = '/home/bob/Desktop/bob_iphone_oct_2019/'
conn = sqlite3.connect(backuppath + 'Manifest.db')
conn.row_factory = dict_factory
c = conn.cursor()
c.execute("""
select substr(fileId, 0, 3) as folder, fileID, relativePath
from Files
""")
results = c.fetchall()
for row in results:
folder = row['folder']
fileID = row['fileID']
relativePath = row['relativePath']
fileName = relativePath.split('/').pop()
pathElements = relativePath.split('/')
pathElements.pop()
pathOnly = '/'.join(pathElements)
print(relativePath)
if not os.path.isdir(backuppath + 'EXTRACTED_FILES/' + pathOnly):
os.makedirs(backuppath + 'EXTRACTED_FILES/' + pathOnly)
if os.path.exists(backuppath + folder + '/' + fileID):
os.rename(backuppath + folder + '/' + fileID, backuppath + 'EXTRACTED_FILES/' + relativePath)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.