Adds check of process name in paths in indicators

This commit is contained in:
tek
2022-08-23 13:18:42 +02:00
parent 528d43b914
commit 2365175dbd
4 changed files with 59 additions and 8 deletions
+21
View File
@@ -436,6 +436,27 @@ class Indicators:
return None
def check_file_path_process(self, file_path: str) -> Union[dict, None]:
"""Check the provided file path contains a process name from the
list of indicators
:param file_path: File path or file name to check against file
indicators
:type file_path: str
:returns: Indicator details if matched, otherwise None
"""
if not file_path:
return None
for ioc in self.get_iocs("processes"):
parts = file_path.split("/")
if ioc["value"] in parts:
self.log.warning("Found known suspicious process name mentioned in file at "
"path \"%s\" matching indicators from \"%s\"",
file_path, ioc["name"])
return ioc
def check_profile(self, profile_uuid: str) -> Union[dict, None]:
"""Check the provided configuration profile UUID against the list of
indicators.
+4 -8
View File
@@ -57,14 +57,10 @@ class Filesystem(IOSExtraction):
if self.fast_mode:
continue
for ioc in self.indicators.get_iocs("processes"):
parts = result["path"].split("/")
if ioc["value"] in parts:
self.log.warning("Found known suspicious process name mentioned in file at "
"path \"%s\" matching indicators from \"%s\"",
result["path"], ioc["name"])
result["matched_indicator"] = ioc
self.detected.append(result)
ioc = self.indicators.check_file_path_process(result["path"])
if ioc:
result["matched_indicator"] = ioc
self.detected.append(result)
def run(self) -> None:
for root, dirs, files in os.walk(self.target_path):