mirror of
https://github.com/mvt-project/mvt.git
synced 2024-07-01 00:19:02 +00:00
32 lines
1.0 KiB
Python
32 lines
1.0 KiB
Python
# 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 logging
|
||
|
||
from mvt.common.module import run_module
|
||
from mvt.ios.modules.usb.processes import Processes
|
||
from mvt.common.indicators import Indicators
|
||
|
||
|
||
class TestUSBProcesses:
|
||
def test_run(self, mocker, indicator_file):
|
||
# Mock
|
||
mocker.patch("pymobiledevice3.services.base_service.BaseService.__init__")
|
||
mocker.patch(
|
||
"pymobiledevice3.services.os_trace.OsTraceService.get_pid_list",
|
||
return_value={"Payload": {"1": {"ProcessName": "storebookkeeperd"}, "1854": {"ProcessName": "cfprefssd"}}}
|
||
)
|
||
|
||
# indicators
|
||
ind = Indicators(log=logging)
|
||
ind.parse_stix2(indicator_file)
|
||
ind.ioc_collections[0]["processes"].append("cfprefssd")
|
||
|
||
m = Processes(log=logging)
|
||
m.indicators = ind
|
||
run_module(m)
|
||
assert len(m.results) == 2
|
||
assert len(m.detected) == 1
|