diff --git a/core/schemas/indicator.py b/core/schemas/indicator.py index 2de6868c6..3b578f725 100644 --- a/core/schemas/indicator.py +++ b/core/schemas/indicator.py @@ -246,6 +246,8 @@ def save_indicators(self, create_links: bool = False): # TODO: consider using https://github.com/log2timeline/dfvfs/blob/main/dfvfs/lib/glob2regex.py pattern = ARTIFACT_INTERPOLATION_RE.sub("*", path) pattern = re.escape(pattern).replace("\\*", ".*") + # Account for different path separators + pattern = re.sub(r"\\\\", r"[\\|/]", pattern) indicator = Regex.find(name=path) if not indicator: try: diff --git a/plugins/feeds/public/lolbas.py b/plugins/feeds/public/lolbas.py index 5bdf5dc68..bfc6875c7 100644 --- a/plugins/feeds/public/lolbas.py +++ b/plugins/feeds/public/lolbas.py @@ -41,7 +41,7 @@ def analyze_entry(self, entry: dict): name=entry["Name"], description=description, created=created ).save() entity_slug = entry["Name"].lower().replace(".exe", "") - tool.tag([entity_slug]) + tool.tag([entity_slug, "lolbas"]) tags = set([cmd["Category"].lower() for cmd in entry["Commands"]]) tags.add("lolbas") diff --git a/tests/schemas/indicator.py b/tests/schemas/indicator.py index 0ae604dcc..44a7e217e 100644 --- a/tests/schemas/indicator.py +++ b/tests/schemas/indicator.py @@ -129,7 +129,8 @@ def test_forensics_artifacts_indicator_extraction_file(self) -> None: "%%environ_systemdrive%%\\$Extend\\$UsnJrnl", ) self.assertEqual( - vertices[indicators[4].extended_id].pattern, r".*\\\$Extend\\\$UsnJrnl" + vertices[indicators[4].extended_id].pattern, + r".*[\|/]\$Extend[\|/]\$UsnJrnl", ) self.assertEqual(vertices[indicators[4].extended_id].type, "regex") self.assertEqual(vertices[indicators[4].extended_id].location, "filesystem")