Minor pr fixes

This commit is contained in:
VakarisZ 2019-05-27 09:35:09 +03:00
parent f9c4b3e180
commit 64701e042e
2 changed files with 10 additions and 11 deletions

View File

@ -86,14 +86,10 @@ class AttackConfig(object):
dictionary = {} dictionary = {}
# If 'value' is a boolean value that should be set: # If 'value' is a boolean value that should be set:
if 'type' in value and value['type'] == 'boolean' and 'attack_techniques' in value: if 'type' in value and value['type'] == 'boolean' and 'attack_techniques' in value:
try: AttackConfig.set_bool_conf_val(path,
AttackConfig.set_bool_conf_val(path, AttackConfig.should_enable_field(value['attack_techniques'],
AttackConfig.should_enable_field(value['attack_techniques'], attack_techniques),
attack_techniques), monkey_config)
monkey_config)
except KeyError:
# Monkey schema has a technique that is not yet implemented
pass
# If 'value' is dict, we go over each of it's fields to search for booleans # If 'value' is dict, we go over each of it's fields to search for booleans
elif 'properties' in value: elif 'properties' in value:
dictionary = value['properties'] dictionary = value['properties']
@ -124,8 +120,11 @@ class AttackConfig(object):
:return: True, if user enabled all techniques used by the field, false otherwise :return: True, if user enabled all techniques used by the field, false otherwise
""" """
for technique in field_techniques: for technique in field_techniques:
if not users_techniques[technique]: try:
return False if not users_techniques[technique]:
return False
except KeyError:
logger.error("Attack technique %s is defined in schema, but not implemented." % technique)
return True return True
@staticmethod @staticmethod

View File

@ -249,7 +249,7 @@ class ConfigurePageComponent extends AuthComponent {
if ((key === 'attack' && this.userChangedConfig()) || if ((key === 'attack' && this.userChangedConfig()) ||
(this.currentSection === 'attack' && this.userChangedMatrix())){ (this.currentSection === 'attack' && this.userChangedMatrix())){
this.setState({showAttackAlert: true}); this.setState({showAttackAlert: true});
return return;
} }
this.currentSection = key; this.currentSection = key;
this.setState({ this.setState({