Island: Remove ScoutSuiteRawDataService

This commit is contained in:
Mike Salvatore 2022-02-01 16:16:02 -05:00 committed by Shreya Malviya
parent a35f141cbe
commit 039a62a224
3 changed files with 1 additions and 43 deletions

View File

@ -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()

View File

@ -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)

View File

@ -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 "{}"