From 7ef26779bf2edb01efe0aefb9f987be54b314454 Mon Sep 17 00:00:00 2001 From: Janik Besendorf Date: Sat, 22 Aug 2026 14:16:24 +0200 Subject: [PATCH] Register added bugreport parsers --- src/mvt/android/modules/bugreport/__init__.py | 10 ++++++++- tests/android_bugreport/test_bugreport.py | 22 ++++++++++++------- 2 files changed, 23 insertions(+), 9 deletions(-) diff --git a/src/mvt/android/modules/bugreport/__init__.py b/src/mvt/android/modules/bugreport/__init__.py index 1594af9..e23bf5a 100644 --- a/src/mvt/android/modules/bugreport/__init__.py +++ b/src/mvt/android/modules/bugreport/__init__.py @@ -3,6 +3,8 @@ # Use of this software is governed by the MVT License 1.1 that can be found at # https://license.mvt.re/1.1/ +from mvt.common.module import MVTModule + from .dumpsys_accessibility import DumpsysAccessibility from .dumpsys_activities import DumpsysActivities from .dumpsys_appops import DumpsysAppops @@ -16,8 +18,11 @@ from .dumpsys_receivers import DumpsysReceivers from .dumpsys_adb_state import DumpsysADBState from .fs_timestamps import BugReportTimestamps from .tombstones import Tombstones +from .mounts import Mounts +from .processes import Processes +from .settings import Settings -BUGREPORT_MODULES = [ +BUGREPORT_MODULES: list[type[MVTModule]] = [ DumpsysAccessibility, DumpsysActivities, DumpsysAppops, @@ -31,4 +36,7 @@ BUGREPORT_MODULES = [ DumpsysADBState, BugReportTimestamps, Tombstones, + Processes, + Settings, + Mounts, ] diff --git a/tests/android_bugreport/test_bugreport.py b/tests/android_bugreport/test_bugreport.py index 75df106..413bb18 100644 --- a/tests/android_bugreport/test_bugreport.py +++ b/tests/android_bugreport/test_bugreport.py @@ -54,10 +54,11 @@ class TestBugreportAnalysis: == "com.samsung.android.provider.filterprovider" ) assert m.results[1]["package_name"] == "com.instagram.android" - assert m.results[0]["installer"] == "" + assert m.results[0]["installer"] is None assert m.results[1]["installer"] == "com.android.vending" assert len(m.results[0]["permissions"]) == 4 - assert len(m.results[1]["permissions"]) == 32 + assert len(m.results[1]["permissions"]) == 20 + assert len(m.results[1]["users"][0]["permissions"]) == 19 def test_getprop_module(self): m = self.launch_bug_report_module(DumpsysGetProp) @@ -66,29 +67,34 @@ class TestBugreportAnalysis: def test_receivers_match_exact_package_name(self, indicators_factory): intent = "android.intent.action.PHONE_STATE" false_positive = { + "resolver_type": "non_data_action", + "key": intent, "package_name": "com.android.phone", - "receiver": ( + "component": ( "com.android.phone/" "com.android.services.telephony.sip.SipIncomingCallReceiver" ), + "filter_count": 1, } malicious_receiver = { + "resolver_type": "non_data_action", + "key": intent, "package_name": "com.android.services", - "receiver": "com.android.services/com.example.SomeReceiver", + "component": "com.android.services/com.example.SomeReceiver", + "filter_count": 1, } - module = DumpsysReceivers( - results={intent: [false_positive, malicious_receiver]} - ) + module = DumpsysReceivers(results=[false_positive, malicious_receiver]) module.indicators = indicators_factory(app_ids=["com.android.services"]) module.check_indicators() assert len(module.alertstore.alerts) == 1 alert = module.alertstore.alerts[0] - assert alert.event == {intent: malicious_receiver} + assert alert.event == malicious_receiver assert alert.matched_indicator.value == "com.android.services" def test_tombstones_modules(self): m = self.launch_bug_report_module(Tombstones) assert len(m.results) == 2 assert m.results[1]["pid"] == 3559 + assert m.results[0]["sources"]["text"]["parsed"] is True