mvt/tests/android/test_dumpsys_parser.py

28 lines
999 B
Python
Raw Normal View History

2022-03-29 23:16:22 +00:00
# Mobile Verification Toolkit (MVT)
# Copyright (c) 2021-2022 Claudio Guarnieri.
2022-03-29 23:16:22 +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/
from mvt.android.parsers.dumpsys import parse_dumpsys_appops
from ..utils import get_artifact
class TestDumpsysParsing:
2022-06-17 15:07:36 +00:00
2022-03-29 23:16:22 +00:00
def test_appops_parsing(self):
file = get_artifact("android_data/dumpsys_appops.txt")
with open(file) as f:
data = f.read()
res = parse_dumpsys_appops(data)
assert len(res) == 12
assert res[0]["package_name"] == "com.android.phone"
2022-03-29 23:16:22 +00:00
assert res[0]["uid"] == "0"
assert len(res[0]["permissions"]) == 1
assert res[0]["permissions"][0]["name"] == "MANAGE_IPSEC_TUNNELS"
assert res[0]["permissions"][0]["access"] == "allow"
assert res[6]["package_name"] == "com.sec.factory.camera"
2022-03-29 23:16:22 +00:00
assert len(res[6]["permissions"][1]["entries"]) == 1
assert len(res[11]["permissions"]) == 4