Fixed import statements and their ordering

This commit is contained in:
VakarisZ 2020-10-06 13:18:50 +03:00
parent 179823c29e
commit 39523504c3
64 changed files with 203 additions and 139 deletions

View File

@ -14,8 +14,8 @@ from infection_monkey.exploit.tools.helpers import (build_monkey_commandline,
get_monkey_depth,
get_target_monkey)
from infection_monkey.exploit.tools.http_tools import HTTPTools
from infection_monkey.model import (CHMOD_MONKEY, DOWNLOAD_TIMEOUT, MONKEY_ARG,
RUN_MONKEY, WGET_HTTP_UPLOAD)
from infection_monkey.model import (
CHMOD_MONKEY, DOWNLOAD_TIMEOUT, MONKEY_ARG, RUN_MONKEY, WGET_HTTP_UPLOAD)
from infection_monkey.telemetry.attack.t1222_telem import T1222Telem
LOG = getLogger(__name__)

View File

@ -1,6 +1,7 @@
import subprocess
from common.common_consts.post_breach_consts import POST_BREACH_CLEAR_CMD_HISTORY
from common.common_consts.post_breach_consts import \
POST_BREACH_CLEAR_CMD_HISTORY
from infection_monkey.post_breach.clear_command_history.clear_command_history import \
get_commands_to_clear_command_history
from infection_monkey.post_breach.pba import PBA

View File

@ -3,7 +3,8 @@ import random
import string
import subprocess
from common.common_consts.post_breach_consts import POST_BREACH_COMMUNICATE_AS_NEW_USER
from common.common_consts.post_breach_consts import \
POST_BREACH_COMMUNICATE_AS_NEW_USER
from infection_monkey.post_breach.pba import PBA
from infection_monkey.telemetry.post_breach_telem import PostBreachTelem
from infection_monkey.utils.auto_new_user_factory import create_auto_new_user

View File

@ -1,4 +1,5 @@
from common.common_consts.post_breach_consts import POST_BREACH_ACCOUNT_DISCOVERY
from common.common_consts.post_breach_consts import \
POST_BREACH_ACCOUNT_DISCOVERY
from infection_monkey.post_breach.account_discovery.account_discovery import \
get_commands_to_discover_accounts
from infection_monkey.post_breach.pba import PBA

View File

@ -1,7 +1,8 @@
import logging
import subprocess
from common.common_consts.post_breach_consts import POST_BREACH_SIGNED_SCRIPT_PROXY_EXEC
from common.common_consts.post_breach_consts import \
POST_BREACH_SIGNED_SCRIPT_PROXY_EXEC
from infection_monkey.post_breach.pba import PBA
from infection_monkey.post_breach.signed_script_proxy.signed_script_proxy import (
cleanup_changes, get_commands_to_proxy_execution_using_signed_script)

View File

@ -4,7 +4,8 @@ from enum import IntEnum
import psutil
from common.common_consts.system_info_collectors_names import AZURE_CRED_COLLECTOR
from common.common_consts.system_info_collectors_names import \
AZURE_CRED_COLLECTOR
from infection_monkey.network.info import get_host_subnets
from infection_monkey.system_info.azure_cred_collector import AzureCollector
from infection_monkey.system_info.netstat_collector import NetstatCollector

View File

@ -4,7 +4,8 @@ from common.cloud.aws.aws_instance import AwsInstance
from common.cloud.scoutsuite_consts import PROVIDERS
from common.common_consts.system_info_collectors_names import AWS_COLLECTOR
from common.network.network_utils import is_running_on_island
from infection_monkey.system_info.collectors.scoutsuite_collector.scoutsuite_collector import scan_cloud_security
from infection_monkey.system_info.collectors.scoutsuite_collector.scoutsuite_collector import \
scan_cloud_security
from infection_monkey.system_info.system_info_collector import \
SystemInfoCollector

View File

@ -1,6 +1,7 @@
from common.cloud.all_instances import get_all_cloud_instances
from common.cloud.environment_names import Environment
from common.common_consts.system_info_collectors_names import ENVIRONMENT_COLLECTOR
from common.common_consts.system_info_collectors_names import \
ENVIRONMENT_COLLECTOR
from infection_monkey.system_info.system_info_collector import \
SystemInfoCollector

View File

@ -1,7 +1,8 @@
import logging
import socket
from common.common_consts.system_info_collectors_names import HOSTNAME_COLLECTOR
from common.common_consts.system_info_collectors_names import \
HOSTNAME_COLLECTOR
from infection_monkey.system_info.system_info_collector import \
SystemInfoCollector

