- {this.renderLegend()}
-
-
-
-
);
- }
-}
-
-export default ConfigMatrixComponent;
diff --git a/monkey/monkey_island/cc/ui/src/components/configuration-components/ConfigurationTabs.js b/monkey/monkey_island/cc/ui/src/components/configuration-components/ConfigurationTabs.js
index 7701959cf..f6057dd6e 100644
--- a/monkey/monkey_island/cc/ui/src/components/configuration-components/ConfigurationTabs.js
+++ b/monkey/monkey_island/cc/ui/src/components/configuration-components/ConfigurationTabs.js
@@ -1,5 +1,4 @@
const CONFIGURATION_TABS = {
- ATTACK: 'attack',
BASIC: 'basic',
BASIC_NETWORK: 'basic_network',
RANSOMWARE: 'ransomware',
@@ -8,7 +7,6 @@ const CONFIGURATION_TABS = {
};
const advancedModeConfigTabs = [
- CONFIGURATION_TABS.ATTACK,
CONFIGURATION_TABS.BASIC,
CONFIGURATION_TABS.BASIC_NETWORK,
CONFIGURATION_TABS.RANSOMWARE,
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 f23df62e6..4650aec07 100644
--- a/monkey/monkey_island/cc/ui/src/components/pages/ConfigurePage.js
+++ b/monkey/monkey_island/cc/ui/src/components/pages/ConfigurePage.js
@@ -2,7 +2,6 @@ import React from 'react';
import Form from 'react-jsonschema-form-bs4';
import {Button, Col, Modal, Nav} from 'react-bootstrap';
import AuthComponent from '../AuthComponent';
-import ConfigMatrixComponent from '../attack/ConfigMatrixComponent';
import UiSchema from '../configuration-components/UiSchema';
import {FontAwesomeIcon} from '@fortawesome/react-fontawesome';
import {faCheck} from '@fortawesome/free-solid-svg-icons/faCheck';
@@ -20,7 +19,6 @@ import applyUiSchemaManipulators from '../configuration-components/UISchemaManip
import HtmlFieldDescription from '../configuration-components/HtmlFieldDescription.js';
import CONFIGURATION_TABS_PER_MODE from '../configuration-components/ConfigurationTabs.js';
-const ATTACK_URL = '/api/attack';
const CONFIG_URL = '/api/configuration/island';
export const API_PBA_LINUX = '/api/fileUpload/PBAlinux';
export const API_PBA_WINDOWS = '/api/fileUpload/PBAwindows';
@@ -30,11 +28,9 @@ class ConfigurePageComponent extends AuthComponent {
constructor(props) {
super(props);
this.initialConfig = {};
- this.initialAttackConfig = {};
this.currentSection = this.getSectionsOrder()[0];
this.state = {
- attackConfig: {},
configuration: {},
currentFormData: {},
importCandidateConfig: null,
@@ -42,7 +38,7 @@ class ConfigurePageComponent extends AuthComponent {
schema: {},
sections: [],
selectedSection: this.currentSection,
- showAttackAlert: false,
+ showUnsubmittedConfigWarning: false,
showUnsafeOptionsConfirmation: false,
showUnsafeAttackOptionsWarning: false,
showConfigExportModal: false,
@@ -64,39 +60,26 @@ class ConfigurePageComponent extends AuthComponent {
setInitialConfig(config) {
// Sets a reference to know if config was changed
- config['attack'] = {}
this.initialConfig = JSON.parse(JSON.stringify(config));
}
- setInitialAttackConfig(attackConfig) {
- // Sets a reference to know if attack config was changed
- this.initialAttackConfig = JSON.parse(JSON.stringify(attackConfig));
- }
-
componentDidMount = () => {
- let urls = [CONFIG_URL, ATTACK_URL];
+ let urls = [CONFIG_URL];
// ??? Why fetch config here and not in `render()`?
Promise.all(urls.map(url => this.authFetch(url).then(res => res.json())))
.then(data => {
let sections = [];
- let attackConfig = data[1];
let monkeyConfig = data[0];
this.setInitialConfig(monkeyConfig.configuration);
- this.setInitialAttackConfig(attackConfig.configuration);
for (let sectionKey of this.getSectionsOrder()) {
- if (sectionKey === 'attack') {
- sections.push({key: sectionKey, title: 'ATT&CK'})
- } else {
- sections.push({
- key: sectionKey,
- title: monkeyConfig.schema.properties[sectionKey].title
- });
- }
+ sections.push({
+ key: sectionKey,
+ title: monkeyConfig.schema.properties[sectionKey].title
+ });
}
this.setState({
schema: monkeyConfig.schema,
configuration: monkeyConfig.configuration,
- attackConfig: attackConfig.configuration,
sections: sections,
currentFormData: monkeyConfig.configuration[this.state.selectedSection]
})
@@ -130,42 +113,13 @@ class ConfigurePageComponent extends AuthComponent {
};
onSubmit = () => {
- if (this.state.selectedSection === 'attack') {
- this.matrixSubmit();
- } else {
- this.attemptConfigSubmit();
- }
+ this.attemptConfigSubmit();
};
canSafelySubmitConfig(config) {
return !isUnsafeOptionSelected(this.state.schema, config);
}
- matrixSubmit = () => {
- // Submit attack matrix
- this.authFetch(ATTACK_URL,
- {
- method: 'POST',
- headers: {'Content-Type': 'application/json'},
- body: JSON.stringify(this.state.attackConfig)
- })
- .then(res => {
- if (!res.ok) {
- throw Error()
- }
- return res;
- })
- .then(() => {
- this.setInitialAttackConfig(this.state.attackConfig);
- })
- .then(() => this.updateConfig(this.checkAndShowUnsafeAttackWarning))
- .then(() => this.setState({lastAction: 'saved'}))
- .catch(error => {
- console.log('Bad configuration: ' + error.toString());
- this.setState({lastAction: 'invalid_configuration'});
- });
- };
-
checkAndShowUnsafeAttackWarning = () => {
if (isUnsafeOptionSelected(this.state.schema, this.state.configuration)) {
this.setState({showUnsafeAttackOptionsWarning: true});
@@ -201,38 +155,8 @@ class ConfigurePageComponent extends AuthComponent {
});
}
- // Alters attack configuration when user toggles technique
- attackTechniqueChange = (technique, value, mapped = false) => {
- // Change value in attack configuration
- // Go trough each column in matrix, searching for technique
- Object.entries(this.state.attackConfig).forEach(techType => {
- if (Object.prototype.hasOwnProperty.call(techType[1].properties, technique)) {
- let tempMatrix = this.state.attackConfig;
- tempMatrix[techType[0]].properties[technique].value = value;
- this.setState({attackConfig: tempMatrix});
-
- // Toggle all mapped techniques
- if (!mapped) {
- // Loop trough each column and each row
- Object.entries(this.state.attackConfig).forEach(otherType => {
- Object.entries(otherType[1].properties).forEach(otherTech => {
- // If this technique depends on a technique that was changed
- if (Object.prototype.hasOwnProperty.call(otherTech[1], 'depends_on') &&
- otherTech[1]['depends_on'].includes(technique)) {
- this.attackTechniqueChange(otherTech[0], value, true)
- }
- })
- });
- }
- }
- });
- };
-
onChange = ({formData}) => {
let configuration = this.state.configuration;
- if (this.state.selectedSection === 'attack'){
- formData = {};
- }
configuration[this.state.selectedSection] = formData;
this.setState({currentFormData: formData, configuration: configuration});
};
@@ -270,8 +194,8 @@ class ConfigurePageComponent extends AuthComponent {
}
renderAttackAlertModal = () => {
- return (