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