From e9cc6b392815213377210ce561123320a4fce1d8 Mon Sep 17 00:00:00 2001 From: Nex Date: Wed, 9 Feb 2022 13:20:09 +0100 Subject: [PATCH] Fixed code styling and added missing check in adb getprop --- mvt/android/modules/adb/getprop.py | 9 +++++++++ mvt/android/modules/bugreport/getprop.py | 15 +++++++-------- mvt/ios/modules/backup/backup_info.py | 6 ++++-- 3 files changed, 20 insertions(+), 10 deletions(-) diff --git a/mvt/android/modules/adb/getprop.py b/mvt/android/modules/adb/getprop.py index 9fd8f80..7b511a6 100644 --- a/mvt/android/modules/adb/getprop.py +++ b/mvt/android/modules/adb/getprop.py @@ -5,6 +5,7 @@ import logging import re +from datetime import datetime, timedelta from mvt.android.parsers import parse_getprop @@ -31,4 +32,12 @@ class Getprop(AndroidExtraction): self.results = parse_getprop(output) + # Alert if phone is outdated. + security_patch = self.results.get("ro.build.version.security_patch", "") + if security_patch: + patch_date = datetime.strptime(security_path, "%Y-%m-%d") + if (datetime.now() - patch_date) > timedelta(days=6*30): + self.log.warning("This phone has not received security updates for more than " + "six months (last update: %s)", security_path) + self.log.info("Extracted %d Android system properties", len(self.results)) diff --git a/mvt/android/modules/bugreport/getprop.py b/mvt/android/modules/bugreport/getprop.py index 464deb8..ef77b6f 100644 --- a/mvt/android/modules/bugreport/getprop.py +++ b/mvt/android/modules/bugreport/getprop.py @@ -48,13 +48,12 @@ class Getprop(BugReportModule): self.results = parse_getprop("\n".join(lines)) - # Alert if phone is outdated - for entry in self.results: - if entry == "ro.build.version.security_patch": - last_patch = datetime.strptime(self.results[entry], "%Y-%m-%d") - if (datetime.now() - last_patch) > timedelta(days=6*31): - self.log.warning("This phone has not received security updates for more than six months (last update: %s)", self.results[entry]) - - + # Alert if phone is outdated. + security_patch = self.results.get("ro.build.version.security_patch", "") + if security_patch: + patch_date = datetime.strptime(security_path, "%Y-%m-%d") + if (datetime.now() - patch_date) > timedelta(days=6*30): + self.log.warning("This phone has not received security updates for more than " + "six months (last update: %s)", security_path) self.log.info("Extracted %d Android system properties", len(self.results)) diff --git a/mvt/ios/modules/backup/backup_info.py b/mvt/ios/modules/backup/backup_info.py index 6430b52..164b440 100644 --- a/mvt/ios/modules/backup/backup_info.py +++ b/mvt/ios/modules/backup/backup_info.py @@ -42,7 +42,9 @@ class BackupInfo(IOSExtraction): value = info.get(field, None) self.log.info("%s: %s", field, value) self.results[field] = value + if "Product Version" in info: latest = latest_ios_version() - if info["Product Version"] != latest['version']: - self.log.warning("This phone is running an outdated iOS version : %s (latest is %s)", info["Product Version"], latest['version']) + if info["Product Version"] != latest["version"]: + self.log.warning("This phone is running an outdated iOS version: %s (latest is %s)", + info["Product Version"], latest['version'])