Minor bugfixes

This commit is contained in:
VakarisZ 2019-05-27 16:52:33 +03:00
parent 08801c8cd5
commit 8ecfb5d777
3 changed files with 9 additions and 6 deletions

View File

@ -55,7 +55,7 @@ class AttackConfig(object):
for key, definition in monkey_schema['definitions'].items(): for key, definition in monkey_schema['definitions'].items():
for array_field in definition['anyOf']: for array_field in definition['anyOf']:
# Check if current array field has attack_techniques assigned to it # Check if current array field has attack_techniques assigned to it
if 'attack_techniques' in array_field: if 'attack_techniques' in array_field and array_field['attack_techniques']:
should_remove = not AttackConfig.should_enable_field(array_field['attack_techniques'], should_remove = not AttackConfig.should_enable_field(array_field['attack_techniques'],
attack_techniques) attack_techniques)
# If exploiter's attack technique is disabled, disable the exploiter/scanner/PBA # If exploiter's attack technique is disabled, disable the exploiter/scanner/PBA
@ -85,7 +85,8 @@ class AttackConfig(object):
if isinstance(value, dict): if isinstance(value, dict):
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 and value['attack_techniques']:
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),

View File

@ -22,7 +22,7 @@ SCHEMA = {
"WmiExploiter" "WmiExploiter"
], ],
"title": "WMI Exploiter", "title": "WMI Exploiter",
"attack_techniques": ["T1110", "T1210"] "attack_techniques": ["T1110"]
}, },
{ {
"type": "string", "type": "string",
@ -30,7 +30,7 @@ SCHEMA = {
"MSSQLExploiter" "MSSQLExploiter"
], ],
"title": "MSSQL Exploiter", "title": "MSSQL Exploiter",
"attack_techniques": ["T1110", "T1210"] "attack_techniques": ["T1110"]
}, },
{ {
"type": "string", "type": "string",

View File

@ -75,10 +75,12 @@ class ConfigurePageComponent extends AuthComponent {
} }
setInitialConfig(config) { setInitialConfig(config) {
// Sets a reference to know if config was changed
this.initialConfig = JSON.parse(JSON.stringify(config)); this.initialConfig = JSON.parse(JSON.stringify(config));
} }
setInitialAttackConfig(attackConfig) { setInitialAttackConfig(attackConfig) {
// Sets a reference to know if attack config was changed
this.initialAttackConfig = JSON.parse(JSON.stringify(attackConfig)); this.initialAttackConfig = JSON.parse(JSON.stringify(attackConfig));
} }
@ -138,9 +140,9 @@ class ConfigurePageComponent extends AuthComponent {
} }
return res; return res;
}) })
.then(() => {this.setInitialAttackConfig(this.state.attackConfig); .then(() => {this.setInitialAttackConfig(this.state.attackConfig);})
this.setState({lastAction: 'saved'})})
.then(this.updateConfig()) .then(this.updateConfig())
.then(this.setState({lastAction: 'saved'}))
.catch(error => { .catch(error => {
this.setState({lastAction: 'invalid_configuration'}); this.setState({lastAction: 'invalid_configuration'});
}); });