From 039a62a22477f9aa55a9595fe2895757b6212b39 Mon Sep 17 00:00:00 2001 From: Mike Salvatore Date: Tue, 1 Feb 2022 16:16:02 -0500 Subject: [PATCH] Island: Remove ScoutSuiteRawDataService --- .../models/zero_trust/scoutsuite_data_json.py | 20 ------------------- .../resources/zero_trust/zero_trust_report.py | 11 +--------- .../scoutsuite_raw_data_service.py | 13 ------------ 3 files changed, 1 insertion(+), 43 deletions(-) delete mode 100644 monkey/monkey_island/cc/models/zero_trust/scoutsuite_data_json.py delete mode 100644 monkey/monkey_island/cc/services/zero_trust/zero_trust_report/scoutsuite_raw_data_service.py diff --git a/monkey/monkey_island/cc/models/zero_trust/scoutsuite_data_json.py b/monkey/monkey_island/cc/models/zero_trust/scoutsuite_data_json.py deleted file mode 100644 index 166c247bf..000000000 --- a/monkey/monkey_island/cc/models/zero_trust/scoutsuite_data_json.py +++ /dev/null @@ -1,20 +0,0 @@ -from mongoengine import Document, DynamicField - - -class ScoutSuiteRawDataJson(Document): - """ - This model is a container for ScoutSuite report data dump. - """ - - # SCHEMA - scoutsuite_data = DynamicField(required=True) - - # LOGIC - @staticmethod - def add_scoutsuite_data(scoutsuite_data: str) -> None: - try: - current_data = ScoutSuiteRawDataJson.objects()[0] - except IndexError: - current_data = ScoutSuiteRawDataJson() - current_data.scoutsuite_data = scoutsuite_data - current_data.save() diff --git a/monkey/monkey_island/cc/resources/zero_trust/zero_trust_report.py b/monkey/monkey_island/cc/resources/zero_trust/zero_trust_report.py index 8b3ce9419..491b109dc 100644 --- a/monkey/monkey_island/cc/resources/zero_trust/zero_trust_report.py +++ b/monkey/monkey_island/cc/resources/zero_trust/zero_trust_report.py @@ -1,7 +1,7 @@ import http.client import flask_restful -from flask import Response, jsonify +from flask import jsonify from monkey_island.cc.resources.auth.auth import jwt_required from monkey_island.cc.services.zero_trust.zero_trust_report.finding_service import FindingService @@ -9,14 +9,10 @@ from monkey_island.cc.services.zero_trust.zero_trust_report.pillar_service impor from monkey_island.cc.services.zero_trust.zero_trust_report.principle_service import ( PrincipleService, ) -from monkey_island.cc.services.zero_trust.zero_trust_report.scoutsuite_raw_data_service import ( - ScoutSuiteRawDataService, -) REPORT_DATA_PILLARS = "pillars" REPORT_DATA_FINDINGS = "findings" REPORT_DATA_PRINCIPLES_STATUS = "principles" -REPORT_DATA_SCOUTSUITE = "scoutsuite" class ZeroTrustReport(flask_restful.Resource): @@ -28,10 +24,5 @@ class ZeroTrustReport(flask_restful.Resource): return jsonify(PrincipleService.get_principles_status()) elif report_data == REPORT_DATA_FINDINGS: return jsonify(FindingService.get_all_findings_for_ui()) - elif report_data == REPORT_DATA_SCOUTSUITE: - # Raw ScoutSuite data is already solved as json, no need to jsonify - return Response( - ScoutSuiteRawDataService.get_scoutsuite_data_json(), mimetype="application/json" - ) flask_restful.abort(http.client.NOT_FOUND) diff --git a/monkey/monkey_island/cc/services/zero_trust/zero_trust_report/scoutsuite_raw_data_service.py b/monkey/monkey_island/cc/services/zero_trust/zero_trust_report/scoutsuite_raw_data_service.py deleted file mode 100644 index 3a3c06452..000000000 --- a/monkey/monkey_island/cc/services/zero_trust/zero_trust_report/scoutsuite_raw_data_service.py +++ /dev/null @@ -1,13 +0,0 @@ -from monkey_island.cc.models.zero_trust.scoutsuite_data_json import ScoutSuiteRawDataJson - - -class ScoutSuiteRawDataService: - - # Return unparsed json of ScoutSuite results, - # so that UI can pick out values it needs for report - @staticmethod - def get_scoutsuite_data_json() -> str: - try: - return ScoutSuiteRawDataJson.objects.get().scoutsuite_data - except Exception: - return "{}"