From ec93c3d8b881f075d4bfa311827b4ca1d2efa7e4 Mon Sep 17 00:00:00 2001 From: Daniel Kahn Gillmor Date: Tue, 10 Aug 2021 23:19:45 -0400 Subject: [PATCH] Even friendlier behaviors when the user mis-specifies the backup path As discussed in #147 --- mvt/ios/decrypt.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/mvt/ios/decrypt.py b/mvt/ios/decrypt.py index 51c7ff2..424d32b 100644 --- a/mvt/ios/decrypt.py +++ b/mvt/ios/decrypt.py @@ -8,6 +8,7 @@ import logging import os import shutil import sqlite3 +import glob from iOSbackup import iOSbackup @@ -76,6 +77,15 @@ class DecryptBackup: """ log.info("Decrypting iOS backup at path %s with password", self.backup_path) + if not os.path.exists(os.path.join(self.backup_path, "Manifest.plist")): + possible = glob.glob(os.path.join(self.backup_path, "*", "Manifest.plist")) + if len(possible) == 1: + newpath = os.path.dirname(possible[0]) + log.warning(f"No Manifest.plist in {self.backup_path}, using {newpath} instead.") + self.backup_path = newpath + elif len(possible) > 1: + log.critical(f"No Manifest.plist in {self.backup_path}, and {len(possible)} Manifest.plist files in subdirs. Please choose one!") + return try: self._backup = iOSbackup(udid=os.path.basename(self.backup_path), cleartextpassword=password,