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

View File

@ -6,7 +6,7 @@ import monkey_island.cc.services.config
__author__ = "VakarisZ" __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__) logger = logging.getLogger(__name__)

View File

@ -1,8 +1,8 @@
import json import json
from monkey_island.cc.database import mongo from monkey_island.cc.database import mongo
from monkey_island.cc.models.zero_trust.scoutsuite_data_json import ScoutSuiteDataJson from monkey_island.cc.models.zero_trust.scoutsuite_data_json import ScoutSuiteRawDataJson
from ...zero_trust.scoutsuite.consts.findings_list import SCOUTSUITE_FINDINGS 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.data_parsing.rule_parser import RuleParser
from ...zero_trust.scoutsuite.scoutsuite_zt_finding_service import ScoutSuiteZTFindingService from ...zero_trust.scoutsuite.scoutsuite_zt_finding_service import ScoutSuiteZTFindingService
from ...zero_trust.scoutsuite.scoutsuite_rule_service import ScoutSuiteRuleService 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): def process_scoutsuite_telemetry(telemetry_json):
# Encode data to json, because mongo can't save it as document (invalid document keys) # Encode data to json, because mongo can't save it as document (invalid document keys)
telemetry_json['data'] = json.dumps(telemetry_json['data']) 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'] scoutsuite_data = json.loads(telemetry_json['data'])['data']
create_scoutsuite_findings(scoutsuite_data) create_scoutsuite_findings(scoutsuite_data)
update_data(telemetry_json) 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.finding import Finding
from monkey_island.cc.models.zero_trust.scoutsuite_finding_details import ScoutSuiteFindingDetails 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.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 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_finding_details import ScoutSuiteFindingDetails
from monkey_island.cc.models.zero_trust.scoutsuite_rule import ScoutSuiteRule 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 = [ SCOUTSUITE_FINDINGS = [
PermissiveFirewallRules, 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: class ScoutSuiteRawDataService:
@ -8,6 +8,6 @@ class ScoutSuiteRawDataService:
@staticmethod @staticmethod
def get_scoutsuite_data_json() -> str: def get_scoutsuite_data_json() -> str:
try: try:
return ScoutSuiteDataJson.objects.get().scoutsuite_data return ScoutSuiteRawDataJson.objects.get().scoutsuite_data
except Exception: except Exception:
return "{}" return "{}"