View File

@ -2,7 +2,8 @@ import logging
import psutil
from common.common_consts.system_info_collectors_names import PROCESS_LIST_COLLECTOR
from common.common_consts.system_info_collectors_names import \
PROCESS_LIST_COLLECTOR
from infection_monkey.system_info.system_info_collector import \
SystemInfoCollector

View File

@ -2,8 +2,8 @@ import logging
import infection_monkey.system_info.collectors.scoutsuite_collector.scoutsuite_api as scoutsuite_api
from common.cloud.scoutsuite_consts import PROVIDERS
from infection_monkey.telemetry.scoutsuite_telem import ScoutSuiteTelem
from infection_monkey.config import WormConfiguration
from infection_monkey.telemetry.scoutsuite_telem import ScoutSuiteTelem
logger = logging.getLogger(__name__)

View File

@ -2,7 +2,8 @@ import logging
import os
import sys
from common.common_consts.system_info_collectors_names import MIMIKATZ_COLLECTOR
from common.common_consts.system_info_collectors_names import \
MIMIKATZ_COLLECTOR
from infection_monkey.system_info.windows_cred_collector.mimikatz_cred_collector import \
MimikatzCredentialCollector

View File

@ -1,6 +1,6 @@
from common.common_consts.telem_categories import TelemCategoryEnum
from common.cloud.scoutsuite.ScoutSuite.output.result_encoder import \
ScoutJsonEncoder
from common.common_consts.telem_categories import TelemCategoryEnum
from infection_monkey.telemetry.base_telem import BaseTelem

View File

@ -47,8 +47,10 @@ from monkey_island.cc.resources.test.monkey_test import MonkeyTest
from monkey_island.cc.resources.version_update import VersionUpdate
from monkey_island.cc.resources.zero_trust.finding_event import \
ZeroTrustFindingEvent
from monkey_island.cc.resources.zero_trust.scoutsuite_auth.aws_keys import AWSKeys
from monkey_island.cc.resources.zero_trust.scoutsuite_auth.scoutsuite_auth import ScoutSuiteAuth
from monkey_island.cc.resources.zero_trust.scoutsuite_auth.aws_keys import \
AWSKeys
from monkey_island.cc.resources.zero_trust.scoutsuite_auth.scoutsuite_auth import \
ScoutSuiteAuth
from monkey_island.cc.services.database import Database
from monkey_island.cc.services.remote_run_aws import RemoteRunAwsService
from monkey_island.cc.services.representations import output_json

View File

