Fixes bug in bugreport getprop module

This commit is contained in:
tek 2023-05-06 11:20:10 -04:00
parent 11730f164f
commit f814244ff8
3 changed files with 13 additions and 7 deletions

View File

@ -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))

View File

View File

@ -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