From 964c73b95873976c6aefab4e04d3e53487f05e26 Mon Sep 17 00:00:00 2001 From: rose Date: Mon, 31 Jul 2023 21:19:11 -0500 Subject: [PATCH] Fix bug that caused module to always fail whenever an explicit db file path was specified --- mvt/ios/modules/base.py | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/mvt/ios/modules/base.py b/mvt/ios/modules/base.py index 799ab9a..3deb65c 100644 --- a/mvt/ios/modules/base.py +++ b/mvt/ios/modules/base.py @@ -167,7 +167,7 @@ class IOSExtraction(MVTModule): """ file_path = None - # First we check if the was an explicit file path specified. + # First we check if there was an explicit file path specified. if not self.file_path: # If not, we first try with backups. # We construct the path to the file according to the iTunes backup @@ -187,11 +187,16 @@ class IOSExtraction(MVTModule): for found_path in self._get_fs_files_from_patterns(root_paths): file_path = found_path break + # If we do not find any, we fail. + if file_path: + self.file_path = file_path + else: + raise DatabaseNotFoundError("unable to find the module's database file") - # If we do not find any, we fail. - if file_path: - self.file_path = file_path + # If there was an explicit file path specified, check if it actually exists. else: - raise DatabaseNotFoundError("unable to find the module's database file") + # If it doesn't exist, we fail. + if not os.path.exists(self.file_path): + raise DatabaseNotFoundError("unable to find the module's database file") self._recover_sqlite_db_if_needed(self.file_path)