@ -4,13 +4,15 @@ Define a Document Schema for Zero Trust findings.
"""
from typing import Union
from mongoengine import Document, StringField, GenericLazyReferenceField
from mongoengine import Document, GenericLazyReferenceField, StringField
import common.common_consts.zero_trust_consts as zero_trust_consts
# Dummy import for mongoengine.
# noinspection PyUnresolvedReferences
from monkey_island.cc.models.zero_trust.monkey_finding_details import MonkeyFindingDetails
from monkey_island.cc.models.zero_trust.scoutsuite_finding_details import ScoutSuiteFindingDetails
from monkey_island.cc.models.zero_trust.monkey_finding_details import \
MonkeyFindingDetails
from monkey_island.cc.models.zero_trust.scoutsuite_finding_details import \
ScoutSuiteFindingDetails
class Finding(Document):

View File

@ -1,5 +1,5 @@
from mongoengine import StringField, EmbeddedDocument, ListField, \
IntField, DynamicField
from mongoengine import (DynamicField, EmbeddedDocument, IntField, ListField,
StringField)
from monkey_island.cc.services.zero_trust.scoutsuite.consts import rule_consts

View File

@ -4,9 +4,10 @@ import mongomock
from packaging import version
import common.common_consts.zero_trust_consts as zero_trust_consts
from monkey_island.cc.services.zero_trust.monkey_finding_service import MonkeyFindingService
from monkey_island.cc.models.zero_trust.event import Event
from monkey_island.cc.models.zero_trust.finding import Finding
from monkey_island.cc.services.zero_trust.monkey_finding_service import \
MonkeyFindingService
from monkey_island.cc.testing.IslandTestCase import IslandTestCase

View File

@ -1,9 +1,10 @@
import http.client
import flask_restful
from flask import jsonify, Response
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.services.reporting.report import ReportService
from monkey_island.cc.services.zero_trust.finding_service import FindingService

View File

@ -3,7 +3,8 @@ import json
import flask_restful
from monkey_island.cc.resources.auth.auth import jwt_required
from monkey_island.cc.services.zero_trust.monkey_finding_service import MonkeyFindingService
from monkey_island.cc.services.zero_trust.monkey_finding_service import \
MonkeyFindingService
class ZeroTrustFindingEvent(flask_restful.Resource):

View File

@ -1,7 +1,8 @@
import flask_restful
from monkey_island.cc.resources.auth.auth import jwt_required
from monkey_island.cc.services.zero_trust.scoutsuite.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):

View File

@ -6,8 +6,8 @@ from flask import request
from common.cloud.scoutsuite_consts import PROVIDERS
from common.utils.exceptions import InvalidAWSKeys
from monkey_island.cc.resources.auth.auth import jwt_required
from monkey_island.cc.services.zero_trust.scoutsuite.scoutsuite_auth_service import is_cloud_authentication_setup, \
set_aws_keys
from monkey_island.cc.services.zero_trust.scoutsuite.scoutsuite_auth_service import (
is_cloud_authentication_setup, set_aws_keys)
class ScoutSuiteAuth(flask_restful.Resource):

View File

@ -4,7 +4,8 @@ from monkey_island.cc.services.config import ConfigService
__author__ = "VakarisZ"
from monkey_island.cc.services.config_schema.config_value_paths import CURRENT_SERVER_PATH
from monkey_island.cc.services.config_schema.config_value_paths import \
CURRENT_SERVER_PATH
class T1065(AttackTechnique):

View File

@ -1,4 +1,5 @@
from common.common_consts.post_breach_consts import POST_BREACH_ACCOUNT_DISCOVERY
from common.common_consts.post_breach_consts import \
POST_BREACH_ACCOUNT_DISCOVERY
from monkey_island.cc.services.attack.technique_reports.pba_technique import \
PostBreachTechnique

View File

@ -1,4 +1,5 @@
from common.common_consts.post_breach_consts import POST_BREACH_CLEAR_CMD_HISTORY
from common.common_consts.post_breach_consts import \
POST_BREACH_CLEAR_CMD_HISTORY
from monkey_island.cc.services.attack.technique_reports.pba_technique import \
PostBreachTechnique

View File

@ -1,4 +1,5 @@
from common.common_consts.post_breach_consts import POST_BREACH_SIGNED_SCRIPT_PROXY_EXEC
from common.common_consts.post_breach_consts import \
POST_BREACH_SIGNED_SCRIPT_PROXY_EXEC
from monkey_island.cc.services.attack.technique_reports.pba_technique import \
PostBreachTechnique

View File

@ -14,9 +14,10 @@ from monkey_island.cc.services.config_schema.config_schema import SCHEMA
__author__ = "itay.mizeretz"
from monkey_island.cc.services.config_schema.config_value_paths import STARTED_ON_ISLAND_PATH, \
EXPORT_MONKEY_TELEMS_PATH, SSH_KEYS_PATH, USER_LIST_PATH, PASSWORD_LIST_PATH, \
LM_HASH_LIST_PATH, NTLM_HASH_LIST_PATH, AWS_KEYS_PATH
from monkey_island.cc.services.config_schema.config_value_paths import (
AWS_KEYS_PATH, EXPORT_MONKEY_TELEMS_PATH, LM_HASH_LIST_PATH,
NTLM_HASH_LIST_PATH, PASSWORD_LIST_PATH, SSH_KEYS_PATH,
STARTED_ON_ISLAND_PATH, USER_LIST_PATH)
logger = logging.getLogger(__name__)

View File

@ -1,9 +1,6 @@
from common.common_consts.system_info_collectors_names import (AWS_COLLECTOR,
AZURE_CRED_COLLECTOR,
ENVIRONMENT_COLLECTOR,
HOSTNAME_COLLECTOR,
MIMIKATZ_COLLECTOR,
PROCESS_LIST_COLLECTOR)
from common.common_consts.system_info_collectors_names import (
AWS_COLLECTOR, AZURE_CRED_COLLECTOR, ENVIRONMENT_COLLECTOR,
HOSTNAME_COLLECTOR, MIMIKATZ_COLLECTOR, PROCESS_LIST_COLLECTOR)
SYSTEM_INFO_COLLECTOR_CLASSES = {
"title": "System Information Collectors",

View File

@ -1,9 +1,6 @@
from common.common_consts.system_info_collectors_names import (AWS_COLLECTOR,
AZURE_CRED_COLLECTOR,
ENVIRONMENT_COLLECTOR,
HOSTNAME_COLLECTOR,
MIMIKATZ_COLLECTOR,
PROCESS_LIST_COLLECTOR)
from common.common_consts.system_info_collectors_names import (
AWS_COLLECTOR, AZURE_CRED_COLLECTOR, ENVIRONMENT_COLLECTOR,
HOSTNAME_COLLECTOR, MIMIKATZ_COLLECTOR, PROCESS_LIST_COLLECTOR)
MONKEY = {
"title": "Monkey",

View File

@ -1,5 +1,6 @@
from monkey_island.cc.services.config import ConfigService
from monkey_island.cc.services.config_schema.config_value_paths import INACCESSIBLE_SUBNETS_PATH
from monkey_island.cc.services.config_schema.config_value_paths import \
INACCESSIBLE_SUBNETS_PATH
def get_config_network_segments_as_subnet_groups():

View File

@ -12,8 +12,9 @@ from monkey_island.cc.database import mongo
from monkey_island.cc.models import Monkey
from monkey_island.cc.network_utils import get_subnets, local_ip_addresses
from monkey_island.cc.services.config import ConfigService
from monkey_island.cc.services.config_schema.config_value_paths import USER_LIST_PATH, \
PASSWORD_LIST_PATH, EXPLOITER_CLASSES_PATH, SUBNET_SCAN_LIST_PATH, LOCAL_NETWORK_SCAN_PATH
from monkey_island.cc.services.config_schema.config_value_paths import (
EXPLOITER_CLASSES_PATH, LOCAL_NETWORK_SCAN_PATH, PASSWORD_LIST_PATH,
SUBNET_SCAN_LIST_PATH, USER_LIST_PATH)
from monkey_island.cc.services.configuration.utils import \
get_config_network_segments_as_subnet_groups
from monkey_island.cc.services.node import NodeService

View File

@ -1,6 +1,7 @@
import copy
from common.common_consts.post_breach_consts import POST_BREACH_COMMUNICATE_AS_NEW_USER
from common.common_consts.post_breach_consts import \
POST_BREACH_COMMUNICATE_AS_NEW_USER
from monkey_island.cc.database import mongo
from monkey_island.cc.models import Monkey
from monkey_island.cc.services.telemetry.zero_trust_checks.communicate_as_new_user import \

View File

@ -7,14 +7,14 @@ from monkey_island.cc.services.telemetry.processing.post_breach import \
process_post_breach_telemetry
from monkey_island.cc.services.telemetry.processing.scan import \
process_scan_telemetry
from monkey_island.cc.services.telemetry.processing.scoutsuite import \
process_scoutsuite_telemetry
from monkey_island.cc.services.telemetry.processing.state import \
process_state_telemetry
from monkey_island.cc.services.telemetry.processing.system_info import \
process_system_info_telemetry
from monkey_island.cc.services.telemetry.processing.tunnel import \
process_tunnel_telemetry
from monkey_island.cc.services.telemetry.processing.scoutsuite import \
process_scoutsuite_telemetry
logger = logging.getLogger(__name__)

View File

@ -1,12 +1,16 @@
import json
from monkey_island.cc.database import mongo
from monkey_island.cc.models.zero_trust.scoutsuite_data_json import ScoutSuiteDataJson
from monkey_island.cc.services.zero_trust.scoutsuite.consts.findings_list import SCOUTSUITE_FINDINGS
from monkey_island.cc.services.zero_trust.scoutsuite.data_parsing.rule_parsing import RuleParser
from monkey_island.cc.services.zero_trust.scoutsuite.scoutsuite_finding_service import ScoutSuiteFindingService
from monkey_island.cc.services.zero_trust.scoutsuite.scoutsuite_rule_service import ScoutSuiteRuleService
from monkey_island.cc.models.zero_trust.scoutsuite_data_json import \
ScoutSuiteDataJson
from monkey_island.cc.services.zero_trust.scoutsuite.consts.findings_list import \
SCOUTSUITE_FINDINGS
from monkey_island.cc.services.zero_trust.scoutsuite.data_parsing.rule_parsing import \
RuleParser
from monkey_island.cc.services.zero_trust.scoutsuite.scoutsuite_finding_service import \
ScoutSuiteFindingService
from monkey_island.cc.services.zero_trust.scoutsuite.scoutsuite_rule_service import \
ScoutSuiteRuleService
def process_scoutsuite_telemetry(telemetry_json):

View File

@ -1,5 +1,5 @@
import logging
import json
import logging
logger = logging.getLogger(__name__)

View File

@ -1,11 +1,9 @@
import logging
import typing
from common.common_consts.system_info_collectors_names import (AWS_COLLECTOR,
ENVIRONMENT_COLLECTOR,
HOSTNAME_COLLECTOR,
PROCESS_LIST_COLLECTOR,
SCOUTSUITE_COLLECTOR)
from common.common_consts.system_info_collectors_names import (
AWS_COLLECTOR, ENVIRONMENT_COLLECTOR, HOSTNAME_COLLECTOR,
PROCESS_LIST_COLLECTOR, SCOUTSUITE_COLLECTOR)
from monkey_island.cc.services.telemetry.processing.system_info_collectors.aws import \
process_aws_telemetry
from monkey_island.cc.services.telemetry.processing.system_info_collectors.environment import \

View File

@ -5,7 +5,8 @@ from monkey_island.cc.models import Monkey
from monkey_island.cc.models.zero_trust.event import Event
from monkey_island.cc.services.telemetry.zero_trust_checks.known_anti_viruses import \
ANTI_VIRUS_KNOWN_PROCESS_NAMES
from monkey_island.cc.services.zero_trust.monkey_finding_service import MonkeyFindingService
from monkey_island.cc.services.zero_trust.monkey_finding_service import \
MonkeyFindingService
def check_antivirus_existence(process_list_json, monkey_guid):

View File

@ -1,6 +1,7 @@
import common.common_consts.zero_trust_consts as zero_trust_consts
from monkey_island.cc.services.zero_trust.monkey_finding_service import MonkeyFindingService
from monkey_island.cc.models.zero_trust.event import Event
from monkey_island.cc.services.zero_trust.monkey_finding_service import \
MonkeyFindingService
COMM_AS_NEW_USER_FAILED_FORMAT = "Monkey on {} couldn't communicate as new user. Details: {}"
COMM_AS_NEW_USER_SUCCEEDED_FORMAT = \

View File

@ -4,7 +4,8 @@ import common.common_consts.zero_trust_consts as zero_trust_consts
from common.common_consts.network_consts import ES_SERVICE
from monkey_island.cc.models import Monkey
from monkey_island.cc.models.zero_trust.event import Event
from monkey_island.cc.services.zero_trust.monkey_finding_service import MonkeyFindingService
from monkey_island.cc.services.zero_trust.monkey_finding_service import \
MonkeyFindingService
HTTP_SERVERS_SERVICES_NAMES = ['tcp-80']

View File

@ -1,6 +1,7 @@
import common.common_consts.zero_trust_consts as zero_trust_consts
from monkey_island.cc.models.zero_trust.event import Event
from monkey_island.cc.services.zero_trust.monkey_finding_service import MonkeyFindingService
from monkey_island.cc.services.zero_trust.monkey_finding_service import \
MonkeyFindingService
def check_machine_exploited(current_monkey, exploit_successful, exploiter, target_ip, timestamp):

View File

@ -3,7 +3,8 @@ from monkey_island.cc.models import Monkey
from monkey_island.cc.models.zero_trust.event import Event
from monkey_island.cc.services.telemetry.processing.utils import \
get_tunnel_host_ip_from_proxy_field
from monkey_island.cc.services.zero_trust.monkey_finding_service import MonkeyFindingService
from monkey_island.cc.services.zero_trust.monkey_finding_service import \
MonkeyFindingService
def check_tunneling_violation(tunnel_telemetry_json):

View File

@ -2,7 +2,8 @@ from typing import List
from bson import ObjectId
from monkey_island.cc.models.zero_trust.monkey_finding_details import MonkeyFindingDetails
from monkey_island.cc.models.zero_trust.monkey_finding_details import \
MonkeyFindingDetails
# How many events of a single finding to return to UI.
# 50 will return 50 latest and 50 oldest events from a finding

View File

@ -5,7 +5,8 @@ from bson import ObjectId
from common.common_consts import zero_trust_consts
from monkey_island.cc.models.zero_trust.event import Event
from monkey_island.cc.models.zero_trust.finding import Finding
from monkey_island.cc.models.zero_trust.monkey_finding_details import MonkeyFindingDetails
from monkey_island.cc.models.zero_trust.monkey_finding_details import \
MonkeyFindingDetails
class MonkeyFindingService:

View File

@ -1,19 +1,34 @@
from common.common_consts import zero_trust_consts
from monkey_island.cc.services.zero_trust.scoutsuite.consts.rule_names.cloudformation_rules import CloudformationRules
from monkey_island.cc.services.zero_trust.scoutsuite.consts.rule_names.cloudtrail_rules import CloudTrailRules
from monkey_island.cc.services.zero_trust.scoutsuite.consts.rule_names.cloudwatch_rules import CloudWatchRules
from monkey_island.cc.services.zero_trust.scoutsuite.consts.rule_names.config_rules import ConfigRules
from monkey_island.cc.services.zero_trust.scoutsuite.consts.rule_names.ec2_rules import EC2Rules
from monkey_island.cc.services.zero_trust.scoutsuite.consts.rule_names.elb_rules import ELBRules
from monkey_island.cc.services.zero_trust.scoutsuite.consts.rule_names.elbv2_rules import ELBv2Rules
from monkey_island.cc.services.zero_trust.scoutsuite.consts.rule_names.rds_rules import RDSRules
from monkey_island.cc.services.zero_trust.scoutsuite.consts.rule_names.redshift_rules import RedshiftRules
from monkey_island.cc.services.zero_trust.scoutsuite.consts.rule_names.s3_rules import S3Rules
from monkey_island.cc.services.zero_trust.scoutsuite.consts.rule_names.iam_rules import IAMRules
from monkey_island.cc.services.zero_trust.scoutsuite.consts.rule_names.ses_rules import SESRules
from monkey_island.cc.services.zero_trust.scoutsuite.consts.rule_names.sns_rules import SNSRules
from monkey_island.cc.services.zero_trust.scoutsuite.consts.rule_names.sqs_rules import SQSRules
from monkey_island.cc.services.zero_trust.scoutsuite.consts.rule_names.vpc_rules import VPCRules
from monkey_island.cc.services.zero_trust.scoutsuite.consts.rule_names.cloudformation_rules import \
CloudformationRules
from monkey_island.cc.services.zero_trust.scoutsuite.consts.rule_names.cloudtrail_rules import \
CloudTrailRules
from monkey_island.cc.services.zero_trust.scoutsuite.consts.rule_names.cloudwatch_rules import \
CloudWatchRules
from monkey_island.cc.services.zero_trust.scoutsuite.consts.rule_names.config_rules import \
ConfigRules
from monkey_island.cc.services.zero_trust.scoutsuite.consts.rule_names.ec2_rules import \
EC2Rules
from monkey_island.cc.services.zero_trust.scoutsuite.consts.rule_names.elb_rules import \
ELBRules
from monkey_island.cc.services.zero_trust.scoutsuite.consts.rule_names.elbv2_rules import \
ELBv2Rules
from monkey_island.cc.services.zero_trust.scoutsuite.consts.rule_names.iam_rules import \
IAMRules
from monkey_island.cc.services.zero_trust.scoutsuite.consts.rule_names.rds_rules import \
RDSRules
from monkey_island.cc.services.zero_trust.scoutsuite.consts.rule_names.redshift_rules import \
RedshiftRules
from monkey_island.cc.services.zero_trust.scoutsuite.consts.rule_names.s3_rules import \
S3Rules
from monkey_island.cc.services.zero_trust.scoutsuite.consts.rule_names.ses_rules import \
SESRules
from monkey_island.cc.services.zero_trust.scoutsuite.consts.rule_names.sns_rules import \
SNSRules
from monkey_island.cc.services.zero_trust.scoutsuite.consts.rule_names.sqs_rules import \
SQSRules
from monkey_island.cc.services.zero_trust.scoutsuite.consts.rule_names.vpc_rules import \
VPCRules
class PERMISSIVE_FIREWALL_RULES:

View File

@ -1,5 +1,7 @@
from monkey_island.cc.services.zero_trust.scoutsuite.consts.findings import PERMISSIVE_FIREWALL_RULES, \
UNENCRYPTED_DATA, DATA_LOSS_PREVENTION, SECURE_AUTHENTICATION, RESTRICTIVE_POLICIES, LOGGING, SERVICE_SECURITY
from monkey_island.cc.services.zero_trust.scoutsuite.consts.findings import (
DATA_LOSS_PREVENTION, LOGGING, PERMISSIVE_FIREWALL_RULES,
RESTRICTIVE_POLICIES, SECURE_AUTHENTICATION, SERVICE_SECURITY,
UNENCRYPTED_DATA)
SCOUTSUITE_FINDINGS = [PERMISSIVE_FIREWALL_RULES, UNENCRYPTED_DATA, DATA_LOSS_PREVENTION, SECURE_AUTHENTICATION,
RESTRICTIVE_POLICIES, LOGGING, SERVICE_SECURITY]

View File

@ -1,6 +1,5 @@
from enum import Enum
SERVICES = 'services'
FINDINGS = 'findings'

View File

@ -1,7 +1,8 @@
from abc import ABC, abstractmethod
from typing import List
from monkey_island.cc.services.zero_trust.scoutsuite.consts.service_consts import SERVICES, FINDINGS, SERVICE_TYPES
from monkey_island.cc.services.zero_trust.scoutsuite.consts.service_consts import (
FINDINGS, SERVICE_TYPES, SERVICES)
class AbstractRulePathCreator(ABC):

View File

@ -1,4 +1,5 @@
from monkey_island.cc.services.zero_trust.scoutsuite.consts.rule_names.cloudformation_rules import CloudformationRules
from monkey_island.cc.services.zero_trust.scoutsuite.consts.rule_names.cloudformation_rules import \
CloudformationRules
from monkey_island.cc.services.zero_trust.scoutsuite.consts.service_consts import \
SERVICE_TYPES
from monkey_island.cc.services.zero_trust.scoutsuite.data_parsing.rule_path_building.abstract_rule_path_creator import \

View File

@ -1,4 +1,5 @@
from monkey_island.cc.services.zero_trust.scoutsuite.consts.rule_names.cloudtrail_rules import CloudTrailRules
from monkey_island.cc.services.zero_trust.scoutsuite.consts.rule_names.cloudtrail_rules import \
CloudTrailRules
from monkey_island.cc.services.zero_trust.scoutsuite.consts.service_consts import \
SERVICE_TYPES
from monkey_island.cc.services.zero_trust.scoutsuite.data_parsing.rule_path_building.abstract_rule_path_creator import \

View File

@ -1,4 +1,5 @@
from monkey_island.cc.services.zero_trust.scoutsuite.consts.rule_names.cloudwatch_rules import CloudWatchRules
from monkey_island.cc.services.zero_trust.scoutsuite.consts.rule_names.cloudwatch_rules import \
CloudWatchRules
from monkey_island.cc.services.zero_trust.scoutsuite.consts.service_consts import \
SERVICE_TYPES
from monkey_island.cc.services.zero_trust.scoutsuite.data_parsing.rule_path_building.abstract_rule_path_creator import \

View File

@ -1,4 +1,5 @@
from monkey_island.cc.services.zero_trust.scoutsuite.consts.rule_names.config_rules import ConfigRules
from monkey_island.cc.services.zero_trust.scoutsuite.consts.rule_names.config_rules import \
ConfigRules
from monkey_island.cc.services.zero_trust.scoutsuite.consts.service_consts import \
SERVICE_TYPES
from monkey_island.cc.services.zero_trust.scoutsuite.data_parsing.rule_path_building.abstract_rule_path_creator import \

View File

@ -1,4 +1,5 @@
from monkey_island.cc.services.zero_trust.scoutsuite.consts.rule_names.ec2_rules import EC2Rules
from monkey_island.cc.services.zero_trust.scoutsuite.consts.rule_names.ec2_rules import \
EC2Rules
from monkey_island.cc.services.zero_trust.scoutsuite.consts.service_consts import \
SERVICE_TYPES
from monkey_island.cc.services.zero_trust.scoutsuite.data_parsing.rule_path_building.abstract_rule_path_creator import \

View File

@ -1,4 +1,5 @@
from monkey_island.cc.services.zero_trust.scoutsuite.consts.rule_names.elb_rules import ELBRules
from monkey_island.cc.services.zero_trust.scoutsuite.consts.rule_names.elb_rules import \
ELBRules
from monkey_island.cc.services.zero_trust.scoutsuite.consts.service_consts import \
SERVICE_TYPES
from monkey_island.cc.services.zero_trust.scoutsuite.data_parsing.rule_path_building.abstract_rule_path_creator import \

View File

@ -1,4 +1,5 @@
from monkey_island.cc.services.zero_trust.scoutsuite.consts.rule_names.elbv2_rules import ELBv2Rules
from monkey_island.cc.services.zero_trust.scoutsuite.consts.rule_names.elbv2_rules import \
ELBv2Rules
from monkey_island.cc.services.zero_trust.scoutsuite.consts.service_consts import \
SERVICE_TYPES
from monkey_island.cc.services.zero_trust.scoutsuite.data_parsing.rule_path_building.abstract_rule_path_creator import \

View File

@ -1,4 +1,5 @@
from monkey_island.cc.services.zero_trust.scoutsuite.consts.rule_names.iam_rules import IAMRules
from monkey_island.cc.services.zero_trust.scoutsuite.consts.rule_names.iam_rules import \
IAMRules
from monkey_island.cc.services.zero_trust.scoutsuite.consts.service_consts import \
SERVICE_TYPES
from monkey_island.cc.services.zero_trust.scoutsuite.data_parsing.rule_path_building.abstract_rule_path_creator import \

View File

@ -1,4 +1,5 @@
from monkey_island.cc.services.zero_trust.scoutsuite.consts.rule_names.rds_rules import RDSRules
from monkey_island.cc.services.zero_trust.scoutsuite.consts.rule_names.rds_rules import \
RDSRules
from monkey_island.cc.services.zero_trust.scoutsuite.consts.service_consts import \
SERVICE_TYPES
from monkey_island.cc.services.zero_trust.scoutsuite.data_parsing.rule_path_building.abstract_rule_path_creator import \

View File

@ -1,4 +1,5 @@
from monkey_island.cc.services.zero_trust.scoutsuite.consts.rule_names.redshift_rules import RedshiftRules
from monkey_island.cc.services.zero_trust.scoutsuite.consts.rule_names.redshift_rules import \
RedshiftRules
from monkey_island.cc.services.zero_trust.scoutsuite.consts.service_consts import \
SERVICE_TYPES
from monkey_island.cc.services.zero_trust.scoutsuite.data_parsing.rule_path_building.abstract_rule_path_creator import \

View File

@ -1,4 +1,5 @@
from monkey_island.cc.services.zero_trust.scoutsuite.consts.rule_names.s3_rules import S3Rules
from monkey_island.cc.services.zero_trust.scoutsuite.consts.rule_names.s3_rules import \
S3Rules
from monkey_island.cc.services.zero_trust.scoutsuite.consts.service_consts import \
SERVICE_TYPES
from monkey_island.cc.services.zero_trust.scoutsuite.data_parsing.rule_path_building.abstract_rule_path_creator import \

View File

@ -1,4 +1,5 @@
from monkey_island.cc.services.zero_trust.scoutsuite.consts.rule_names.ses_rules import SESRules
from monkey_island.cc.services.zero_trust.scoutsuite.consts.rule_names.ses_rules import \
SESRules
from monkey_island.cc.services.zero_trust.scoutsuite.consts.service_consts import \
SERVICE_TYPES
from monkey_island.cc.services.zero_trust.scoutsuite.data_parsing.rule_path_building.abstract_rule_path_creator import \

View File

@ -1,4 +1,5 @@
from monkey_island.cc.services.zero_trust.scoutsuite.consts.rule_names.sns_rules import SNSRules
from monkey_island.cc.services.zero_trust.scoutsuite.consts.rule_names.sns_rules import \
SNSRules
from monkey_island.cc.services.zero_trust.scoutsuite.consts.service_consts import \
SERVICE_TYPES
from monkey_island.cc.services.zero_trust.scoutsuite.data_parsing.rule_path_building.abstract_rule_path_creator import \

View File

@ -1,4 +1,5 @@
from monkey_island.cc.services.zero_trust.scoutsuite.consts.rule_names.sqs_rules import SQSRules
from monkey_island.cc.services.zero_trust.scoutsuite.consts.rule_names.sqs_rules import \
SQSRules
from monkey_island.cc.services.zero_trust.scoutsuite.consts.service_consts import \
SERVICE_TYPES
from monkey_island.cc.services.zero_trust.scoutsuite.data_parsing.rule_path_building.abstract_rule_path_creator import \

View File

@ -1,4 +1,5 @@
from monkey_island.cc.services.zero_trust.scoutsuite.consts.rule_names.vpc_rules import VPCRules
from monkey_island.cc.services.zero_trust.scoutsuite.consts.rule_names.vpc_rules import \
VPCRules
from monkey_island.cc.services.zero_trust.scoutsuite.consts.service_consts import \
SERVICE_TYPES
from monkey_island.cc.services.zero_trust.scoutsuite.data_parsing.rule_path_building.abstract_rule_path_creator import \

View File

@ -1,33 +1,33 @@
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
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,

View File

@ -7,7 +7,8 @@ from common.cloud.scoutsuite_consts import PROVIDERS
from common.utils.exceptions import InvalidAWSKeys
from monkey_island.cc.encryptor import encryptor
from monkey_island.cc.services.config import ConfigService
from monkey_island.cc.services.config_schema.config_value_paths import AWS_KEYS_PATH
from monkey_island.cc.services.config_schema.config_value_paths import \
AWS_KEYS_PATH
_scoutsuite_api_package = pkgutil.get_loader('common.cloud.scoutsuite.ScoutSuite.__main__')

View File

@ -2,9 +2,11 @@ from typing import List
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_finding_details import \
ScoutSuiteFindingDetails
from monkey_island.cc.models.zero_trust.scoutsuite_rule import ScoutSuiteRule
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
class ScoutSuiteFindingService: