forked from p34709852/monkey
Removed unsustainable python type hinting rules
This commit is contained in:
parent
2c87784a48
commit
f462fcc842
|
@ -1,8 +1,5 @@
|
|||
from typing import Union
|
||||
|
||||
from common.utils.code_utils import get_object_value_by_path
|
||||
from common.utils.exceptions import RulePathCreatorNotFound
|
||||
from monkey_island.cc.services.zero_trust.scoutsuite.consts.ec2_rules import EC2Rules
|
||||
from monkey_island.cc.services.zero_trust.scoutsuite.data_parsing.rule_path_building.rule_path_creators_list import \
|
||||
RULE_PATH_CREATORS_LIST
|
||||
|
||||
|
@ -10,17 +7,17 @@ from monkey_island.cc.services.zero_trust.scoutsuite.data_parsing.rule_path_buil
|
|||
class RuleParser:
|
||||
|
||||
@staticmethod
|
||||
def get_rule_data(scoutsuite_data, rule_name: Union[EC2Rules]):
|
||||
def get_rule_data(scoutsuite_data, rule_name):
|
||||
rule_path = RuleParser.get_rule_path(rule_name)
|
||||
return get_object_value_by_path(scoutsuite_data, rule_path)
|
||||
|
||||
@staticmethod
|
||||
def get_rule_path(rule_name: Union[EC2Rules]):
|
||||
def get_rule_path(rule_name):
|
||||
creator = RuleParser.get_rule_path_creator(rule_name)
|
||||
return creator.build_rule_path(rule_name)
|
||||
|
||||
@staticmethod
|
||||
def get_rule_path_creator(rule_name: Union[EC2Rules]):
|
||||
def get_rule_path_creator(rule_name):
|
||||
for rule_path_creator in RULE_PATH_CREATORS_LIST:
|
||||
if rule_name in rule_path_creator.supported_rules:
|
||||
return rule_path_creator
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
from abc import ABC, abstractmethod
|
||||
from typing import List, Union
|
||||
from typing import List
|
||||
|
||||
from monkey_island.cc.services.zero_trust.scoutsuite.consts.ec2_rules import EC2Rules
|
||||
from monkey_island.cc.services.zero_trust.scoutsuite.consts.service_consts import SERVICES, FINDINGS, SERVICE_TYPES
|
||||
|
||||
|
||||
|
@ -14,10 +13,10 @@ class AbstractRulePathCreator(ABC):
|
|||
|
||||
@property
|
||||
@abstractmethod
|
||||
def supported_rules(self) -> List[Union[EC2Rules]]:
|
||||
def supported_rules(self) -> List:
|
||||
pass
|
||||
|
||||
@classmethod
|
||||
def build_rule_path(cls, rule_name: Union[EC2Rules]) -> List[str]:
|
||||
def build_rule_path(cls, rule_name) -> List[str]:
|
||||
assert(rule_name in cls.supported_rules)
|
||||
return [SERVICES, cls.service_type.value, FINDINGS, rule_name.value]
|
||||
|
|
Loading…
Reference in New Issue