mitre / emu

This CALDERA Plugin converts Adversary Emulation Plans from the Center for Threat Informed Defense
https://caldera.mitre.org/
Apache License 2.0
29 stars 9 forks source link

Search yaml files recursively #5

Closed shiracamus closed 3 years ago

shiracamus commented 3 years ago

The path of the yaml file in the Adversary Emulation Library will be changed. Why don't you try to find the yaml file recursively?

diff --git a/app/emu_svc.py b/app/emu_svc.py
index d52d677..f2f014a 100644
--- a/app/emu_svc.py
+++ b/app/emu_svc.py
@@ -36,12 +36,12 @@ class EmuService(BaseService):
         """

         if not path_yaml:
-            path_yaml = os.path.join(self.repo_dir, '**', '**', '*.yaml')
+            path_yaml = os.path.join(self.repo_dir, '*', '**', '*.yaml')

         at_total = 0
         at_ingested = 0
         errors = 0
-        for filename in glob.iglob(path_yaml):
+        for filename in glob.iglob(path_yaml, recursive=True):
             emulation_plan = self.strip_yml(filename)[0]

             abilities = []
shiracamus commented 3 years ago

The path the yaml files in the Adversary Emulation Library has been changed. https://github.com/center-for-threat-informed-defense/adversary_emulation_library/pull/63/commits/7d2b01280e66471e338ae60391889ef680055e6a

wbooth commented 3 years ago

Yea the hesitation was with the inclusion of the Archive directories (https://github.com/center-for-threat-informed-defense/adversary_emulation_library/tree/master/apt29/Archive) and whether there would be a emulation plan graveyard that wouldn't want to be imported. I've add the recursive search in (https://github.com/mitre/emu/pull/7) and recommended a test within their CI pipeline for checking that the emu plugin works (we'll also add a test on the caldera side when we include as a default plugin)