mirror of
https://github.com/mvt-project/mvt.git
synced 2026-02-12 16:42:45 +00:00
Refactor dumpsys accessibility in an artifact
This commit is contained in:
20
tests/android/test_artifact.py
Normal file
20
tests/android/test_artifact.py
Normal file
@@ -0,0 +1,20 @@
|
||||
# Mobile Verification Toolkit (MVT)
|
||||
# Copyright (c) 2021-2023 Claudio Guarnieri.
|
||||
# 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.android.artifacts.artifact import AndroidArtifact
|
||||
|
||||
from ..utils import get_artifact
|
||||
|
||||
|
||||
class TestAndroidArtifact:
|
||||
def test_extract_dumpsys_section(self):
|
||||
file = get_artifact("androidqf/dumpsys.txt")
|
||||
with open(file) as f:
|
||||
data = f.read()
|
||||
|
||||
section = AndroidArtifact.extract_dumpsys_section(
|
||||
data, "DUMP OF SERVICE package:"
|
||||
)
|
||||
assert isinstance(section, str)
|
||||
assert len(section) == 3907
|
||||
42
tests/android/test_artifact_dumpsys_accessibility.py
Normal file
42
tests/android/test_artifact_dumpsys_accessibility.py
Normal file
@@ -0,0 +1,42 @@
|
||||
# Mobile Verification Toolkit (MVT)
|
||||
# Copyright (c) 2021-2023 Claudio Guarnieri.
|
||||
# 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
|
||||
|
||||
from mvt.android.artifacts.dumpsys_accessibility import DumpsysAccessibility
|
||||
from mvt.common.indicators import Indicators
|
||||
|
||||
from ..utils import get_artifact
|
||||
|
||||
|
||||
class TestDumpsysAccessibilityArtifact:
|
||||
def test_parsing(self):
|
||||
da = DumpsysAccessibility()
|
||||
file = get_artifact("android_data/dumpsys_accessibility.txt")
|
||||
with open(file) as f:
|
||||
data = f.read()
|
||||
|
||||
assert len(da.results) == 0
|
||||
da.parse(data)
|
||||
assert len(da.results) == 4
|
||||
assert da.results[0]["package_name"] == "com.android.settings"
|
||||
assert (
|
||||
da.results[0]["service"]
|
||||
== "com.android.settings/com.samsung.android.settings.development.gpuwatch.GPUWatchInterceptor"
|
||||
)
|
||||
|
||||
def test_ioc_check(self, indicator_file):
|
||||
da = DumpsysAccessibility()
|
||||
file = get_artifact("android_data/dumpsys_accessibility.txt")
|
||||
with open(file) as f:
|
||||
data = f.read()
|
||||
da.parse(data)
|
||||
|
||||
ind = Indicators(log=logging.getLogger())
|
||||
ind.parse_stix2(indicator_file)
|
||||
ind.ioc_collections[0]["app_ids"].append("com.sec.android.app.camera")
|
||||
da.indicators = ind
|
||||
assert len(da.detected) == 0
|
||||
da.check_indicators()
|
||||
assert len(da.detected) == 1
|
||||
0
tests/android_adb/__init__.py
Normal file
0
tests/android_adb/__init__.py
Normal file
40
tests/artifacts/android_data/dumpsys_accessibility.txt
Normal file
40
tests/artifacts/android_data/dumpsys_accessibility.txt
Normal file
@@ -0,0 +1,40 @@
|
||||
ACCESSIBILITY MANAGER (dumpsys accessibility)
|
||||
|
||||
User state[attributes:{id=0, currentUser=true
|
||||
mIsNavBarMagnificationAssignedToAccessibilityButton = false
|
||||
|
||||
mIsNavBarMagnifierWindowAssignedToAccessibilityButton = false
|
||||
mIsNavBarAmplifyAmbientSoundAssignedToAccessibilityButton = false
|
||||
mIsAmplifyAmbientSoundEnabled = false
|
||||
mIsBixbyRunning = false
|
||||
mIsMagniferWindowEnabled = false
|
||||
mIsFollowTypingFocusEnabled = false
|
||||
mIsTapDurationEnabled = false
|
||||
mIsTouchBlockingEnabled = false
|
||||
mIsTextHighContrastEnabled = false
|
||||
mIsDisplayMagnificationEnabled = false
|
||||
mIsNavBarMagnificationEnabled = false
|
||||
mIsAutoclickEnabled = false
|
||||
mIsPerformGesturesEnabled = false
|
||||
mIsFilterKeyEventsEnabled = false
|
||||
mAccessibilityFocusOnlyInActiveWindow = true
|
||||
mUserNonInteractiveUiTimeout = 0
|
||||
mUserInteractiveUiTimeout = 0
|
||||
mBindInstantServiceAllowed = false
|
||||
mIsGestureNaviBar = false
|
||||
}
|
||||
installed services: {
|
||||
0 : com.android.settings/com.samsung.android.settings.development.gpuwatch.GPUWatchInterceptor
|
||||
1 : com.samsung.accessibility/.universalswitch.UniversalSwitchService
|
||||
2 : com.samsung.accessibility/com.samsung.android.app.talkback.TalkBackService
|
||||
3 : com.sec.android.app.camera/com.samsung.android.glview.AccessibilityGestureHandler
|
||||
}
|
||||
enabled services: {
|
||||
}
|
||||
binding services: {
|
||||
}
|
||||
bound services:{
|
||||
}
|
||||
AccessibilityInputFilter:{
|
||||
}]
|
||||
|
||||
Reference in New Issue
Block a user