From 64701e042e38d921f099cf25e8a668e77acb89d1 Mon Sep 17 00:00:00 2001 From: VakarisZ Date: Mon, 27 May 2019 09:35:09 +0300 Subject: [PATCH] Minor pr fixes --- .../cc/services/attack/attack_config.py | 19 +++++++++---------- .../ui/src/components/pages/ConfigurePage.js | 2 +- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/monkey/monkey_island/cc/services/attack/attack_config.py b/monkey/monkey_island/cc/services/attack/attack_config.py index 3e6d410d1..7b340519b 100644 --- a/monkey/monkey_island/cc/services/attack/attack_config.py +++ b/monkey/monkey_island/cc/services/attack/attack_config.py @@ -86,14 +86,10 @@ class AttackConfig(object): dictionary = {} # If 'value' is a boolean value that should be set: if 'type' in value and value['type'] == 'boolean' and 'attack_techniques' in value: - try: - AttackConfig.set_bool_conf_val(path, - AttackConfig.should_enable_field(value['attack_techniques'], - attack_techniques), - monkey_config) - except KeyError: - # Monkey schema has a technique that is not yet implemented - pass + AttackConfig.set_bool_conf_val(path, + AttackConfig.should_enable_field(value['attack_techniques'], + attack_techniques), + monkey_config) # If 'value' is dict, we go over each of it's fields to search for booleans elif 'properties' in value: dictionary = value['properties'] @@ -124,8 +120,11 @@ class AttackConfig(object): :return: True, if user enabled all techniques used by the field, false otherwise """ for technique in field_techniques: - if not users_techniques[technique]: - return False + try: + if not users_techniques[technique]: + return False + except KeyError: + logger.error("Attack technique %s is defined in schema, but not implemented." % technique) return True @staticmethod diff --git a/monkey/monkey_island/cc/ui/src/components/pages/ConfigurePage.js b/monkey/monkey_island/cc/ui/src/components/pages/ConfigurePage.js index c484cf3e0..65311e71f 100644 --- a/monkey/monkey_island/cc/ui/src/components/pages/ConfigurePage.js +++ b/monkey/monkey_island/cc/ui/src/components/pages/ConfigurePage.js @@ -249,7 +249,7 @@ class ConfigurePageComponent extends AuthComponent { if ((key === 'attack' && this.userChangedConfig()) || (this.currentSection === 'attack' && this.userChangedMatrix())){ this.setState({showAttackAlert: true}); - return + return; } this.currentSection = key; this.setState({