From dba6767016b5d51531a736965ff53eb46c3ecf46 Mon Sep 17 00:00:00 2001 From: pyth0n1c <87383215+pyth0n1c@users.noreply.github.com> Date: Sun, 11 Sep 2022 11:42:02 -0700 Subject: [PATCH] More progress towards generating the output summary. --- .../modules/test_objects.py | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/bin/docker_detection_tester/modules/test_objects.py b/bin/docker_detection_tester/modules/test_objects.py index 3ca30686c7..55aa802d71 100644 --- a/bin/docker_detection_tester/modules/test_objects.py +++ b/bin/docker_detection_tester/modules/test_objects.py @@ -240,6 +240,32 @@ class ResultsManager: return background def generate_summary_section(self)->dict: + results = [] + for detection in self.detections: + success = True + tests = [] + thisDetection = {"name" : detection.detectionFile.name, + "id" : detection.detectionFile.id, + "search": detection.detectionFile.search, + "path" : detection.detectionFile.path, + "tests" : tests} + for test in detection.testFile.tests: + if test.result is None: + raise(Exception(f"Detection {detection.detectionFile.name}, Test {test.name} in file {detection.testFile.path} was None, but should not be!")) + testResult = { + "name": test.name, + "attack_data": [d.data for d in test.attack_data], + "success": test.result.success, + "logic": test.result.logic, + "noise": test.result.noise, + "performance": test.result.performance, + "resultCount": test.result.resultCount, + "runDuration": test.result.runDuration, + } + tests.append(testResult) + success = success and test.result.success + thisDetection['success'] = success + return {} def generate_detections_section(self)->dict: