Improves check-androidqf tests

This commit is contained in:
tek
2022-10-11 13:07:24 +02:00
parent ba0106c476
commit 66c015bc23
12 changed files with 389 additions and 0 deletions
View File
@@ -0,0 +1,22 @@
# Mobile Verification Toolkit (MVT) - Private
# Copyright (c) 2021-2022 Claudio Guarnieri.
# This file is part of MVT Private and its content is confidential.
# Please refer to the project maintainers before sharing with others.
import logging
from mvt.common.module import run_module
from mvt.android.modules.androidqf.dumpsys_accessibility import \
DumpsysAccessibility
from ..utils import get_android_androidqf
class TestDumpsysAccessibilityModule:
def test_parsing(self):
data_path = get_android_androidqf()
m = DumpsysAccessibility(target_path=data_path)
run_module(m)
assert len(m.results) == 4
assert len(m.detected) == 0
@@ -0,0 +1,22 @@
# Mobile Verification Toolkit (MVT) - Private
# Copyright (c) 2021-2022 Claudio Guarnieri.
# This file is part of MVT Private and its content is confidential.
# Please refer to the project maintainers before sharing with others.
import logging
from mvt.common.module import run_module
from mvt.android.modules.androidqf.dumpsys_appops import DumpsysAppops
from ..utils import get_android_androidqf
class TestDumpsysAppOpsModule:
def test_parsing(self):
data_path = get_android_androidqf()
m = DumpsysAppops(target_path=data_path)
run_module(m)
assert len(m.results) == 12
assert len(m.timeline) == 16
assert len(m.detected) == 0
@@ -0,0 +1,37 @@
# Mobile Verification Toolkit (MVT) - Private
# Copyright (c) 2021-2022 Claudio Guarnieri.
# This file is part of MVT Private and its content is confidential.
# Please refer to the project maintainers before sharing with others.
import logging
from mvt.common.indicators import Indicators
from mvt.common.module import run_module
from mvt.android.modules.androidqf.dumpsys_packages import DumpsysPackages
from ..utils import get_android_androidqf
class TestDumpsysPackagesModule:
def test_parsing(self):
data_path = get_android_androidqf()
m = DumpsysPackages(target_path=data_path)
run_module(m)
assert len(m.results) == 2
assert len(m.detected) == 0
assert len(m.timeline) == 6
assert m.results[0]["package_name"] == "com.samsung.android.provider.filterprovider"
def test_detection_pkgname(self, indicator_file):
data_path = get_android_androidqf()
m = DumpsysPackages(target_path=data_path)
ind = Indicators(log=logging.getLogger())
ind.parse_stix2(indicator_file)
ind.ioc_collections[0]["app_ids"].append("com.sec.android.app.DataCreate")
m.indicators = ind
run_module(m)
assert len(m.results) == 2
assert len(m.detected) == 1
assert len(m.timeline) == 6
assert m.detected[0]["package_name"] == "com.sec.android.app.DataCreate"
@@ -0,0 +1,21 @@
# Mobile Verification Toolkit (MVT) - Private
# Copyright (c) 2021-2022 Claudio Guarnieri.
# This file is part of MVT Private and its content is confidential.
# Please refer to the project maintainers before sharing with others.
import logging
from mvt.common.module import run_module
from mvt.android.modules.androidqf.dumpsys_receivers import DumpsysReceivers
from ..utils import get_android_androidqf
class TestDumpsysReceiversModule:
def test_parsing(self):
data_path = get_android_androidqf()
m = DumpsysReceivers(target_path=data_path)
run_module(m)
assert len(m.results) == 4
assert len(m.detected) == 0
+22
View File
@@ -0,0 +1,22 @@
# Mobile Verification Toolkit (MVT)
# Copyright (c) 2021-2022 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 os
import logging
from mvt.android.modules.androidqf.getprop import Getprop
from mvt.common.module import run_module
from ..utils import get_artifact_folder
class TestAndroidqfGetpropAnalysis:
def test_androidqf_getprop(self):
m = Getprop(target_path=os.path.join(get_artifact_folder(), "androidqf"), log=logging)
run_module(m)
assert len(m.results) == 10
assert len(m.timeline) == 0
assert len(m.detected) == 0
+21
View File
@@ -0,0 +1,21 @@
# Mobile Verification Toolkit (MVT)
# Copyright (c) 2021-2022 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 os
import logging
from mvt.android.modules.androidqf.processes import Processes
from mvt.common.module import run_module
from ..utils import get_artifact_folder
class TestAndroidqfProcessesAnalysis:
def test_androidqf_processes(self):
m = Processes(target_path=os.path.join(get_artifact_folder(), "androidqf"), log=logging)
run_module(m)
assert len(m.results) == 15
assert len(m.timeline) == 0
assert len(m.detected) == 0
+20
View File
@@ -0,0 +1,20 @@
# Mobile Verification Toolkit (MVT) - Private
# Copyright (c) 2021-2022 Claudio Guarnieri.
# This file is part of MVT Private and its content is confidential.
# Please refer to the project maintainers before sharing with others.
from mvt.common.module import run_module
from mvt.android.modules.androidqf.settings import Settings
from ..utils import get_android_androidqf
class TestSettingsModule:
def test_parsing(self):
data_path = get_android_androidqf()
m = Settings(target_path=data_path)
run_module(m)
assert len(m.results) == 1
assert "random" in m.results.keys()
assert len(m.detected) == 0
+21
View File
@@ -0,0 +1,21 @@
# Mobile Verification Toolkit (MVT)
# Copyright (c) 2021-2022 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 os
import logging
from mvt.android.modules.androidqf.sms import SMS
from mvt.common.module import run_module
from ..utils import get_artifact_folder
class TestAndroidqfSMSAnalysis:
def test_androidqf_sms(self):
m = SMS(target_path=os.path.join(get_artifact_folder(), "androidqf"), log=logging)
run_module(m)
assert len(m.results) == 2
assert len(m.timeline) == 0
assert len(m.detected) == 0