mirror of
https://github.com/mvt-project/mvt.git
synced 2024-06-16 09:44:05 +00:00
Fix repeated results due to global results[] variable
This commit is contained in:
parent
e85c70c603
commit
b2e9f0361b
|
@ -8,18 +8,18 @@ from ..utils import get_backup_folder
|
||||||
|
|
||||||
class TestDatausageModule:
|
class TestDatausageModule:
|
||||||
def test_datausage(self):
|
def test_datausage(self):
|
||||||
m = Datausage(base_folder=get_backup_folder(), log=logging)
|
m = Datausage(base_folder=get_backup_folder(), log=logging, results=[])
|
||||||
run_module(m)
|
run_module(m)
|
||||||
assert len(m.results) == 42
|
assert len(m.results) == 42
|
||||||
assert len(m.timeline) == 60
|
assert len(m.timeline) == 60
|
||||||
assert len(m.detected) == 0
|
assert len(m.detected) == 0
|
||||||
|
|
||||||
def test_detection(self, indicator_file):
|
def test_detection(self, indicator_file):
|
||||||
m = Datausage(base_folder=get_backup_folder(), log=logging)
|
m = Datausage(base_folder=get_backup_folder(), log=logging, results=[])
|
||||||
ind = Indicators(log=logging)
|
ind = Indicators(log=logging)
|
||||||
ind.parse_stix2(indicator_file)
|
ind.parse_stix2(indicator_file)
|
||||||
# Adds a file that exists in the manifest
|
# Adds a file that exists in the manifest
|
||||||
ind.ioc_processes[0] = "CumulativeUsageTracker"
|
ind.ioc_processes[0] = "CumulativeUsageTracker"
|
||||||
m.indicators = ind
|
m.indicators = ind
|
||||||
run_module(m)
|
run_module(m)
|
||||||
assert len(m.detected) == 4
|
assert len(m.detected) == 2
|
||||||
|
|
|
@ -9,18 +9,18 @@ from ..utils import get_backup_folder
|
||||||
|
|
||||||
class TestManifestModule:
|
class TestManifestModule:
|
||||||
def test_manifest(self):
|
def test_manifest(self):
|
||||||
m = Manifest(base_folder=get_backup_folder(), log=logging)
|
m = Manifest(base_folder=get_backup_folder(), log=logging, results=[])
|
||||||
run_module(m)
|
run_module(m)
|
||||||
assert len(m.results) == 3721
|
assert len(m.results) == 3721
|
||||||
assert len(m.timeline) == 5881
|
assert len(m.timeline) == 5881
|
||||||
assert len(m.detected) == 0
|
assert len(m.detected) == 0
|
||||||
|
|
||||||
def test_detection(self, indicator_file):
|
def test_detection(self, indicator_file):
|
||||||
m = Manifest(base_folder=get_backup_folder(), log=logging)
|
m = Manifest(base_folder=get_backup_folder(), log=logging, results=[])
|
||||||
ind = Indicators(log=logging)
|
ind = Indicators(log=logging)
|
||||||
ind.parse_stix2(indicator_file)
|
ind.parse_stix2(indicator_file)
|
||||||
# Adds a file that exists in the manifest
|
# Adds a file that exists in the manifest
|
||||||
ind.ioc_files[0] = "com.apple.CoreBrightness.plist"
|
ind.ioc_files[0] = "com.apple.CoreBrightness.plist"
|
||||||
m.indicators = ind
|
m.indicators = ind
|
||||||
run_module(m)
|
run_module(m)
|
||||||
assert len(m.detected) == 2
|
assert len(m.detected) == 1
|
||||||
|
|
|
@ -7,7 +7,16 @@ from ..utils import get_backup_folder
|
||||||
|
|
||||||
class TestManifestModule:
|
class TestManifestModule:
|
||||||
def test_manifest(self):
|
def test_manifest(self):
|
||||||
m = TCC(base_folder=get_backup_folder(), log=logging)
|
m = TCC(base_folder=get_backup_folder(), log=logging, results=[])
|
||||||
|
run_module(m)
|
||||||
|
assert len(m.results) == 11
|
||||||
|
assert len(m.timeline) == 11
|
||||||
|
assert len(m.detected) == 0
|
||||||
|
assert m.results[0]["service"] == "kTCCServiceUbiquity"
|
||||||
|
assert m.results[0]["auth_value"] == "allowed"
|
||||||
|
|
||||||
|
def test_manifest_2(self):
|
||||||
|
m = TCC(base_folder=get_backup_folder(), log=logging, results=[])
|
||||||
run_module(m)
|
run_module(m)
|
||||||
assert len(m.results) == 11
|
assert len(m.results) == 11
|
||||||
assert len(m.timeline) == 11
|
assert len(m.timeline) == 11
|
||||||
|
|
Loading…
Reference in New Issue
Block a user