forked from p15670423/monkey
Fixed scoutsuite backend bugs
This commit is contained in:
parent
dc295d4a60
commit
3b0a8e87c2
|
@ -12,8 +12,9 @@ class ScoutSuiteDataJson(Document):
|
|||
# LOGIC
|
||||
@staticmethod
|
||||
def add_scoutsuite_data(scoutsuite_data: str) -> None:
|
||||
current_data = ScoutSuiteDataJson.objects()
|
||||
if not current_data:
|
||||
try:
|
||||
current_data = ScoutSuiteDataJson.objects()[0]
|
||||
except IndexError:
|
||||
current_data = ScoutSuiteDataJson()
|
||||
current_data.scoutsuite_data = scoutsuite_data
|
||||
current_data.save()
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
from mongoengine import StringField, EmbeddedDocument, ListField, \
|
||||
IntField
|
||||
IntField, DynamicField
|
||||
|
||||
from monkey_island.cc.services.zero_trust.scoutsuite.consts import rule_consts
|
||||
|
||||
|
@ -22,5 +22,5 @@ class ScoutSuiteRule(EmbeddedDocument):
|
|||
service = StringField(required=True)
|
||||
rationale = StringField(required=True)
|
||||
remediation = StringField(required=False)
|
||||
compliance = StringField(required=False)
|
||||
compliance = DynamicField(required=False)
|
||||
references = ListField(required=False)
|
||||
|
|
|
@ -43,7 +43,7 @@ class Report(flask_restful.Resource):
|
|||
try:
|
||||
data = ScoutSuiteDataJson.objects.get().scoutsuite_data
|
||||
except Exception:
|
||||
data = {}
|
||||
data = "{}"
|
||||
return Response(data, mimetype='application/json')
|
||||
|
||||
flask_restful.abort(http.client.NOT_FOUND)
|
||||
|
|
Loading…
Reference in New Issue