mirror of https://github.com/mvt-project/mvt.git
Enforce consistency in Android modules
This commit is contained in:
parent
8d15ff58dd
commit
fb8a7ca104
|
@ -27,13 +27,9 @@ class DumpsysAccessibility(AndroidExtraction):
|
|||
self.detected.append(result)
|
||||
continue
|
||||
|
||||
def run(self):
|
||||
self._adb_connect()
|
||||
|
||||
stats = self._adb_command("dumpsys accessibility")
|
||||
|
||||
def process_accessibility(self, output):
|
||||
in_services = False
|
||||
for line in stats.split("\n"):
|
||||
for line in output.split("\n"):
|
||||
if line.strip().startswith("installed services:"):
|
||||
in_services = True
|
||||
continue
|
||||
|
@ -54,4 +50,10 @@ class DumpsysAccessibility(AndroidExtraction):
|
|||
|
||||
log.info("Identified a total of %d accessibility services", len(self.results))
|
||||
|
||||
def run(self):
|
||||
self._adb_connect()
|
||||
|
||||
output = self._adb_command("dumpsys accessibility")
|
||||
self.process_accessibility(output)
|
||||
|
||||
self._adb_disconnect()
|
||||
|
|
|
@ -30,18 +30,11 @@ class DumpsysActivities(AndroidExtraction):
|
|||
self.detected.append({intent: activity})
|
||||
continue
|
||||
|
||||
def parse_activity_resolver_table(self, data):
|
||||
"""Parse output of dumpsys package.
|
||||
|
||||
:param data: Output of dumpsys package command.
|
||||
:type data: str
|
||||
|
||||
"""
|
||||
|
||||
def parse_activity_resolver_table(self, output):
|
||||
in_activity_resolver_table = False
|
||||
in_non_data_actions = False
|
||||
intent = None
|
||||
for line in data:
|
||||
for line in output.split("\n"):
|
||||
if line.startswith("Activity Resolver Table:"):
|
||||
in_activity_resolver_table = True
|
||||
continue
|
||||
|
@ -92,9 +85,6 @@ class DumpsysActivities(AndroidExtraction):
|
|||
self._adb_connect()
|
||||
|
||||
output = self._adb_command("dumpsys package")
|
||||
if not output:
|
||||
return
|
||||
|
||||
self.parse_activity_resolver_table(output.split("\n"))
|
||||
self.parse_activity_resolver_table(output)
|
||||
|
||||
self._adb_disconnect()
|
||||
|
|
|
@ -52,17 +52,11 @@ class DumpsysReceivers(AndroidExtraction):
|
|||
self.detected.append({intent: receiver})
|
||||
continue
|
||||
|
||||
def parse_receiver_resolver_table(self, data):
|
||||
"""Parse output of dumpsys package.
|
||||
|
||||
:param data: Output of dumpsys package command.
|
||||
:type data: str
|
||||
|
||||
"""
|
||||
def parse_receiver_resolver_table(self, output):
|
||||
in_receiver_resolver_table = False
|
||||
in_non_data_actions = False
|
||||
intent = None
|
||||
for line in data:
|
||||
for line in output.split("\n"):
|
||||
if line.startswith("Receiver Resolver Table:"):
|
||||
in_receiver_resolver_table = True
|
||||
continue
|
||||
|
@ -113,9 +107,6 @@ class DumpsysReceivers(AndroidExtraction):
|
|||
self._adb_connect()
|
||||
|
||||
output = self._adb_command("dumpsys package")
|
||||
if not output:
|
||||
return
|
||||
|
||||
self.parse_receiver_resolver_table(output.split("\n"))
|
||||
self.parse_receiver_resolver_table(output)
|
||||
|
||||
self._adb_disconnect()
|
||||
|
|
Loading…
Reference in New Issue