2022-01-29 02:50:33 +00:00
|
|
|
# Mobile Verification Toolkit (MVT)
|
2022-01-30 19:15:01 +00:00
|
|
|
# Copyright (c) 2021-2022 The MVT Project Authors.
|
2022-01-29 02:50:33 +00:00
|
|
|
# Use of this software is governed by the MVT License 1.1 that can be found at
|
|
|
|
# https://license.mvt.re/1.1/
|
|
|
|
|
|
|
|
import logging
|
|
|
|
|
2022-02-02 20:58:11 +00:00
|
|
|
from mvt.android.parsers import parse_dumpsys_activity_resolver_table
|
|
|
|
|
2022-02-02 21:00:48 +00:00
|
|
|
from .base import AndroidExtraction
|
|
|
|
|
2022-01-29 02:50:33 +00:00
|
|
|
log = logging.getLogger(__name__)
|
|
|
|
|
|
|
|
|
|
|
|
class DumpsysActivities(AndroidExtraction):
|
|
|
|
"""This module extracts details on receivers for risky activities."""
|
|
|
|
|
|
|
|
def __init__(self, file_path=None, base_folder=None, output_folder=None,
|
|
|
|
serial=None, fast_mode=False, log=None, results=[]):
|
|
|
|
super().__init__(file_path=file_path, base_folder=base_folder,
|
|
|
|
output_folder=output_folder, fast_mode=fast_mode,
|
|
|
|
log=log, results=results)
|
|
|
|
|
|
|
|
self.results = results if results else {}
|
|
|
|
|
2022-01-30 03:08:48 +00:00
|
|
|
def check_indicators(self):
|
2022-02-01 16:48:19 +00:00
|
|
|
if not self.indicators:
|
|
|
|
return
|
|
|
|
|
2022-01-30 03:08:48 +00:00
|
|
|
for intent, activities in self.results.items():
|
|
|
|
for activity in activities:
|
2022-02-01 13:27:00 +00:00
|
|
|
ioc = self.indicators.check_app_id(activity["package_name"])
|
2022-01-30 03:08:48 +00:00
|
|
|
if ioc:
|
2022-01-30 19:29:09 +00:00
|
|
|
activity["matched_indicator"] = ioc
|
2022-01-30 03:08:48 +00:00
|
|
|
self.detected.append({intent: activity})
|
|
|
|
continue
|
|
|
|
|
2022-01-29 02:50:33 +00:00
|
|
|
def run(self):
|
|
|
|
self._adb_connect()
|
|
|
|
output = self._adb_command("dumpsys package")
|
2022-02-03 19:19:07 +00:00
|
|
|
self._adb_disconnect()
|
|
|
|
|
2022-02-02 20:58:11 +00:00
|
|
|
self.results = parse_dumpsys_activity_resolver_table(output)
|
2022-01-29 02:50:33 +00:00
|
|
|
|
2022-02-03 19:19:07 +00:00
|
|
|
self.log.info("Extracted activities for %d intents", len(self.results))
|