From 7cc3e824032a4f77b4fc185963fc96cf34069efc Mon Sep 17 00:00:00 2001 From: divious1 Date: Thu, 24 Jun 2021 14:44:11 -0400 Subject: [PATCH 1/4] fixing a bug in how data is reported also added some additonal print statements --- bin/reporting.py | 13 +++++++++---- bin/reporting/detection_count.svg | 2 +- bin/reporting/detection_coverage.svg | 2 +- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/bin/reporting.py b/bin/reporting.py index 371785f7c0..189f932470 100644 --- a/bin/reporting.py +++ b/bin/reporting.py @@ -30,6 +30,7 @@ def load_file(file_path): def main(args): + print("generated reporting information for our detections") # process all detections REPO_PATH = os.path.join(os.path.dirname(__file__), '../') @@ -42,13 +43,14 @@ def main(args): detections_all = detections.copy() - #lets exclude all deprecated detections from our reporting + #lets exclude all deprecated detections from our reporting and experimental # detections_all.extend(load_objects("detections/deprecated/*.yml", REPO_PATH)) - - detections_all.extend(load_objects("detections/experimental/*/*.yml", REPO_PATH)) + # detections_all.extend(load_objects("detections/experimental/*/*.yml", REPO_PATH)) count_detections_all = len(detections_all) + print("detection count: {}".format(count_detections_all)) tests = load_objects("tests/*/*.yml", REPO_PATH) + print("test count: {}".format(len(tests))) counter_tests=0 counter_detection=0 @@ -59,8 +61,9 @@ def main(args): for test in tests: counter_tests=counter_tests+1 + detection_coverage = "{:.0%}".format(counter_detection/counter_tests) - detection_coverage = "{:.0%}".format(counter_tests/counter_detection) + print("detection_coverage {}".format(detection_coverage)) TEMPLATE_PATH = os.path.join(os.path.dirname(__file__), 'jinja2_templates') OUTPUT_PATH = os.path.join(os.path.dirname(__file__), 'reporting') @@ -70,12 +73,14 @@ def main(args): output = template.render(detection_coverage=detection_coverage) with open(output_path, 'w', encoding="utf-8") as f: f.write(output) + print("writting detection coverage report: {}".format(output_path)) template = j2_env.get_template('detection_count.j2') output_path = path.join(OUTPUT_PATH, 'detection_count.svg') output = template.render(detection_count=count_detections_all) with open(output_path, 'w', encoding="utf-8") as f: f.write(output) + print("writting detection count report: {}".format(output_path)) if __name__ == "__main__": diff --git a/bin/reporting/detection_count.svg b/bin/reporting/detection_count.svg index b8211b491e..34dd27b7c5 100644 --- a/bin/reporting/detection_count.svg +++ b/bin/reporting/detection_count.svg @@ -13,6 +13,6 @@ detections - 440 + 368 \ No newline at end of file diff --git a/bin/reporting/detection_coverage.svg b/bin/reporting/detection_coverage.svg index ed37733b35..c516490f8f 100644 --- a/bin/reporting/detection_coverage.svg +++ b/bin/reporting/detection_coverage.svg @@ -13,6 +13,6 @@ coverage - 100% + 99% \ No newline at end of file From df8ff867bb1d65f3545e9951bff03e53ba9ce77b Mon Sep 17 00:00:00 2001 From: divious1 Date: Thu, 24 Jun 2021 15:08:40 -0400 Subject: [PATCH 2/4] updating circleci image since there is a breaking change --- .circleci/config.yml | 2 +- bin/doc_gen.py | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 18b23deaf3..28e9cf20cb 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -40,7 +40,7 @@ apt-run: &apt-install executors: content-executor: docker: - - image: circleci/python:latest + - image: cimg/python:3.9.5-browsers working_directory: ~/repo jobs: diff --git a/bin/doc_gen.py b/bin/doc_gen.py index e7782313aa..da2f252ca4 100644 --- a/bin/doc_gen.py +++ b/bin/doc_gen.py @@ -43,7 +43,6 @@ def generate_doc_stories(REPO_PATH, OUTPUT_DIR, TEMPLATE_PATH, attack, sorted_de manifest_files = [] for root, dirs, files in walk(REPO_PATH + '/stories'): for file in files: - print(root) if file.endswith(".yml") and root == './stories': manifest_files.append((path.join(root, file))) From ea80ec525ba0be2347b55470bad0348751c362ba Mon Sep 17 00:00:00 2001 From: divious1 Date: Thu, 24 Jun 2021 15:57:07 -0400 Subject: [PATCH 3/4] removing go --- .circleci/config.yml | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 28e9cf20cb..c8f5f42512 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -24,18 +24,6 @@ apt-run: &apt-install command: | sudo apt update -qq sudo apt install -y python-dev python3-dev jq -qq - # install go for other testing tools - # but first lets clean up the env - if [ -f goinstall.sh ]; then - rm goinstall.sh - fi - if [ -d ~/.go ]; then - rm -rf ~/.go - fi - wget https://raw.githubusercontent.com/canha/golang-tools-install-script/master/goinstall.sh - sudo chown circleci goinstall.sh - chmod +x goinstall.sh - ./goinstall.sh executors: content-executor: From 3c39aa59ae4a67159f46f20615e87726bcc26271 Mon Sep 17 00:00:00 2001 From: divious1 Date: Fri, 25 Jun 2021 08:41:48 -0400 Subject: [PATCH 4/4] with the change of the default image pip is treated slightly different --- .circleci/config.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index efeda8e679..7fde44e68c 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -181,8 +181,6 @@ jobs: name: install splunk packaging toolkit (slim) command: | cd ~/slim-latest - sudo pip install --upgrade pip setuptools - sudo pip install virtualenv virtualenv --python=/usr/bin/python2.7 --clear venv source venv/bin/activate pip install semantic_version