diff --git a/mvt/android/modules/bugreport/getprop.py b/mvt/android/modules/bugreport/getprop.py index 380312a..bc36fda 100644 --- a/mvt/android/modules/bugreport/getprop.py +++ b/mvt/android/modules/bugreport/getprop.py @@ -55,13 +55,14 @@ class Getprop(BugReportModule): self.results = parse_getprop("\n".join(lines)) # Alert if phone is outdated. - security_patch = self.results.get("ro.build.version.security_patch", "") - if security_patch: - patch_date = datetime.strptime(security_patch, "%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_patch) + for entry in self.results: + if entry["name"] == "ro.build.version.security_patch": + security_patch = entry["value"] + patch_date = datetime.strptime(security_patch, "%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_patch) self.log.info("Extracted %d Android system properties", len(self.results)) diff --git a/tests/android_bugreport/__init__.py b/tests/android_bugreport/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/tests/android/test_bugreport.py b/tests/android_bugreport/test_bugreport.py similarity index 89% rename from tests/android/test_bugreport.py rename to tests/android_bugreport/test_bugreport.py index b54d268..5a98b25 100644 --- a/tests/android/test_bugreport.py +++ b/tests/android_bugreport/test_bugreport.py @@ -8,6 +8,7 @@ from pathlib import Path from mvt.android.modules.bugreport.appops import Appops from mvt.android.modules.bugreport.packages import Packages +from mvt.android.modules.bugreport.getprop import Getprop from mvt.common.module import run_module from ..utils import get_artifact_folder @@ -40,3 +41,7 @@ class TestBugreportAnalysis: assert m.results[1]["package_name"] == "com.instagram.android" assert len(m.results[0]["permissions"]) == 4 assert len(m.results[1]["permissions"]) == 32 + + def test_getprop_module(self): + m = self.launch_bug_report_module(Getprop) + assert len(m.results) == 0