ix.io Open in urlscan Pro
66.172.11.73  Public Scan

URL: http://ix.io/44d7
Submission: On July 18 via manual from US — Scanned from DE

Form analysis 0 forms found in the DOM

Text Content

#!/usr/bin/env python3

from iphone_backup_decrypt import EncryptedBackup, RelativePath, RelativePathsLike
import argparse
import sqlite3
import pathlib

def getFiles(path):
    ## Connects to the Manifest.db and returns a list of files paths

    files = []
    ## Conect to the Manifest.db
    conn = sqlite3.connect(path)

    ## Creating a cursor object
    cur = conn.cursor()

    ## iterate over the files
    for row in cur.execute("select relativePath FROM Files;"):
        if len(row[0]) != 0:
            files.append(row[0].strip())
    return files
def decryptFiles(backupObj, files, outputPath):
    ## Decrypt files from a list and put them into a directory
    for f in files:
        rpath = pathlib.Path(outputPath, f)
        try:
            backupObj.extract_file(relative_path=f, output_filename=rpath)
        except TypeError:
            ## Not sure whats the hold up here
            pass
        except KeyboardInterrupt:
            exit(0)
        except Exception:
            pass
            ## agin, im getting the files rom the db, wtf is this?
def main():
    parser = argparse.ArgumentParser()
    parser.add_argument("-d", "--directory", help="Path to the Encrypted backup")
    parser.add_argument("-p", "--password", help="Password ")
    parser.add_argument("-o", "--output", help="Path to output directory")
    args = parser.parse_args()

    backup = EncryptedBackup(backup_directory=args.directory, passphrase=args.password)
    backup.save_manifest_file(pathlib.Path(args.output, "Manifest.db"))
    backup.extract_file(relative_path=RelativePath.CALL_HISTORY,
                    output_filename="./output/call_history.sqlite")

    files = getFiles(pathlib.Path(args.output, "Manifest.db"))
    print(f"Found {len('files')} to export!")
    decryptFiles(backup, files, args.output)

if __name__ == "__main__":
    main()