Skip to content

Commit 5dfee08

Browse files
authored
Make collection report consistent (#75)
Remove the successful execution of the glob from the report, this makes the output report of dissect more consistent. (DIS-1935)
1 parent 8bc78d2 commit 5dfee08

File tree

4 files changed

+203
-102
lines changed

4 files changed

+203
-102
lines changed

acquire/acquire.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -868,20 +868,20 @@ class AV(Module):
868868
("glob", "sysvol/ProgramData/Emsisoft/Reports/scan*.txt"),
869869
# F-Secure
870870
("dir", "sysvol/ProgramData/F-Secure/Log"),
871-
("dir", "sysvol/Users*/AppData/Local/F-Secure/Log"),
871+
("dir", "AppData/Local/F-Secure/Log", from_user_home),
872872
("dir", "sysvol/ProgramData/F-Secure/Antivirus/ScheduledScanReports"),
873873
# HitmanPro
874874
("dir", "sysvol/ProgramData/HitmanPro/Logs"),
875875
("dir", "sysvol/ProgramData/HitmanPro.Alert/Logs"),
876876
("file", "sysvol/ProgramData/HitmanPro.Alert/excalibur.db"),
877-
("glob", "sysvol/ProgramData/HitmanPro/Quarantine"),
877+
("dir", "sysvol/ProgramData/HitmanPro/Quarantine"),
878878
# Malwarebytes
879879
("glob", "sysvol/ProgramData/Malwarebytes/Malwarebytes Anti-Malware/Logs/mbam-log-*.xml"),
880880
("glob", "sysvol/ProgramData/Malwarebytes/MBAMService/logs/mbamservice.log*"),
881-
("dir", "sysvol/Users*/AppData/Roaming/Malwarebytes/Malwarebytes Anti-Malware/Logs"),
881+
("dir", "AppData/Roaming/Malwarebytes/Malwarebytes Anti-Malware/Logs", from_user_home),
882882
("dir", "sysvol/ProgramData/Malwarebytes/MBAMService/ScanResults"),
883883
# McAfee
884-
("dir", "sysvol/Users/All Users/Application Data/McAfee/DesktopProtection"),
884+
("dir", "Application Data/McAfee/DesktopProtection", from_user_home),
885885
("dir", "sysvol/ProgramData/McAfee/DesktopProtection"),
886886
("dir", "sysvol/ProgramData/McAfee/Endpoint Security/Logs"),
887887
("dir", "sysvol/ProgramData/McAfee/Endpoint Security/Logs_Old"),
@@ -891,7 +891,7 @@ class AV(Module):
891891
# RogueKiller
892892
("glob", "sysvol/ProgramData/RogueKiller/logs/AdliceReport_*.json"),
893893
# SUPERAntiSpyware
894-
("dir", "sysvol/Users*/AppData/Roaming/SUPERAntiSpyware/Logs"),
894+
("dir", "AppData/Roaming/SUPERAntiSpyware/Logs", from_user_home),
895895
# SecureAge
896896
("dir", "sysvol/ProgramData/SecureAge Technology/SecureAge/log"),
897897
# SentinelOne
@@ -972,7 +972,7 @@ class History(Module):
972972
("dir", "AppData/Local/Microsoft/Internet Explorer/Recovery", from_user_home),
973973
("file", "AppData/Local/Microsoft/Windows/History/History.IE5/index.dat", from_user_home),
974974
(
975-
"file",
975+
"glob",
976976
"AppData/Local/Microsoft/Windows/History/History.IE5/MSHist*/index.dat",
977977
from_user_home,
978978
),
@@ -982,7 +982,7 @@ class History(Module):
982982
from_user_home,
983983
),
984984
(
985-
"file",
985+
"glob",
986986
"AppData/Local/Microsoft/Windows/History/Low/History.IE5/MSHist*/index.dat",
987987
from_user_home,
988988
),

acquire/collector.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -114,9 +114,6 @@ def add_file_failed(self, module: str, failed_path: Path) -> None:
114114
def add_file_missing(self, module: str, missing_path: Path) -> None:
115115
self._register(module, Outcome.MISSING, ArtifactType.FILE, missing_path)
116116

117-
def add_glob_collected(self, module: str, pattern: str) -> None:
118-
self._register(module, Outcome.SUCCESS, ArtifactType.GLOB, pattern)
119-
120117
def add_glob_failed(self, module: str, failed_pattern: str) -> None:
121118
exc = get_formatted_exception()
122119
self._register(module, Outcome.FAILURE, ArtifactType.GLOB, failed_pattern, exc)
@@ -367,7 +364,7 @@ def collect_glob(self, pattern: str, module_name: Optional[str] = None) -> None:
367364
if glob_is_empty:
368365
self.report.add_glob_empty(module_name, pattern)
369366
else:
370-
self.report.add_glob_collected(module_name, pattern)
367+
log.info("- Collecting glob %s succeeded", pattern)
371368

372369
def collect_path(
373370
self,

tests/test_acquire_modules.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
from textwrap import indent
2+
3+
import pytest
4+
5+
from acquire.acquire import MODULES
6+
7+
8+
@pytest.mark.parametrize("module", MODULES.keys())
9+
def test_validate_module_spec(module):
10+
data_in_spec = []
11+
for spec in MODULES[module].SPEC:
12+
type, collectable, *_ = spec
13+
if type == "glob":
14+
data_in_spec.append(spec + ("*" in collectable,))
15+
else:
16+
data_in_spec.append(spec + ("*" not in collectable,))
17+
18+
faulty_specs = list(filter(lambda x: x[-1] is False, data_in_spec))
19+
formatted_specs = "\n".join([f"({spec[0]!r}, {spec[1]!r}) was faulty" for spec in faulty_specs])
20+
assert len(faulty_specs) == 0, f"{module}:\n{indent(formatted_specs, prefix=' ')}"

0 commit comments

Comments
 (0)