forked from p34709852/monkey
island: Move code for generating reverse schema into functions for better readibility
This commit is contained in:
parent
e42a9d8b8f
commit
55fcfa9813
|
@ -15,6 +15,13 @@ def get_config_schema_per_attack_technique(schema: Dict) -> Dict[str, Dict[str,
|
|||
"""
|
||||
reverse_schema = {}
|
||||
|
||||
_crawl_config_schema_definitions_for_reverse_schema(schema, reverse_schema)
|
||||
_crawl_config_schema_properties_for_reverse_schema(schema, reverse_schema)
|
||||
|
||||
return reverse_schema
|
||||
|
||||
|
||||
def _crawl_config_schema_definitions_for_reverse_schema(schema: Dict, reverse_schema: Dict):
|
||||
definitions = schema["definitions"]
|
||||
for definition in definitions:
|
||||
definition_type = definitions[definition]["title"]
|
||||
|
@ -25,6 +32,8 @@ def get_config_schema_per_attack_technique(schema: Dict) -> Dict[str, Dict[str,
|
|||
definition_type, config_field, attack_technique, reverse_schema
|
||||
)
|
||||
|
||||
|
||||
def _crawl_config_schema_properties_for_reverse_schema(schema: Dict, reverse_schema: Dict):
|
||||
properties = schema["properties"]
|
||||
for prop in properties:
|
||||
property_type = properties[prop]["title"]
|
||||
|
@ -40,8 +49,6 @@ def get_config_schema_per_attack_technique(schema: Dict) -> Dict[str, Dict[str,
|
|||
property_type, config_field, attack_technique, reverse_schema
|
||||
)
|
||||
|
||||
return reverse_schema
|
||||
|
||||
|
||||
def _add_config_field_to_reverse_schema(
|
||||
definition_type: str, config_field: str, attack_technique: str, reverse_schema: Dict
|
||||
|
|
Loading…
Reference in New Issue