Fixed code styling and added missing check in adb getprop

This commit is contained in:
Nex 2022-02-09 13:20:09 +01:00
parent 6d47d4d416
commit e9cc6b3928
3 changed files with 20 additions and 10 deletions

View File

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

View File

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

View File

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