Renamed some files and other minor improvements

This commit is contained in:
VakarisZ 2021-01-29 12:35:40 +02:00
parent 2549e1f345
commit a836ab7e1d
9 changed files with 19 additions and 19 deletions

View File

@ -1,7 +1,7 @@
from mongoengine import Document, DynamicField
class ScoutSuiteDataJson(Document):
class ScoutSuiteRawDataJson(Document):
"""
This model is a container for ScoutSuite report data dump.
"""
@ -13,8 +13,8 @@ class ScoutSuiteDataJson(Document):
@staticmethod
def add_scoutsuite_data(scoutsuite_data: str) -> None:
try:
current_data = ScoutSuiteDataJson.objects()[0]
current_data = ScoutSuiteRawDataJson.objects()[0]
except IndexError:
current_data = ScoutSuiteDataJson()
current_data = ScoutSuiteRawDataJson()
current_data.scoutsuite_data = scoutsuite_data
current_data.save()

View File

@ -6,7 +6,7 @@ import monkey_island.cc.services.config
__author__ = "VakarisZ"
from monkey_island.cc.consts import MONKEY_ISLAND_ABS_PATH
from monkey_island.cc.server_utils.consts import MONKEY_ISLAND_ABS_PATH
logger = logging.getLogger(__name__)

View File

@ -1,8 +1,8 @@
import json
from monkey_island.cc.database import mongo
from monkey_island.cc.models.zero_trust.scoutsuite_data_json import ScoutSuiteDataJson
from ...zero_trust.scoutsuite.consts.findings_list import SCOUTSUITE_FINDINGS
from monkey_island.cc.models.zero_trust.scoutsuite_data_json import ScoutSuiteRawDataJson
from ...zero_trust.scoutsuite.consts.scoutsuite_findings_list import SCOUTSUITE_FINDINGS
from ...zero_trust.scoutsuite.data_parsing.rule_parser import RuleParser
from ...zero_trust.scoutsuite.scoutsuite_zt_finding_service import ScoutSuiteZTFindingService
from ...zero_trust.scoutsuite.scoutsuite_rule_service import ScoutSuiteRuleService
@ -11,7 +11,7 @@ from ...zero_trust.scoutsuite.scoutsuite_rule_service import ScoutSuiteRuleServi
def process_scoutsuite_telemetry(telemetry_json):
# Encode data to json, because mongo can't save it as document (invalid document keys)
telemetry_json['data'] = json.dumps(telemetry_json['data'])
ScoutSuiteDataJson.add_scoutsuite_data(telemetry_json['data'])
ScoutSuiteRawDataJson.add_scoutsuite_data(telemetry_json['data'])
scoutsuite_data = json.loads(telemetry_json['data'])['data']
create_scoutsuite_findings(scoutsuite_data)
update_data(telemetry_json)

View File

@ -1,8 +0,0 @@
from .findings import (DataLossPrevention, Logging,
PermissiveFirewallRules,
RestrictivePolicies,
SecureAuthentication, ServiceSecurity,
UnencryptedData)
SCOUTSUITE_FINDINGS = [PermissiveFirewallRules, UnencryptedData, DataLossPrevention, SecureAuthentication,
RestrictivePolicies, Logging, ServiceSecurity]

View File

@ -0,0 +1,8 @@
from .scoutsuite_findings import (DataLossPrevention, Logging,
PermissiveFirewallRules,
RestrictivePolicies,
SecureAuthentication, ServiceSecurity,
UnencryptedData)
SCOUTSUITE_FINDINGS = [PermissiveFirewallRules, UnencryptedData, DataLossPrevention, SecureAuthentication,
RestrictivePolicies, Logging, ServiceSecurity]

View File

@ -4,7 +4,7 @@ from common.common_consts import zero_trust_consts
from monkey_island.cc.models.zero_trust.finding import Finding
from monkey_island.cc.models.zero_trust.scoutsuite_finding_details import ScoutSuiteFindingDetails
from monkey_island.cc.models.zero_trust.scoutsuite_rule import ScoutSuiteRule
from monkey_island.cc.services.zero_trust.scoutsuite.consts.findings import ScoutSuiteFinding
from monkey_island.cc.services.zero_trust.scoutsuite.consts.scoutsuite_findings import ScoutSuiteFinding
from monkey_island.cc.services.zero_trust.scoutsuite.scoutsuite_rule_service import ScoutSuiteRuleService

View File

@ -1,6 +1,6 @@
from monkey_island.cc.models.zero_trust.scoutsuite_finding_details import ScoutSuiteFindingDetails
from monkey_island.cc.models.zero_trust.scoutsuite_rule import ScoutSuiteRule
from monkey_island.cc.services.zero_trust.scoutsuite.consts.findings import PermissiveFirewallRules, UnencryptedData
from ..scoutsuite.consts.scoutsuite_findings import PermissiveFirewallRules, UnencryptedData
SCOUTSUITE_FINDINGS = [
PermissiveFirewallRules,

View File

@ -1,4 +1,4 @@
from monkey_island.cc.models.zero_trust.scoutsuite_data_json import ScoutSuiteDataJson
from monkey_island.cc.models.zero_trust.scoutsuite_data_json import ScoutSuiteRawDataJson
class ScoutSuiteRawDataService:
@ -8,6 +8,6 @@ class ScoutSuiteRawDataService:
@staticmethod
def get_scoutsuite_data_json() -> str:
try:
return ScoutSuiteDataJson.objects.get().scoutsuite_data
return ScoutSuiteRawDataJson.objects.get().scoutsuite_data
except Exception:
return "{}"