forked from p15670423/monkey
Refactored "scoutsuite_findings" directory back to "scoutsuite" directory, because it doesn't only parse findings
This commit is contained in:
parent
3a9aa3191f
commit
01feea905b
|
@ -1,6 +1,6 @@
|
||||||
from mongoengine import DynamicField, EmbeddedDocument, IntField, ListField, StringField
|
from mongoengine import DynamicField, EmbeddedDocument, IntField, ListField, StringField
|
||||||
|
|
||||||
from monkey_island.cc.services.zero_trust.scoutsuite_findings.consts import rule_consts
|
from monkey_island.cc.services.zero_trust.scoutsuite.consts import rule_consts
|
||||||
|
|
||||||
|
|
||||||
class ScoutSuiteRule(EmbeddedDocument):
|
class ScoutSuiteRule(EmbeddedDocument):
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import flask_restful
|
import flask_restful
|
||||||
|
|
||||||
from monkey_island.cc.resources.auth.auth import jwt_required
|
from monkey_island.cc.resources.auth.auth import jwt_required
|
||||||
from monkey_island.cc.services.zero_trust.scoutsuite_findings.scoutsuite_auth_service import get_aws_keys
|
from monkey_island.cc.services.zero_trust.scoutsuite.scoutsuite_auth_service import get_aws_keys
|
||||||
|
|
||||||
|
|
||||||
class AWSKeys(flask_restful.Resource):
|
class AWSKeys(flask_restful.Resource):
|
||||||
|
|
|
@ -6,7 +6,7 @@ from flask import request
|
||||||
from common.cloud.scoutsuite_consts import CloudProviders
|
from common.cloud.scoutsuite_consts import CloudProviders
|
||||||
from common.utils.exceptions import InvalidAWSKeys
|
from common.utils.exceptions import InvalidAWSKeys
|
||||||
from monkey_island.cc.resources.auth.auth import jwt_required
|
from monkey_island.cc.resources.auth.auth import jwt_required
|
||||||
from monkey_island.cc.services.zero_trust.scoutsuite_findings.scoutsuite_auth_service import (is_cloud_authentication_setup,
|
from monkey_island.cc.services.zero_trust.scoutsuite.scoutsuite_auth_service import (is_cloud_authentication_setup,
|
||||||
set_aws_keys)
|
set_aws_keys)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@ from flask import Response, jsonify
|
||||||
|
|
||||||
from monkey_island.cc.models.zero_trust.scoutsuite_data_json import ScoutSuiteDataJson
|
from monkey_island.cc.models.zero_trust.scoutsuite_data_json import ScoutSuiteDataJson
|
||||||
from monkey_island.cc.resources.auth.auth import jwt_required
|
from monkey_island.cc.resources.auth.auth import jwt_required
|
||||||
from monkey_island.cc.services.zero_trust.zero_trust_finding_service import ZeroTrustFindingService
|
from monkey_island.cc.services.zero_trust.report_data.finding_service import FindingService
|
||||||
from monkey_island.cc.services.zero_trust.zero_trust_service import ZeroTrustService
|
from monkey_island.cc.services.zero_trust.zero_trust_service import ZeroTrustService
|
||||||
|
|
||||||
REPORT_DATA_PILLARS = "pillars"
|
REPORT_DATA_PILLARS = "pillars"
|
||||||
|
@ -27,7 +27,7 @@ class ZeroTrustReport(flask_restful.Resource):
|
||||||
elif report_data == REPORT_DATA_PRINCIPLES_STATUS:
|
elif report_data == REPORT_DATA_PRINCIPLES_STATUS:
|
||||||
return jsonify(ZeroTrustService.get_principles_status())
|
return jsonify(ZeroTrustService.get_principles_status())
|
||||||
elif report_data == REPORT_DATA_FINDINGS:
|
elif report_data == REPORT_DATA_FINDINGS:
|
||||||
return jsonify(ZeroTrustFindingService.get_all_findings())
|
return jsonify(FindingService.get_all_findings())
|
||||||
elif report_data == REPORT_DATA_SCOUTSUITE:
|
elif report_data == REPORT_DATA_SCOUTSUITE:
|
||||||
try:
|
try:
|
||||||
data = ScoutSuiteDataJson.objects.get().scoutsuite_data
|
data = ScoutSuiteDataJson.objects.get().scoutsuite_data
|
||||||
|
|
|
@ -2,10 +2,10 @@ 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 ScoutSuiteDataJson
|
||||||
from ...zero_trust.scoutsuite_findings.consts.findings_list import SCOUTSUITE_FINDINGS
|
from ...zero_trust.scoutsuite.consts.findings_list import SCOUTSUITE_FINDINGS
|
||||||
from ...zero_trust.scoutsuite_findings.data_parsing.rule_parser import RuleParser
|
from ...zero_trust.scoutsuite.data_parsing.rule_parser import RuleParser
|
||||||
from ...zero_trust.scoutsuite_findings.scoutsuite_zt_finding_service import ScoutSuiteZTFindingService
|
from ...zero_trust.scoutsuite.scoutsuite_zt_finding_service import ScoutSuiteZTFindingService
|
||||||
from ...zero_trust.scoutsuite_findings.scoutsuite_rule_service import ScoutSuiteRuleService
|
from ...zero_trust.scoutsuite.scoutsuite_rule_service import ScoutSuiteRuleService
|
||||||
|
|
||||||
|
|
||||||
def process_scoutsuite_telemetry(telemetry_json):
|
def process_scoutsuite_telemetry(telemetry_json):
|
||||||
|
|
|
@ -6,7 +6,7 @@ from monkey_island.cc.models.zero_trust.finding import Finding
|
||||||
from monkey_island.cc.services.zero_trust.monkey_findings.monkey_zt_details_service import MonkeyZTDetailsService
|
from monkey_island.cc.services.zero_trust.monkey_findings.monkey_zt_details_service import MonkeyZTDetailsService
|
||||||
|
|
||||||
|
|
||||||
class ZeroTrustFindingService:
|
class FindingService:
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def get_all_findings() -> List[Finding]:
|
def get_all_findings() -> List[Finding]:
|
||||||
|
@ -19,7 +19,7 @@ class ZeroTrustFindingService:
|
||||||
else:
|
else:
|
||||||
raise UnknownFindingError(f"Unknown finding type {findings[i].finding_type}")
|
raise UnknownFindingError(f"Unknown finding type {findings[i].finding_type}")
|
||||||
findings[i] = findings[i].to_mongo()
|
findings[i] = findings[i].to_mongo()
|
||||||
findings[i] = ZeroTrustFindingService._get_enriched_finding(findings[i])
|
findings[i] = FindingService._get_enriched_finding(findings[i])
|
||||||
findings[i]['details'] = details
|
findings[i]['details'] = details
|
||||||
return findings
|
return findings
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
from common.utils.code_utils import get_dict_value_by_path
|
from common.utils.code_utils import get_dict_value_by_path
|
||||||
from common.utils.exceptions import RulePathCreatorNotFound
|
from common.utils.exceptions import RulePathCreatorNotFound
|
||||||
from monkey_island.cc.services.zero_trust.scoutsuite_findings.data_parsing.rule_path_building.rule_path_creators_list import \
|
from monkey_island.cc.services.zero_trust.scoutsuite.data_parsing.rule_path_building.rule_path_creators_list import \
|
||||||
RULE_PATH_CREATORS_LIST
|
RULE_PATH_CREATORS_LIST
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,35 @@
|
||||||
|
from monkey_island.cc.services.zero_trust.scoutsuite.data_parsing.rule_path_building.rule_path_creators.\
|
||||||
|
cloudformation_rule_path_creator import CloudformationRulePathCreator
|
||||||
|
from monkey_island.cc.services.zero_trust.scoutsuite.data_parsing.rule_path_building.rule_path_creators.\
|
||||||
|
cloudtrail_rule_path_creator import CloudTrailRulePathCreator
|
||||||
|
from monkey_island.cc.services.zero_trust.scoutsuite.data_parsing.rule_path_building.rule_path_creators.\
|
||||||
|
cloudwatch_rule_path_creator import CloudWatchRulePathCreator
|
||||||
|
from monkey_island.cc.services.zero_trust.scoutsuite.data_parsing.rule_path_building.rule_path_creators.\
|
||||||
|
config_rule_path_creator import ConfigRulePathCreator
|
||||||
|
from monkey_island.cc.services.zero_trust.scoutsuite.data_parsing.rule_path_building.rule_path_creators.\
|
||||||
|
ec2_rule_path_creator import EC2RulePathCreator
|
||||||
|
from monkey_island.cc.services.zero_trust.scoutsuite.data_parsing.rule_path_building.rule_path_creators.\
|
||||||
|
elb_rule_path_creator import ELBRulePathCreator
|
||||||
|
from monkey_island.cc.services.zero_trust.scoutsuite.data_parsing.rule_path_building.rule_path_creators.\
|
||||||
|
elbv2_rule_path_creator import ELBv2RulePathCreator
|
||||||
|
from monkey_island.cc.services.zero_trust.scoutsuite.data_parsing.rule_path_building.rule_path_creators.\
|
||||||
|
iam_rule_path_creator import IAMRulePathCreator
|
||||||
|
from monkey_island.cc.services.zero_trust.scoutsuite.data_parsing.rule_path_building.rule_path_creators.\
|
||||||
|
rds_rule_path_creator import RDSRulePathCreator
|
||||||
|
from monkey_island.cc.services.zero_trust.scoutsuite.data_parsing.rule_path_building.rule_path_creators.\
|
||||||
|
redshift_rule_path_creator import RedshiftRulePathCreator
|
||||||
|
from monkey_island.cc.services.zero_trust.scoutsuite.data_parsing.rule_path_building.rule_path_creators.\
|
||||||
|
s3_rule_path_creator import S3RulePathCreator
|
||||||
|
from monkey_island.cc.services.zero_trust.scoutsuite.data_parsing.rule_path_building.rule_path_creators.\
|
||||||
|
ses_rule_path_creator import SESRulePathCreator
|
||||||
|
from monkey_island.cc.services.zero_trust.scoutsuite.data_parsing.rule_path_building.rule_path_creators.\
|
||||||
|
sns_rule_path_creator import SNSRulePathCreator
|
||||||
|
from monkey_island.cc.services.zero_trust.scoutsuite.data_parsing.rule_path_building.rule_path_creators. \
|
||||||
|
sqs_rule_path_creator import SQSRulePathCreator
|
||||||
|
from monkey_island.cc.services.zero_trust.scoutsuite.data_parsing.rule_path_building.rule_path_creators. \
|
||||||
|
vpc_rule_path_creator import VPCRulePathCreator
|
||||||
|
|
||||||
|
RULE_PATH_CREATORS_LIST = [EC2RulePathCreator, ELBv2RulePathCreator, RDSRulePathCreator, RedshiftRulePathCreator,
|
||||||
|
S3RulePathCreator, IAMRulePathCreator, CloudTrailRulePathCreator, ELBRulePathCreator,
|
||||||
|
VPCRulePathCreator, CloudWatchRulePathCreator, SQSRulePathCreator, SNSRulePathCreator,
|
||||||
|
SESRulePathCreator, ConfigRulePathCreator, CloudformationRulePathCreator]
|
|
@ -1,5 +1,5 @@
|
||||||
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_findings.consts import rule_consts
|
from monkey_island.cc.services.zero_trust.scoutsuite.consts import rule_consts
|
||||||
|
|
||||||
|
|
||||||
class ScoutSuiteRuleService:
|
class ScoutSuiteRuleService:
|
|
@ -4,8 +4,8 @@ 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_findings.consts.findings import ScoutSuiteFinding
|
from monkey_island.cc.services.zero_trust.scoutsuite.consts.findings import ScoutSuiteFinding
|
||||||
from monkey_island.cc.services.zero_trust.scoutsuite_findings.scoutsuite_rule_service import ScoutSuiteRuleService
|
from monkey_island.cc.services.zero_trust.scoutsuite.scoutsuite_rule_service import ScoutSuiteRuleService
|
||||||
|
|
||||||
|
|
||||||
class ScoutSuiteZTFindingService:
|
class ScoutSuiteZTFindingService:
|
|
@ -1,35 +0,0 @@
|
||||||
from monkey_island.cc.services.zero_trust.scoutsuite_findings.data_parsing.rule_path_building.rule_path_creators.\
|
|
||||||
cloudformation_rule_path_creator import CloudformationRulePathCreator
|
|
||||||
from monkey_island.cc.services.zero_trust.scoutsuite_findings.data_parsing.rule_path_building.rule_path_creators.\
|
|
||||||
cloudtrail_rule_path_creator import CloudTrailRulePathCreator
|
|
||||||
from monkey_island.cc.services.zero_trust.scoutsuite_findings.data_parsing.rule_path_building.rule_path_creators.\
|
|
||||||
cloudwatch_rule_path_creator import CloudWatchRulePathCreator
|
|
||||||
from monkey_island.cc.services.zero_trust.scoutsuite_findings.data_parsing.rule_path_building.rule_path_creators.\
|
|
||||||
config_rule_path_creator import ConfigRulePathCreator
|
|
||||||
from monkey_island.cc.services.zero_trust.scoutsuite_findings.data_parsing.rule_path_building.rule_path_creators.\
|
|
||||||
ec2_rule_path_creator import EC2RulePathCreator
|
|
||||||
from monkey_island.cc.services.zero_trust.scoutsuite_findings.data_parsing.rule_path_building.rule_path_creators.\
|
|
||||||
elb_rule_path_creator import ELBRulePathCreator
|
|
||||||
from monkey_island.cc.services.zero_trust.scoutsuite_findings.data_parsing.rule_path_building.rule_path_creators.\
|
|
||||||
elbv2_rule_path_creator import ELBv2RulePathCreator
|
|
||||||
from monkey_island.cc.services.zero_trust.scoutsuite_findings.data_parsing.rule_path_building.rule_path_creators.\
|
|
||||||
iam_rule_path_creator import IAMRulePathCreator
|
|
||||||
from monkey_island.cc.services.zero_trust.scoutsuite_findings.data_parsing.rule_path_building.rule_path_creators.\
|
|
||||||
rds_rule_path_creator import RDSRulePathCreator
|
|
||||||
from monkey_island.cc.services.zero_trust.scoutsuite_findings.data_parsing.rule_path_building.rule_path_creators.\
|
|
||||||
redshift_rule_path_creator import RedshiftRulePathCreator
|
|
||||||
from monkey_island.cc.services.zero_trust.scoutsuite_findings.data_parsing.rule_path_building.rule_path_creators.\
|
|
||||||
s3_rule_path_creator import S3RulePathCreator
|
|
||||||
from monkey_island.cc.services.zero_trust.scoutsuite_findings.data_parsing.rule_path_building.rule_path_creators.\
|
|
||||||
ses_rule_path_creator import SESRulePathCreator
|
|
||||||
from monkey_island.cc.services.zero_trust.scoutsuite_findings.data_parsing.rule_path_building.rule_path_creators.\
|
|
||||||
sns_rule_path_creator import SNSRulePathCreator
|
|
||||||
from monkey_island.cc.services.zero_trust.scoutsuite_findings.data_parsing.rule_path_building.rule_path_creators. \
|
|
||||||
sqs_rule_path_creator import SQSRulePathCreator
|
|
||||||
from monkey_island.cc.services.zero_trust.scoutsuite_findings.data_parsing.rule_path_building.rule_path_creators. \
|
|
||||||
vpc_rule_path_creator import VPCRulePathCreator
|
|
||||||
|
|
||||||
RULE_PATH_CREATORS_LIST = [EC2RulePathCreator, ELBv2RulePathCreator, RDSRulePathCreator, RedshiftRulePathCreator,
|
|
||||||
S3RulePathCreator, IAMRulePathCreator, CloudTrailRulePathCreator, ELBRulePathCreator,
|
|
||||||
VPCRulePathCreator, CloudWatchRulePathCreator, SQSRulePathCreator, SNSRulePathCreator,
|
|
||||||
SESRulePathCreator, ConfigRulePathCreator, CloudformationRulePathCreator]
|
|
Loading…
Reference in New Issue