def apply_to_monkey_config(): """ Applies ATT&CK matrix to the monkey configuration :return: """ attack_techniques = AttackConfig.get_technique_values() monkey_config = ConfigService.get_config(False, True, True) monkey_schema = ConfigService.get_config_schema() AttackConfig.set_arrays(attack_techniques, monkey_config, monkey_schema) AttackConfig.set_booleans(attack_techniques, monkey_config, monkey_schema) ConfigService.update_config(monkey_config, True)
def post(self): config_json = json.loads(request.data) if 'reset' in config_json: ConfigService.reset_config() else: if not ConfigService.update_config(config_json, should_encrypt=True): abort(400) return self.get()
def import_config(config_json): if not ConfigService.update_config(config_json, should_encrypt=True): raise InvalidConfigurationError