From f5e026ff85eaac071614b08915d1370c3fdf6680 Mon Sep 17 00:00:00 2001 From: Ilija Lazoroski Date: Tue, 12 Jul 2022 18:25:05 +0200 Subject: [PATCH 01/14] UI: Add PropagationConfig component --- .../PropagationConfig.js | 97 +++++++++++++++++++ 1 file changed, 97 insertions(+) create mode 100644 monkey/monkey_island/cc/ui/src/components/configuration-components/PropagationConfig.js diff --git a/monkey/monkey_island/cc/ui/src/components/configuration-components/PropagationConfig.js b/monkey/monkey_island/cc/ui/src/components/configuration-components/PropagationConfig.js new file mode 100644 index 000000000..9302e2330 --- /dev/null +++ b/monkey/monkey_island/cc/ui/src/components/configuration-components/PropagationConfig.js @@ -0,0 +1,97 @@ +import Form from 'react-jsonschema-form-bs4'; +import React, {useState} from 'react'; +import {Nav} from 'react-bootstrap'; +import {CREDENTIALS} from '../../services/configuration/credentials.js'; + +const sectionOrder = [ + 'exploitation', + 'network_scan', + 'credentials', + 'maximum_depth' +]; + +const initialSection = sectionOrder[0]; + +export default function PropagationConfig(props) { + const { + schema, + uiSchema, + onChange, + customFormats, + className, + formData + } = props; + console.log(schema, uiSchema, formData); + const [selectedSection, setSelectedSection] = useState(initialSection); + const [displayedSchema, setDisplayedSchema] = useState(getSchemaByKey(schema, initialSection)); + const [displayedSchemaUi, setDisplayedSchemaUi] = useState(getUiSchemaByKey(uiSchema, initialSection)); + const onInnerDataChange = (innerData) => { + console.log(innerData); + formData[selectedSection] = innerData.formData; + onChange({formData: formData}); + } + + const setSection = (sectionKey) => { + console.log(sectionKey); + setSelectedSection(sectionKey); + setDisplayedSchema(getSchemaByKey(schema, sectionKey)); + setDisplayedSchemaUi(getUiSchemaByKey(uiSchema, sectionKey)); + } + + const renderNav = () => { + return () + } + + console.log(displayedSchemaUi) + + return (
+ {renderNav()} +
+ +
+
) +} + +function getSchemaByKey(schema, key) { + if(key === 'maximum_depth'){ + return schema['properties'][key]; + } + if(key === 'credentials') { + return { properties: CREDENTIALS['properties']}; + } + let definitions = schema['definitions']; + + return {definitions: definitions, properties: schema['properties'][key]['properties']}; +} + + +function getUiSchemaByKey(uiSchema, key){ + return uiSchema[key]; +} + +function getNavTitle(schema, key) { + if(key === 'maximum_depth'){ + return 'General'; + } + if(key === 'credentials'){ + return 'Credentials'; + } + return schema.properties[key].title; +} From f8e4c5cddc469654069d9b809cf529dc868e84d8 Mon Sep 17 00:00:00 2001 From: Ilija Lazoroski Date: Tue, 12 Jul 2022 18:25:42 +0200 Subject: [PATCH 02/14] UI: Add credentials json schema --- .../src/services/configuration/credentials.js | 60 +++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 monkey/monkey_island/cc/ui/src/services/configuration/credentials.js diff --git a/monkey/monkey_island/cc/ui/src/services/configuration/credentials.js b/monkey/monkey_island/cc/ui/src/services/configuration/credentials.js new file mode 100644 index 000000000..9ab1dbf79 --- /dev/null +++ b/monkey/monkey_island/cc/ui/src/services/configuration/credentials.js @@ -0,0 +1,60 @@ +export const CREDENTIALS = { + 'title': 'Credentials', + 'type': 'object', + 'properties': { + 'exploit_user_list': { + 'title': 'Exploit user list', + 'type': 'array', + 'uniqueItems': true, + 'items': {'type': 'string'}, + 'default': [], + 'description': 'List of user names that will be used by exploiters that need ' + + 'credentials, like SSH brute-forcing.' + }, + 'exploit_password_list': { + 'title': 'Exploit password list', + 'type': 'array', + 'uniqueItems': true, + 'items': {'type': 'string'}, + 'default': [], + 'description': 'List of passwords that will be used by exploiters that need ' + + 'credentials, like SSH brute-forcing.' + }, + 'exploit_lm_hash_list': { + 'title': 'Exploit LM hash list', + 'type': 'array', + 'uniqueItems': true, + 'items': {'type': 'string'}, + 'default': [], + 'description': 'List of LM hashes to use on exploits using credentials' + }, + 'exploit_ntlm_hash_list': { + 'title': 'Exploit NTLM hash list', + 'type': 'array', + 'uniqueItems': true, + 'items': {'type': 'string'}, + 'default': [], + 'description': 'List of NTLM hashes to use on exploits using credentials' + }, + 'exploit_ssh_keys': { + 'title': 'SSH key pairs list', + 'type': 'array', + 'uniqueItems': true, + 'default': [], + 'items': { + 'type': 'object', + 'properties': { + 'public_key': { + 'title': 'Public Key', + 'type': 'string' + }, + 'private_key': { + 'title': 'Private Key', + 'type': 'string' + } + } + }, + 'description': 'List of SSH key pairs to use, when trying to ssh into servers' + } + } +} From 457a70390c6362e7c88dc5abb72e432cb295e3c5 Mon Sep 17 00:00:00 2001 From: Ilija Lazoroski Date: Tue, 12 Jul 2022 18:26:17 +0200 Subject: [PATCH 03/14] UI: Render PropagationConfig on Propagation tab --- .../ui/src/components/pages/ConfigurePage.js | 20 ++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) 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 154eff52c..a8fcbbe58 100644 --- a/monkey/monkey_island/cc/ui/src/components/pages/ConfigurePage.js +++ b/monkey/monkey_island/cc/ui/src/components/pages/ConfigurePage.js @@ -8,6 +8,7 @@ import {faCheck} from '@fortawesome/free-solid-svg-icons/faCheck'; import {faExclamationCircle} from '@fortawesome/free-solid-svg-icons/faExclamationCircle'; import {formValidationFormats} from '../configuration-components/ValidationFormats'; import transformErrors from '../configuration-components/ValidationErrorMessages'; +import PropagationConfig from '../configuration-components/PropagationConfig' import UnsafeConfigOptionsConfirmationModal from '../configuration-components/UnsafeConfigOptionsConfirmationModal.js'; import isUnsafeOptionSelected from '../utils/SafeOptionValidator.js'; @@ -302,13 +303,18 @@ class ConfigurePageComponent extends AuthComponent { formProperties['formData'], formProperties['uiSchema']); - return ( -
-
- -
-
- ) + if (this.state.selectedSection === 'propagation') { + console.log(formProperties['uiSchema']); + return () + } else { + return ( +
+
+ +
+
+ ) + } }; setPbaFilenameWindows = (filename) => { From 4240ea02ef00c9256d71381cde8e58d9fbb1f1a1 Mon Sep 17 00:00:00 2001 From: Ilija Lazoroski Date: Tue, 12 Jul 2022 18:27:23 +0200 Subject: [PATCH 04/14] Island: Add credentials to the UiSchema --- .../components/configuration-components/UiSchema.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/monkey/monkey_island/cc/ui/src/components/configuration-components/UiSchema.js b/monkey/monkey_island/cc/ui/src/components/configuration-components/UiSchema.js index d70a6f32c..ac9b22ead 100644 --- a/monkey/monkey_island/cc/ui/src/components/configuration-components/UiSchema.js +++ b/monkey/monkey_island/cc/ui/src/components/configuration-components/UiSchema.js @@ -30,6 +30,16 @@ export default function UiSchema(props) { } } }, + credentials: { + exploit_ssh_keys: { + items: { + public_key: { + }, + private_key: { + } + } + } + }, network_scan: { targets: { info_box: { From 891041d15b5f73292fc1b39d87acd1a239390659 Mon Sep 17 00:00:00 2001 From: Ilija Lazoroski Date: Wed, 13 Jul 2022 15:33:34 +0200 Subject: [PATCH 05/14] TEMP --- .../PropagationConfig.js | 30 +++++++++++++------ 1 file changed, 21 insertions(+), 9 deletions(-) diff --git a/monkey/monkey_island/cc/ui/src/components/configuration-components/PropagationConfig.js b/monkey/monkey_island/cc/ui/src/components/configuration-components/PropagationConfig.js index 9302e2330..7b44a4247 100644 --- a/monkey/monkey_island/cc/ui/src/components/configuration-components/PropagationConfig.js +++ b/monkey/monkey_island/cc/ui/src/components/configuration-components/PropagationConfig.js @@ -1,5 +1,5 @@ import Form from 'react-jsonschema-form-bs4'; -import React, {useState} from 'react'; +import React, {useState, useEffect} from 'react'; import {Nav} from 'react-bootstrap'; import {CREDENTIALS} from '../../services/configuration/credentials.js'; @@ -21,21 +21,34 @@ export default function PropagationConfig(props) { className, formData } = props; - console.log(schema, uiSchema, formData); const [selectedSection, setSelectedSection] = useState(initialSection); const [displayedSchema, setDisplayedSchema] = useState(getSchemaByKey(schema, initialSection)); const [displayedSchemaUi, setDisplayedSchemaUi] = useState(getUiSchemaByKey(uiSchema, initialSection)); + const [localFormData , setLocalFormData] = useState(formData[initialSection]); + + let varLocalFormData = formData[initialSection]; + useEffect(() => { + varLocalFormData = localFormData; + + }, [localFormData]); + + useEffect(() => { + console.log('setSection selectedSection:'+selectedSection); + setLocalFormData(formData[selectedSection]); + setDisplayedSchema(getSchemaByKey(schema, selectedSection)); + setDisplayedSchemaUi(getUiSchemaByKey(uiSchema, selectedSection)); + setLocalFormData(formData[selectedSection]); + }, [selectedSection]) + const onInnerDataChange = (innerData) => { - console.log(innerData); + console.log('onInnerDataChange is called, section:'+selectedSection); formData[selectedSection] = innerData.formData; - onChange({formData: formData}); + onChange({formData: innerData.formData}); } const setSection = (sectionKey) => { - console.log(sectionKey); + console.log('setSection is called with:'+sectionKey); setSelectedSection(sectionKey); - setDisplayedSchema(getSchemaByKey(schema, sectionKey)); - setDisplayedSchemaUi(getUiSchemaByKey(uiSchema, sectionKey)); } const renderNav = () => { @@ -53,13 +66,12 @@ export default function PropagationConfig(props) { ) } - console.log(displayedSchemaUi) return (
{renderNav()}
Date: Thu, 14 Jul 2022 11:14:21 +0300 Subject: [PATCH 06/14] UI: Fix PropagationConfig.tsx to save state between tabs --- ...agationConfig.js => PropagationConfig.tsx} | 29 +++++++++---------- 1 file changed, 14 insertions(+), 15 deletions(-) rename monkey/monkey_island/cc/ui/src/components/configuration-components/{PropagationConfig.js => PropagationConfig.tsx} (80%) diff --git a/monkey/monkey_island/cc/ui/src/components/configuration-components/PropagationConfig.js b/monkey/monkey_island/cc/ui/src/components/configuration-components/PropagationConfig.tsx similarity index 80% rename from monkey/monkey_island/cc/ui/src/components/configuration-components/PropagationConfig.js rename to monkey/monkey_island/cc/ui/src/components/configuration-components/PropagationConfig.tsx index 7b44a4247..3d6c2906d 100644 --- a/monkey/monkey_island/cc/ui/src/components/configuration-components/PropagationConfig.js +++ b/monkey/monkey_island/cc/ui/src/components/configuration-components/PropagationConfig.tsx @@ -1,7 +1,7 @@ import Form from 'react-jsonschema-form-bs4'; import React, {useState, useEffect} from 'react'; import {Nav} from 'react-bootstrap'; -import {CREDENTIALS} from '../../services/configuration/credentials.js'; +import _ from 'lodash'; const sectionOrder = [ 'exploitation', @@ -24,26 +24,25 @@ export default function PropagationConfig(props) { const [selectedSection, setSelectedSection] = useState(initialSection); const [displayedSchema, setDisplayedSchema] = useState(getSchemaByKey(schema, initialSection)); const [displayedSchemaUi, setDisplayedSchemaUi] = useState(getUiSchemaByKey(uiSchema, initialSection)); - const [localFormData , setLocalFormData] = useState(formData[initialSection]); - - let varLocalFormData = formData[initialSection]; - useEffect(() => { - varLocalFormData = localFormData; - - }, [localFormData]); + const [localFormData, setLocalFormData] = useState(formData[initialSection]); useEffect(() => { - console.log('setSection selectedSection:'+selectedSection); setLocalFormData(formData[selectedSection]); setDisplayedSchema(getSchemaByKey(schema, selectedSection)); setDisplayedSchemaUi(getUiSchemaByKey(uiSchema, selectedSection)); setLocalFormData(formData[selectedSection]); }, [selectedSection]) + useEffect(() => { + setLocalFormData(formData[selectedSection]); + }, [formData]) + const onInnerDataChange = (innerData) => { - console.log('onInnerDataChange is called, section:'+selectedSection); - formData[selectedSection] = innerData.formData; - onChange({formData: innerData.formData}); + let innerDataClone = _.clone(innerData); + let formDataClone = _.clone(formData); + + formDataClone[selectedSection] = innerDataClone.formData; + onChange({formData: formDataClone}); } const setSection = (sectionKey) => { @@ -71,7 +70,7 @@ export default function PropagationConfig(props) { {renderNav()} Date: Thu, 14 Jul 2022 15:18:21 +0300 Subject: [PATCH 07/14] UI: Simplify AdvancedMultiSelect.js AdvancedMultiSelect.js no longer needs to pull data from definitions since we no longer need the definitions in schema --- .../ui-components/AdvancedMultiSelect.js | 40 +++++++------------ .../ui-components/JsonSchemaHelpers.js | 19 ++------- .../ui-components/utils/ObjectPathResolver.js | 11 ----- 3 files changed, 18 insertions(+), 52 deletions(-) delete mode 100644 monkey/monkey_island/cc/ui/src/components/ui-components/utils/ObjectPathResolver.js diff --git a/monkey/monkey_island/cc/ui/src/components/ui-components/AdvancedMultiSelect.js b/monkey/monkey_island/cc/ui/src/components/ui-components/AdvancedMultiSelect.js index e0bc667de..df72ef682 100644 --- a/monkey/monkey_island/cc/ui/src/components/ui-components/AdvancedMultiSelect.js +++ b/monkey/monkey_island/cc/ui/src/components/ui-components/AdvancedMultiSelect.js @@ -6,7 +6,7 @@ import {cloneDeep} from 'lodash'; import {getDefaultPaneParams, InfoPane, WarningType} from './InfoPane'; import {MasterCheckbox, MasterCheckboxState} from './MasterCheckbox'; import ChildCheckboxContainer from './ChildCheckbox'; -import {getFullDefinitionByKey, getObjectFromRegistryByRef} from './JsonSchemaHelpers'; +import {getFullDefinitionByKey} from './JsonSchemaHelpers'; function AdvancedMultiSelectHeader(props) { const { @@ -38,14 +38,12 @@ class AdvancedMultiSelect extends React.Component { this.state = { infoPaneParams: getDefaultPaneParams( - this.props.schema.items.$ref, - this.props.registry, + this.props.schema.items, this.isUnsafeOptionSelected(selectedPluginNames) ), allPluginNames: allPluginNames, masterCheckboxState: this.getMasterCheckboxState(selectedPluginNames), - pluginDefinitions: getObjectFromRegistryByRef(this.props.schema.items.$ref, - this.props.registry).pluginDefs, + pluginDefinitions: this.props.schema.items.pluginDefs, selectedPluginNames: selectedPluginNames }; } @@ -55,23 +53,17 @@ class AdvancedMultiSelect extends React.Component { } onChange = (strValues) => { - let newValues = []; - for (let j = 0; j < strValues.length; j++) { - let found = false; - for (let i = 0; i < this.state.allPluginNames.length; i++) { - if (strValues[j] === this.state.allPluginNames[i]['name']) { - newValues.push(JSON.parse(JSON.stringify(this.props.value[i]))) - found = true; - break; - } - } - if (!found) { - newValues.push(this.state.pluginDefinitions[strValues[j]]); - } + let pluginArray = this.namesToPlugins(strValues, this.state.pluginDefinitions); + this.props.onChange(pluginArray) + this.setState({selectedPluginNames: pluginArray.map(v => v.name)}); + } + + namesToPlugins = (names, allPlugins) => { + let plugins = []; + for (let i = 0; i < names.length; i++){ + plugins.push(_.clone(allPlugins[names[i]])); } - newValues = JSON.parse(JSON.stringify(newValues)); - this.props.onChange(newValues) - this.setState({selectedPluginNames: newValues.map(v => v.name)}); + return plugins } // Sort options alphabetically. "Unsafe" options float to the top so that they @@ -146,14 +138,12 @@ class AdvancedMultiSelect extends React.Component { } isSafe = (itemKey) => { - let fullDef = getFullDefinitionByKey(this.props.schema.items.$ref, - this.props.registry, itemKey); + let fullDef = getFullDefinitionByKey(this.props.schema.items, itemKey); return fullDef.safe; } setPaneInfo = (itemKey) => { - let definitionObj = getFullDefinitionByKey(this.props.schema.items.$ref, - this.props.registry, itemKey); + let definitionObj = getFullDefinitionByKey(this.props.schema.items, itemKey); this.setState( { infoPaneParams: { diff --git a/monkey/monkey_island/cc/ui/src/components/ui-components/JsonSchemaHelpers.js b/monkey/monkey_island/cc/ui/src/components/ui-components/JsonSchemaHelpers.js index 9a3d9c66b..e320e2057 100644 --- a/monkey/monkey_island/cc/ui/src/components/ui-components/JsonSchemaHelpers.js +++ b/monkey/monkey_island/cc/ui/src/components/ui-components/JsonSchemaHelpers.js @@ -1,19 +1,6 @@ -import {resolveObjectPath} from './utils/ObjectPathResolver'; - -function getFullDefinitionByKey(refString, registry, itemKey) { - let fullArray = getFullDefinitionsFromRegistry(refString, registry); +function getFullDefinitionByKey(items, itemKey) { + let fullArray = items.anyOf; return fullArray.filter(e => (e.enum[0] === itemKey))[0]; } -// Definitions passed to components only contains value and label, -// custom fields like "info" or "links" must be pulled from registry object using this function -function getFullDefinitionsFromRegistry(refString, registry) { - return getObjectFromRegistryByRef(refString, registry).anyOf; -} - -function getObjectFromRegistryByRef(refString, registry) { - let refArray = refString.replace('#', '').split('/'); - return resolveObjectPath(refArray, registry); -} - -export {getFullDefinitionByKey, getObjectFromRegistryByRef}; +export {getFullDefinitionByKey}; diff --git a/monkey/monkey_island/cc/ui/src/components/ui-components/utils/ObjectPathResolver.js b/monkey/monkey_island/cc/ui/src/components/ui-components/utils/ObjectPathResolver.js deleted file mode 100644 index 9fef26c7a..000000000 --- a/monkey/monkey_island/cc/ui/src/components/ui-components/utils/ObjectPathResolver.js +++ /dev/null @@ -1,11 +0,0 @@ - -// Resolves object's path if it's specified in a dot notation. -// (e.g. params: "firstLevel.secondLevel.property", myObject) -export function resolveObjectPath(pathArray, obj) { - return pathArray.reduce(function(prev, curr) { - if(curr === '') - return prev; - else - return prev ? prev[curr] : null; - }, obj || self) -} From a721508be20e050cbd1cfeb9b958e26f674bef83 Mon Sep 17 00:00:00 2001 From: vakarisz Date: Thu, 14 Jul 2022 15:19:27 +0300 Subject: [PATCH 08/14] UI: Remove unnecessary console log in ConfigurePage.js --- monkey/monkey_island/cc/ui/src/components/pages/ConfigurePage.js | 1 - 1 file changed, 1 deletion(-) 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 a8fcbbe58..a948eaec4 100644 --- a/monkey/monkey_island/cc/ui/src/components/pages/ConfigurePage.js +++ b/monkey/monkey_island/cc/ui/src/components/pages/ConfigurePage.js @@ -304,7 +304,6 @@ class ConfigurePageComponent extends AuthComponent { formProperties['uiSchema']); if (this.state.selectedSection === 'propagation') { - console.log(formProperties['uiSchema']); return () } else { return ( From efbc1d38602cac310c9c35ea50e49a87eaca607c Mon Sep 17 00:00:00 2001 From: vakarisz Date: Thu, 14 Jul 2022 16:54:43 +0300 Subject: [PATCH 09/14] UI: Change PropagationConfig.tsx to use more trivial config schema --- .../PropagationConfig.tsx | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/monkey/monkey_island/cc/ui/src/components/configuration-components/PropagationConfig.tsx b/monkey/monkey_island/cc/ui/src/components/configuration-components/PropagationConfig.tsx index 3d6c2906d..b00e4653d 100644 --- a/monkey/monkey_island/cc/ui/src/components/configuration-components/PropagationConfig.tsx +++ b/monkey/monkey_island/cc/ui/src/components/configuration-components/PropagationConfig.tsx @@ -46,7 +46,6 @@ export default function PropagationConfig(props) { } const setSection = (sectionKey) => { - console.log('setSection is called with:'+sectionKey); setSelectedSection(sectionKey); } @@ -81,19 +80,10 @@ export default function PropagationConfig(props) { } function getSchemaByKey(schema, key) { - if(key === 'maximum_depth'){ - return schema['properties'][key]; - } - if(key === 'credentials') { - return { properties: CREDENTIALS['properties']}; - } - let definitions = schema['definitions']; - - return {definitions: definitions, properties: schema['properties'][key]['properties']}; + return schema['properties'][key]; } - -function getUiSchemaByKey(uiSchema, key){ +function getUiSchemaByKey(uiSchema, key) { return uiSchema[key]; } @@ -104,5 +94,5 @@ function getNavTitle(schema, key) { if (key === 'credentials') { return 'Credentials'; } - return schema.properties[key].title; + return schema['properties'][key].title; } From 1445bcf4ad72c7c8360b8c91e4bc567a91cdc3d4 Mon Sep 17 00:00:00 2001 From: vakarisz Date: Thu, 14 Jul 2022 17:05:54 +0300 Subject: [PATCH 10/14] UI: Reorganize and simplify configuration schema --- .../ui/src/components/pages/ConfigurePage.js | 2 +- .../src/components/ui-components/InfoPane.js | 4 +- .../services/configuration/configSchema.js | 45 ++++++++++++++ .../services/configuration/config_schema.js | 58 ----------------- ..._collectors.js => credentialCollectors.js} | 3 +- .../src/services/configuration/credentials.js | 60 ------------------ .../custom_pbas.js => customPBAs.js} | 3 +- .../configuration/definitions/exploitation.js | 26 -------- .../configuration/definitions/network_scan.js | 21 ------- ...tion_options.js => exploitationOptions.js} | 3 +- ...ploiter_classes.js => exploiterClasses.js} | 4 +- .../{definitions => }/plugins.js | 0 ...breach_actions.js => postBreachActions.js} | 3 +- .../configuration/propagation/credentials.js | 62 +++++++++++++++++++ .../configuration/propagation/exploitation.js | 24 +++++++ .../fingerprinterClasses.js} | 4 +- .../icmp_scan.js => propagation/icmpScan.js} | 4 +- .../configuration/propagation/networkScan.js | 22 +++++++ .../propagation.js | 13 ++-- .../scanTarget.js} | 3 +- .../tcp_scan.js => propagation/tcpScan.js} | 3 +- .../{definitions => }/ransomware.js | 4 +- 22 files changed, 187 insertions(+), 184 deletions(-) create mode 100644 monkey/monkey_island/cc/ui/src/services/configuration/configSchema.js delete mode 100644 monkey/monkey_island/cc/ui/src/services/configuration/config_schema.js rename monkey/monkey_island/cc/ui/src/services/configuration/{definitions/credential_collectors.js => credentialCollectors.js} (92%) delete mode 100644 monkey/monkey_island/cc/ui/src/services/configuration/credentials.js rename monkey/monkey_island/cc/ui/src/services/configuration/{definitions/custom_pbas.js => customPBAs.js} (94%) delete mode 100644 monkey/monkey_island/cc/ui/src/services/configuration/definitions/exploitation.js delete mode 100644 monkey/monkey_island/cc/ui/src/services/configuration/definitions/network_scan.js rename monkey/monkey_island/cc/ui/src/services/configuration/{definitions/exploitation_options.js => exploitationOptions.js} (76%) rename monkey/monkey_island/cc/ui/src/services/configuration/{definitions/exploiter_classes.js => exploiterClasses.js} (98%) rename monkey/monkey_island/cc/ui/src/services/configuration/{definitions => }/plugins.js (100%) rename monkey/monkey_island/cc/ui/src/services/configuration/{definitions/post_breach_actions.js => postBreachActions.js} (98%) create mode 100644 monkey/monkey_island/cc/ui/src/services/configuration/propagation/credentials.js create mode 100644 monkey/monkey_island/cc/ui/src/services/configuration/propagation/exploitation.js rename monkey/monkey_island/cc/ui/src/services/configuration/{definitions/fingerprinter_classes.js => propagation/fingerprinterClasses.js} (95%) rename monkey/monkey_island/cc/ui/src/services/configuration/{definitions/icmp_scan.js => propagation/icmpScan.js} (73%) create mode 100644 monkey/monkey_island/cc/ui/src/services/configuration/propagation/networkScan.js rename monkey/monkey_island/cc/ui/src/services/configuration/{definitions => propagation}/propagation.js (54%) rename monkey/monkey_island/cc/ui/src/services/configuration/{definitions/scan_target.js => propagation/scanTarget.js} (96%) rename monkey/monkey_island/cc/ui/src/services/configuration/{definitions/tcp_scan.js => propagation/tcpScan.js} (86%) rename monkey/monkey_island/cc/ui/src/services/configuration/{definitions => }/ransomware.js (97%) 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 a948eaec4..4cb057269 100644 --- a/monkey/monkey_island/cc/ui/src/components/pages/ConfigurePage.js +++ b/monkey/monkey_island/cc/ui/src/components/pages/ConfigurePage.js @@ -17,7 +17,7 @@ import ConfigImportModal from '../configuration-components/ImportConfigModal'; import applyUiSchemaManipulators from '../configuration-components/UISchemaManipulators.tsx'; import HtmlFieldDescription from '../configuration-components/HtmlFieldDescription.js'; import CONFIGURATION_TABS_PER_MODE from '../configuration-components/ConfigurationTabs.js'; -import {SCHEMA} from '../../services/configuration/config_schema.js'; +import {SCHEMA} from '../../services/configuration/configSchema.js'; import {reformatConfig} from '../configuration-components/ReformatHook'; const CONFIG_URL = '/api/agent-configuration'; diff --git a/monkey/monkey_island/cc/ui/src/components/ui-components/InfoPane.js b/monkey/monkey_island/cc/ui/src/components/ui-components/InfoPane.js index 21e71e29f..98a14be66 100644 --- a/monkey/monkey_island/cc/ui/src/components/ui-components/InfoPane.js +++ b/monkey/monkey_island/cc/ui/src/components/ui-components/InfoPane.js @@ -12,8 +12,8 @@ const WarningType = { MULTIPLE: 2 } -function getDefaultPaneParams(refString, registry, isUnsafeOptionSelected) { - let configSection = getObjectFromRegistryByRef(refString, registry); +function getDefaultPaneParams(items, isUnsafeOptionSelected) { + let configSection = items; return ( { title: configSection.title, diff --git a/monkey/monkey_island/cc/ui/src/services/configuration/configSchema.js b/monkey/monkey_island/cc/ui/src/services/configuration/configSchema.js new file mode 100644 index 000000000..fbb619d18 --- /dev/null +++ b/monkey/monkey_island/cc/ui/src/services/configuration/configSchema.js @@ -0,0 +1,45 @@ +import PROPAGATION_CONFIGURATION_SCHEMA from './propagation/propagation.js'; +import CREDENTIAL_COLLECTORS from './credentialCollectors.js'; +import POST_BREACH_ACTIONS from './postBreachActions.js'; +import RANSOMWARE_SCHEMA from './ransomware'; +import CUSTOM_PBA_CONFIGURATION_SCHEMA from './customPBAs'; + +export const SCHEMA = { + 'title': 'Monkey', + 'type': 'object', + 'properties': { + 'propagation': PROPAGATION_CONFIGURATION_SCHEMA, + 'post_breach_actions': { + 'title': 'Post-breach actions', + 'type': 'array', + 'uniqueItems': true, + 'items': POST_BREACH_ACTIONS + }, + 'custom_pbas': CUSTOM_PBA_CONFIGURATION_SCHEMA, + 'payloads': RANSOMWARE_SCHEMA, + 'credential_collectors': { + 'title': 'Credential collectors', + 'type': 'array', + 'uniqueItems': true, + 'items': CREDENTIAL_COLLECTORS, + 'default': [ + 'MimikatzCollector', + 'SSHCollector' + ] + }, + 'advanced': { + 'title': 'Advanced', + 'type': 'object', + 'properties':{ + 'keep_tunnel_open_time': { + 'title': 'Keep tunnel open time', + 'format': 'float', + 'type': 'number', + 'default': 30, + 'description': 'Time to keep tunnel open before going down after last exploit (in seconds)' + } + } + } + }, + 'options': {'collapsed': true} +} diff --git a/monkey/monkey_island/cc/ui/src/services/configuration/config_schema.js b/monkey/monkey_island/cc/ui/src/services/configuration/config_schema.js deleted file mode 100644 index 6700e5e4a..000000000 --- a/monkey/monkey_island/cc/ui/src/services/configuration/config_schema.js +++ /dev/null @@ -1,58 +0,0 @@ -import {customPBAConfigurationSchema} from './definitions/custom_pbas.js'; -import {ransomwareSchema} from './definitions/ransomware.js'; -import {propagationConfigurationSchema} from './definitions/propagation.js'; -import {bruteForceExploiters, vulnerabilityExploiters} from './definitions/exploiter_classes.js'; -import {credentialCollectors} from './definitions/credential_collectors.js'; -import {postBreachActions} from './definitions/post_breach_actions.js'; -import {fingerprinterClasses} from './definitions/fingerprinter_classes.js' - -export const SCHEMA = { - 'title': 'Monkey', - 'type': 'object', - 'definitions': { - 'brute_force_classes': bruteForceExploiters, - 'vulnerability_classes': vulnerabilityExploiters, - 'credential_collectors_classes': credentialCollectors, - 'post_breach_actions': postBreachActions, - 'fingerprinter_classes': fingerprinterClasses - }, - 'properties': { - 'propagation': propagationConfigurationSchema, - 'post_breach_actions': { - 'title': 'Post-breach actions', - 'type': 'array', - 'uniqueItems': true, - 'items': { - '$ref': '#/definitions/post_breach_actions' - } - }, - 'custom_pbas': customPBAConfigurationSchema, - 'payloads': ransomwareSchema, - 'credential_collectors': { - 'title': 'Credential collectors', - 'type': 'array', - 'uniqueItems': true, - 'items': { - '$ref': '#/definitions/credential_collectors_classes' - }, - 'default': [ - 'MimikatzCollector', - 'SSHCollector' - ] - }, - 'advanced': { - 'title': 'Advanced', - 'type': 'object', - 'properties':{ - 'keep_tunnel_open_time': { - 'title': 'Keep tunnel open time', - 'format': 'float', - 'type': 'number', - 'default': 30, - 'description': 'Time to keep tunnel open before going down after last exploit (in seconds)' - } - } - } - }, - 'options': {'collapsed': true} -} diff --git a/monkey/monkey_island/cc/ui/src/services/configuration/definitions/credential_collectors.js b/monkey/monkey_island/cc/ui/src/services/configuration/credentialCollectors.js similarity index 92% rename from monkey/monkey_island/cc/ui/src/services/configuration/definitions/credential_collectors.js rename to monkey/monkey_island/cc/ui/src/services/configuration/credentialCollectors.js index 5f73c33ac..ba7b4a77b 100644 --- a/monkey/monkey_island/cc/ui/src/services/configuration/definitions/credential_collectors.js +++ b/monkey/monkey_island/cc/ui/src/services/configuration/credentialCollectors.js @@ -1,4 +1,4 @@ -export const credentialCollectors = { +const CREDENTIAL_COLLECTORS = { 'title': 'Credential Collectors', 'description': 'Click on a credential collector to find out what it collects.', 'type': 'string', @@ -23,3 +23,4 @@ export const credentialCollectors = { } ] } +export default CREDENTIAL_COLLECTORS diff --git a/monkey/monkey_island/cc/ui/src/services/configuration/credentials.js b/monkey/monkey_island/cc/ui/src/services/configuration/credentials.js deleted file mode 100644 index 9ab1dbf79..000000000 --- a/monkey/monkey_island/cc/ui/src/services/configuration/credentials.js +++ /dev/null @@ -1,60 +0,0 @@ -export const CREDENTIALS = { - 'title': 'Credentials', - 'type': 'object', - 'properties': { - 'exploit_user_list': { - 'title': 'Exploit user list', - 'type': 'array', - 'uniqueItems': true, - 'items': {'type': 'string'}, - 'default': [], - 'description': 'List of user names that will be used by exploiters that need ' + - 'credentials, like SSH brute-forcing.' - }, - 'exploit_password_list': { - 'title': 'Exploit password list', - 'type': 'array', - 'uniqueItems': true, - 'items': {'type': 'string'}, - 'default': [], - 'description': 'List of passwords that will be used by exploiters that need ' + - 'credentials, like SSH brute-forcing.' - }, - 'exploit_lm_hash_list': { - 'title': 'Exploit LM hash list', - 'type': 'array', - 'uniqueItems': true, - 'items': {'type': 'string'}, - 'default': [], - 'description': 'List of LM hashes to use on exploits using credentials' - }, - 'exploit_ntlm_hash_list': { - 'title': 'Exploit NTLM hash list', - 'type': 'array', - 'uniqueItems': true, - 'items': {'type': 'string'}, - 'default': [], - 'description': 'List of NTLM hashes to use on exploits using credentials' - }, - 'exploit_ssh_keys': { - 'title': 'SSH key pairs list', - 'type': 'array', - 'uniqueItems': true, - 'default': [], - 'items': { - 'type': 'object', - 'properties': { - 'public_key': { - 'title': 'Public Key', - 'type': 'string' - }, - 'private_key': { - 'title': 'Private Key', - 'type': 'string' - } - } - }, - 'description': 'List of SSH key pairs to use, when trying to ssh into servers' - } - } -} diff --git a/monkey/monkey_island/cc/ui/src/services/configuration/definitions/custom_pbas.js b/monkey/monkey_island/cc/ui/src/services/configuration/customPBAs.js similarity index 94% rename from monkey/monkey_island/cc/ui/src/services/configuration/definitions/custom_pbas.js rename to monkey/monkey_island/cc/ui/src/services/configuration/customPBAs.js index 06d51a304..e8c5933ae 100644 --- a/monkey/monkey_island/cc/ui/src/services/configuration/definitions/custom_pbas.js +++ b/monkey/monkey_island/cc/ui/src/services/configuration/customPBAs.js @@ -1,4 +1,4 @@ -export const customPBAConfigurationSchema = { +const CUSTOM_PBA_CONFIGURATION_SCHEMA = { 'title': 'Custom PBA', 'properties': { 'linux_command': { @@ -49,3 +49,4 @@ export const customPBAConfigurationSchema = { } } } +export default CUSTOM_PBA_CONFIGURATION_SCHEMA; diff --git a/monkey/monkey_island/cc/ui/src/services/configuration/definitions/exploitation.js b/monkey/monkey_island/cc/ui/src/services/configuration/definitions/exploitation.js deleted file mode 100644 index fdbd04401..000000000 --- a/monkey/monkey_island/cc/ui/src/services/configuration/definitions/exploitation.js +++ /dev/null @@ -1,26 +0,0 @@ -import {exploitationOptionsConfigurationSchema} from './exploitation_options.js'; - -export const exploitationConfigurationSchema = { - 'title': 'Exploiters', - 'type': 'object', - 'description': 'Choose which exploiters the Monkey will attempt.', - 'properties': { - 'brute_force': { - 'title': 'Brute force exploiters', - 'type': 'array', - 'uniqueItems': true, - 'items': { - '$ref': '#/definitions/brute_force_classes' - } - }, - 'vulnerability': { - 'title': 'Vulnerability Exploiters', - 'type': 'array', - 'uniqueItems': true, - 'items': { - '$ref': '#/definitions/vulnerability_classes' - } - }, - 'options': exploitationOptionsConfigurationSchema - } -}; diff --git a/monkey/monkey_island/cc/ui/src/services/configuration/definitions/network_scan.js b/monkey/monkey_island/cc/ui/src/services/configuration/definitions/network_scan.js deleted file mode 100644 index 713ac1c82..000000000 --- a/monkey/monkey_island/cc/ui/src/services/configuration/definitions/network_scan.js +++ /dev/null @@ -1,21 +0,0 @@ -import {icmpScanConfigurationSchema} from './icmp_scan.js'; -import {scanTargetConfigurationSchema} from './scan_target.js'; -import {tcpScanConfigurationSchema} from './tcp_scan.js'; - -export const networkScanConfigurationSchema = { - 'title': 'Network analysis', - 'type': 'object', - 'properties': { - 'fingerprinters': { - 'title': 'Fingerprinters', - 'type': 'array', - 'uniqueItems': true, - 'items': { - '$ref': '#/definitions/fingerprinter_classes' - } - }, - 'icmp': icmpScanConfigurationSchema, - 'targets': scanTargetConfigurationSchema, - 'tcp': tcpScanConfigurationSchema - } -} diff --git a/monkey/monkey_island/cc/ui/src/services/configuration/definitions/exploitation_options.js b/monkey/monkey_island/cc/ui/src/services/configuration/exploitationOptions.js similarity index 76% rename from monkey/monkey_island/cc/ui/src/services/configuration/definitions/exploitation_options.js rename to monkey/monkey_island/cc/ui/src/services/configuration/exploitationOptions.js index e13d4ef7d..4995fb575 100644 --- a/monkey/monkey_island/cc/ui/src/services/configuration/definitions/exploitation_options.js +++ b/monkey/monkey_island/cc/ui/src/services/configuration/exploitationOptions.js @@ -1,4 +1,4 @@ -export const exploitationOptionsConfigurationSchema = { +const EXPLOITATION_OPTIONS_CONFIGURATION_SCHEMA = { 'title': 'Exploiters Options', 'type': 'object', 'properties': { @@ -13,3 +13,4 @@ export const exploitationOptionsConfigurationSchema = { } } } +export default EXPLOITATION_OPTIONS_CONFIGURATION_SCHEMA; diff --git a/monkey/monkey_island/cc/ui/src/services/configuration/definitions/exploiter_classes.js b/monkey/monkey_island/cc/ui/src/services/configuration/exploiterClasses.js similarity index 98% rename from monkey/monkey_island/cc/ui/src/services/configuration/definitions/exploiter_classes.js rename to monkey/monkey_island/cc/ui/src/services/configuration/exploiterClasses.js index bc7137fa1..3d03679b3 100644 --- a/monkey/monkey_island/cc/ui/src/services/configuration/definitions/exploiter_classes.js +++ b/monkey/monkey_island/cc/ui/src/services/configuration/exploiterClasses.js @@ -1,4 +1,4 @@ -export const bruteForceExploiters = { +export const BRUTE_FORCE_EXPLOITERS = { 'title': 'Brute force exploiters', 'description': 'Click on exploiter to get more information about it.' + '\u26A0' @@ -68,7 +68,7 @@ export const bruteForceExploiters = { ] } -export const vulnerabilityExploiters = { +export const VULNERABILITY_EXPLOITERS = { 'title': 'Vulnerability exploiters', 'description': 'Click on exploiter to get more information about it.' + '\u26A0 Note that using unsafe exploits may cause craches of the exploited ' + diff --git a/monkey/monkey_island/cc/ui/src/services/configuration/definitions/plugins.js b/monkey/monkey_island/cc/ui/src/services/configuration/plugins.js similarity index 100% rename from monkey/monkey_island/cc/ui/src/services/configuration/definitions/plugins.js rename to monkey/monkey_island/cc/ui/src/services/configuration/plugins.js diff --git a/monkey/monkey_island/cc/ui/src/services/configuration/definitions/post_breach_actions.js b/monkey/monkey_island/cc/ui/src/services/configuration/postBreachActions.js similarity index 98% rename from monkey/monkey_island/cc/ui/src/services/configuration/definitions/post_breach_actions.js rename to monkey/monkey_island/cc/ui/src/services/configuration/postBreachActions.js index e0606b8d1..8429dfb21 100644 --- a/monkey/monkey_island/cc/ui/src/services/configuration/definitions/post_breach_actions.js +++ b/monkey/monkey_island/cc/ui/src/services/configuration/postBreachActions.js @@ -1,4 +1,4 @@ -export const postBreachActions = { +const POST_BREACH_ACTIONS = { 'title': 'Post-Breach Actions', 'description': 'Runs scripts/commands on infected machines. These actions safely simulate what ' + 'an adversary might do after breaching a new machine. Used in ATT&CK and Zero trust reports.', @@ -109,3 +109,4 @@ export const postBreachActions = { } +export default POST_BREACH_ACTIONS; diff --git a/monkey/monkey_island/cc/ui/src/services/configuration/propagation/credentials.js b/monkey/monkey_island/cc/ui/src/services/configuration/propagation/credentials.js new file mode 100644 index 000000000..63c0f44ae --- /dev/null +++ b/monkey/monkey_island/cc/ui/src/services/configuration/propagation/credentials.js @@ -0,0 +1,62 @@ +const CREDENTIALS = { + 'title': 'Credentials', + 'type': 'object', + 'properties': { + 'exploit_user_list': { + 'title': 'Exploit user list', + 'type': 'array', + 'uniqueItems': true, + 'items': {'type': 'string'}, + 'default': [], + 'description': 'List of user names that will be used by exploiters that need ' + + 'credentials, like SSH brute-forcing.' + }, + 'exploit_password_list': { + 'title': 'Exploit password list', + 'type': 'array', + 'uniqueItems': true, + 'items': {'type': 'string'}, + 'default': [], + 'description': 'List of passwords that will be used by exploiters that need ' + + 'credentials, like SSH brute-forcing.' + }, + 'exploit_lm_hash_list': { + 'title': 'Exploit LM hash list', + 'type': 'array', + 'uniqueItems': true, + 'items': {'type': 'string'}, + 'default': [], + 'description': 'List of LM hashes to use on exploits using credentials' + }, + 'exploit_ntlm_hash_list': { + 'title': 'Exploit NTLM hash list', + 'type': 'array', + 'uniqueItems': true, + 'items': {'type': 'string'}, + 'default': [], + 'description': 'List of NTLM hashes to use on exploits using credentials' + }, + 'exploit_ssh_keys': { + 'title': 'SSH key pairs list', + 'type': 'array', + 'uniqueItems': true, + 'default': [], + 'items': { + 'type': 'object', + 'properties': { + 'public_key': { + 'title': 'Public Key', + 'type': 'string' + }, + 'private_key': { + 'title': 'Private Key', + 'type': 'string' + } + } + }, + 'description': 'List of SSH key pairs to use, when trying to ssh into servers' + } + } +} + +export default CREDENTIALS; diff --git a/monkey/monkey_island/cc/ui/src/services/configuration/propagation/exploitation.js b/monkey/monkey_island/cc/ui/src/services/configuration/propagation/exploitation.js new file mode 100644 index 000000000..39a8dac17 --- /dev/null +++ b/monkey/monkey_island/cc/ui/src/services/configuration/propagation/exploitation.js @@ -0,0 +1,24 @@ +import EXPLOITATION_OPTIONS_CONFIGURATION_SCHEMA from '../exploitationOptions.js'; +import {BRUTE_FORCE_EXPLOITERS, VULNERABILITY_EXPLOITERS} from '../exploiterClasses'; + +const EXPLOITATION_CONFIGURATION_SCHEMA = { + 'title': 'Exploiters', + 'properties': { + 'brute_force': { + 'items': BRUTE_FORCE_EXPLOITERS, + 'title': 'Brute force exploiters', + 'type': 'array', + 'uniqueItems': true, + }, + 'vulnerability': { + 'items': VULNERABILITY_EXPLOITERS, + 'title': 'Vulnerability Exploiters', + 'type': 'array', + 'uniqueItems': true, + }, + }, + 'options': EXPLOITATION_OPTIONS_CONFIGURATION_SCHEMA, + 'type': 'object' +}; + +export default EXPLOITATION_CONFIGURATION_SCHEMA; diff --git a/monkey/monkey_island/cc/ui/src/services/configuration/definitions/fingerprinter_classes.js b/monkey/monkey_island/cc/ui/src/services/configuration/propagation/fingerprinterClasses.js similarity index 95% rename from monkey/monkey_island/cc/ui/src/services/configuration/definitions/fingerprinter_classes.js rename to monkey/monkey_island/cc/ui/src/services/configuration/propagation/fingerprinterClasses.js index 1d4621599..51cba1708 100644 --- a/monkey/monkey_island/cc/ui/src/services/configuration/definitions/fingerprinter_classes.js +++ b/monkey/monkey_island/cc/ui/src/services/configuration/propagation/fingerprinterClasses.js @@ -1,4 +1,4 @@ -export const fingerprinterClasses = { +const FINGERPRINTER_CLASSES = { 'title': 'Fingerprinters', 'description': 'Fingerprint modules collect info about external services ' + 'Infection Monkey scans.', @@ -50,3 +50,5 @@ export const fingerprinterClasses = { ] } + +export default FINGERPRINTER_CLASSES; diff --git a/monkey/monkey_island/cc/ui/src/services/configuration/definitions/icmp_scan.js b/monkey/monkey_island/cc/ui/src/services/configuration/propagation/icmpScan.js similarity index 73% rename from monkey/monkey_island/cc/ui/src/services/configuration/definitions/icmp_scan.js rename to monkey/monkey_island/cc/ui/src/services/configuration/propagation/icmpScan.js index 25d72b21c..3937b6428 100644 --- a/monkey/monkey_island/cc/ui/src/services/configuration/definitions/icmp_scan.js +++ b/monkey/monkey_island/cc/ui/src/services/configuration/propagation/icmpScan.js @@ -1,4 +1,4 @@ -export const icmpScanConfigurationSchema = { +const ICMP_SCAN_CONFIGURATION_SCHEMA = { 'title': 'Ping scanner', 'type': 'object', 'properties': { @@ -10,3 +10,5 @@ export const icmpScanConfigurationSchema = { } } } + +export default ICMP_SCAN_CONFIGURATION_SCHEMA; diff --git a/monkey/monkey_island/cc/ui/src/services/configuration/propagation/networkScan.js b/monkey/monkey_island/cc/ui/src/services/configuration/propagation/networkScan.js new file mode 100644 index 000000000..ecd7643cc --- /dev/null +++ b/monkey/monkey_island/cc/ui/src/services/configuration/propagation/networkScan.js @@ -0,0 +1,22 @@ +import ICMP_SCAN_CONFIGURATION_SCHEMA from './icmpScan.js'; +import SCAN_TARGET_CONFIGURATION_SCHEMA from './scanTarget.js'; +import FINGERPRINTER_CLASSES from './fingerprinterClasses'; +import TCP_SCAN_CONFIGURATION_SCHEMA from './tcpScan'; + +const NETWORK_SCAN_CONFIGURATION_SCHEMA = { + 'title': 'Network analysis', + 'type': 'object', + 'properties': { + 'fingerprinters': { + 'title': 'Fingerprinters', + 'type': 'array', + 'uniqueItems': true, + 'items': FINGERPRINTER_CLASSES + }, + 'icmp': ICMP_SCAN_CONFIGURATION_SCHEMA, + 'targets': SCAN_TARGET_CONFIGURATION_SCHEMA, + 'tcp': TCP_SCAN_CONFIGURATION_SCHEMA + } +} + +export default NETWORK_SCAN_CONFIGURATION_SCHEMA; diff --git a/monkey/monkey_island/cc/ui/src/services/configuration/definitions/propagation.js b/monkey/monkey_island/cc/ui/src/services/configuration/propagation/propagation.js similarity index 54% rename from monkey/monkey_island/cc/ui/src/services/configuration/definitions/propagation.js rename to monkey/monkey_island/cc/ui/src/services/configuration/propagation/propagation.js index 3099876dc..6df67ff3e 100644 --- a/monkey/monkey_island/cc/ui/src/services/configuration/definitions/propagation.js +++ b/monkey/monkey_island/cc/ui/src/services/configuration/propagation/propagation.js @@ -1,11 +1,13 @@ -import {exploitationConfigurationSchema} from './exploitation.js'; -import {networkScanConfigurationSchema} from './network_scan.js'; +import NETWORK_SCAN_CONFIGURATION_SCHEMA from './networkScan.js'; +import CREDENTIALS from './credentials'; +import EXPLOITATION_CONFIGURATION_SCHEMA from './exploitation'; -export const propagationConfigurationSchema = { +const PROPAGATION_CONFIGURATION_SCHEMA = { 'title': 'Propagation', 'type': 'object', 'properties': { - 'exploitation': exploitationConfigurationSchema, + 'exploitation': EXPLOITATION_CONFIGURATION_SCHEMA, + 'credentials': CREDENTIALS, 'maximum_depth': { 'title': 'Maximum scan depth', 'type': 'integer', @@ -18,6 +20,7 @@ export const propagationConfigurationSchema = { 'Monkey propagating too far, '+ 'if the "Local network scan" is enabled' }, - 'network_scan': networkScanConfigurationSchema + 'network_scan': NETWORK_SCAN_CONFIGURATION_SCHEMA } } +export default PROPAGATION_CONFIGURATION_SCHEMA; diff --git a/monkey/monkey_island/cc/ui/src/services/configuration/definitions/scan_target.js b/monkey/monkey_island/cc/ui/src/services/configuration/propagation/scanTarget.js similarity index 96% rename from monkey/monkey_island/cc/ui/src/services/configuration/definitions/scan_target.js rename to monkey/monkey_island/cc/ui/src/services/configuration/propagation/scanTarget.js index ba2c769e6..8d81b10e4 100644 --- a/monkey/monkey_island/cc/ui/src/services/configuration/definitions/scan_target.js +++ b/monkey/monkey_island/cc/ui/src/services/configuration/propagation/scanTarget.js @@ -1,4 +1,4 @@ -export const scanTargetConfigurationSchema = { +const SCAN_TARGET_CONFIGURATION_SCHEMA = { 'title': 'Network', 'type': 'object', 'properties': { @@ -68,3 +68,4 @@ export const scanTargetConfigurationSchema = { } } +export default SCAN_TARGET_CONFIGURATION_SCHEMA; diff --git a/monkey/monkey_island/cc/ui/src/services/configuration/definitions/tcp_scan.js b/monkey/monkey_island/cc/ui/src/services/configuration/propagation/tcpScan.js similarity index 86% rename from monkey/monkey_island/cc/ui/src/services/configuration/definitions/tcp_scan.js rename to monkey/monkey_island/cc/ui/src/services/configuration/propagation/tcpScan.js index abfdc709d..74070d452 100644 --- a/monkey/monkey_island/cc/ui/src/services/configuration/definitions/tcp_scan.js +++ b/monkey/monkey_island/cc/ui/src/services/configuration/propagation/tcpScan.js @@ -1,4 +1,4 @@ -export const tcpScanConfigurationSchema = { +const TCP_SCAN_CONFIGURATION_SCHEMA = { 'title': 'TCP scanner', 'type': 'object', 'properties': { @@ -19,3 +19,4 @@ export const tcpScanConfigurationSchema = { } } } +export default TCP_SCAN_CONFIGURATION_SCHEMA; diff --git a/monkey/monkey_island/cc/ui/src/services/configuration/definitions/ransomware.js b/monkey/monkey_island/cc/ui/src/services/configuration/ransomware.js similarity index 97% rename from monkey/monkey_island/cc/ui/src/services/configuration/definitions/ransomware.js rename to monkey/monkey_island/cc/ui/src/services/configuration/ransomware.js index fa46d03c9..ea0262b69 100644 --- a/monkey/monkey_island/cc/ui/src/services/configuration/definitions/ransomware.js +++ b/monkey/monkey_island/cc/ui/src/services/configuration/ransomware.js @@ -1,4 +1,4 @@ -export const ransomwareSchema = { +const RANSOMWARE_SCHEMA = { 'title': 'Payloads', 'properties': { 'encryption': { @@ -63,3 +63,5 @@ export const ransomwareSchema = { } } } + +export default RANSOMWARE_SCHEMA; From 138a065d75faf5f8024ea71073b2b19ba0ac1672 Mon Sep 17 00:00:00 2001 From: vakarisz Date: Thu, 14 Jul 2022 17:20:26 +0300 Subject: [PATCH 11/14] UI: Remove float format from schema There is no such format and ui throws warnings --- .../cc/ui/src/services/configuration/configSchema.js | 1 - .../cc/ui/src/services/configuration/propagation/icmpScan.js | 1 - .../cc/ui/src/services/configuration/propagation/tcpScan.js | 1 - 3 files changed, 3 deletions(-) diff --git a/monkey/monkey_island/cc/ui/src/services/configuration/configSchema.js b/monkey/monkey_island/cc/ui/src/services/configuration/configSchema.js index fbb619d18..539bbb71e 100644 --- a/monkey/monkey_island/cc/ui/src/services/configuration/configSchema.js +++ b/monkey/monkey_island/cc/ui/src/services/configuration/configSchema.js @@ -33,7 +33,6 @@ export const SCHEMA = { 'properties':{ 'keep_tunnel_open_time': { 'title': 'Keep tunnel open time', - 'format': 'float', 'type': 'number', 'default': 30, 'description': 'Time to keep tunnel open before going down after last exploit (in seconds)' diff --git a/monkey/monkey_island/cc/ui/src/services/configuration/propagation/icmpScan.js b/monkey/monkey_island/cc/ui/src/services/configuration/propagation/icmpScan.js index 3937b6428..88ad74217 100644 --- a/monkey/monkey_island/cc/ui/src/services/configuration/propagation/icmpScan.js +++ b/monkey/monkey_island/cc/ui/src/services/configuration/propagation/icmpScan.js @@ -3,7 +3,6 @@ const ICMP_SCAN_CONFIGURATION_SCHEMA = { 'type': 'object', 'properties': { 'timeout': { - 'format': 'float', 'title': 'Ping scan timeout', 'type': 'number', 'description': 'Maximum time to wait for ping response' diff --git a/monkey/monkey_island/cc/ui/src/services/configuration/propagation/tcpScan.js b/monkey/monkey_island/cc/ui/src/services/configuration/propagation/tcpScan.js index 74070d452..98baee38c 100644 --- a/monkey/monkey_island/cc/ui/src/services/configuration/propagation/tcpScan.js +++ b/monkey/monkey_island/cc/ui/src/services/configuration/propagation/tcpScan.js @@ -13,7 +13,6 @@ const TCP_SCAN_CONFIGURATION_SCHEMA = { }, 'timeout': { 'title': 'TCP scan timeout', - 'format': 'float', 'type': 'number', 'description': 'Maximum time to wait for TCP response.' } From d2c8065163326d1df06692ecada0596f0b46627b Mon Sep 17 00:00:00 2001 From: vakarisz Date: Thu, 14 Jul 2022 17:37:57 +0300 Subject: [PATCH 12/14] UI: Adjust safe option validation to new schema --- .../cc/ui/src/components/utils/SafeOptionValidator.js | 10 +++++----- .../cc/ui/src/services/configuration/configSchema.js | 6 +----- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/monkey/monkey_island/cc/ui/src/components/utils/SafeOptionValidator.js b/monkey/monkey_island/cc/ui/src/components/utils/SafeOptionValidator.js index 52aec245d..2f9e88298 100644 --- a/monkey/monkey_island/cc/ui/src/components/utils/SafeOptionValidator.js +++ b/monkey/monkey_island/cc/ui/src/components/utils/SafeOptionValidator.js @@ -2,27 +2,27 @@ function getPluginDescriptors(schema, config) { return ([ { name: 'Brute force exploiters', - allPlugins: schema.definitions.brute_force_classes.anyOf, + allPlugins: schema.properties.propagation.properties.exploitation.properties.brute_force.items.anyOf, selectedPlugins: config.propagation.exploitation.brute_force }, { name: 'Vulnerability exploiters', - allPlugins: schema.definitions.vulnerability_classes.anyOf, + allPlugins: schema.properties.propagation.properties.exploitation.properties.vulnerability.items.anyOf, selectedPlugins: config.propagation.exploitation.vulnerability }, { name: 'Fingerprinters', - allPlugins: schema.definitions.fingerprinter_classes.anyOf, + allPlugins: schema.properties.propagation.properties.network_scan.properties.fingerprinters.items.anyOf, selectedPlugins: config.propagation.network_scan.fingerprinters }, { name: 'PostBreachActions', - allPlugins: schema.definitions.post_breach_actions.anyOf, + allPlugins: schema.properties.post_breach_actions.items.anyOf, selectedPlugins: config.post_breach_actions }, { name: 'CredentialCollectors', - allPlugins: schema.definitions.credential_collectors_classes.anyOf, + allPlugins: schema.properties.credential_collectors.items.anyOf, selectedPlugins: config.credential_collectors } ]); diff --git a/monkey/monkey_island/cc/ui/src/services/configuration/configSchema.js b/monkey/monkey_island/cc/ui/src/services/configuration/configSchema.js index 539bbb71e..1aa888a9e 100644 --- a/monkey/monkey_island/cc/ui/src/services/configuration/configSchema.js +++ b/monkey/monkey_island/cc/ui/src/services/configuration/configSchema.js @@ -21,11 +21,7 @@ export const SCHEMA = { 'title': 'Credential collectors', 'type': 'array', 'uniqueItems': true, - 'items': CREDENTIAL_COLLECTORS, - 'default': [ - 'MimikatzCollector', - 'SSHCollector' - ] + 'items': CREDENTIAL_COLLECTORS }, 'advanced': { 'title': 'Advanced', From 77b24ba7a6be47c7a6de66d81ab6ec91dd9e7fbb Mon Sep 17 00:00:00 2001 From: vakarisz Date: Fri, 15 Jul 2022 11:02:26 +0300 Subject: [PATCH 13/14] UI: Fix a typo in credentials.js --- .../cc/ui/src/services/configuration/propagation/credentials.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/monkey/monkey_island/cc/ui/src/services/configuration/propagation/credentials.js b/monkey/monkey_island/cc/ui/src/services/configuration/propagation/credentials.js index 63c0f44ae..f2ba5c222 100644 --- a/monkey/monkey_island/cc/ui/src/services/configuration/propagation/credentials.js +++ b/monkey/monkey_island/cc/ui/src/services/configuration/propagation/credentials.js @@ -8,7 +8,7 @@ const CREDENTIALS = { 'uniqueItems': true, 'items': {'type': 'string'}, 'default': [], - 'description': 'List of user names that will be used by exploiters that need ' + + 'description': 'List of usernames that will be used by exploiters that need ' + 'credentials, like SSH brute-forcing.' }, 'exploit_password_list': { From ec9a654fdf3cde3f1b4f2c5b1c70dcd1be80f5f3 Mon Sep 17 00:00:00 2001 From: vakarisz Date: Fri, 15 Jul 2022 11:20:14 +0300 Subject: [PATCH 14/14] UI: Fix style problems in minor components --- .../ui/src/components/ui-components/AdvancedMultiSelect.js | 2 +- .../cc/ui/src/components/ui-components/InfoPane.js | 4 +--- .../src/services/configuration/propagation/exploitation.js | 6 +++--- 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/monkey/monkey_island/cc/ui/src/components/ui-components/AdvancedMultiSelect.js b/monkey/monkey_island/cc/ui/src/components/ui-components/AdvancedMultiSelect.js index df72ef682..bd6933ac2 100644 --- a/monkey/monkey_island/cc/ui/src/components/ui-components/AdvancedMultiSelect.js +++ b/monkey/monkey_island/cc/ui/src/components/ui-components/AdvancedMultiSelect.js @@ -61,7 +61,7 @@ class AdvancedMultiSelect extends React.Component { namesToPlugins = (names, allPlugins) => { let plugins = []; for (let i = 0; i < names.length; i++){ - plugins.push(_.clone(allPlugins[names[i]])); + plugins.push(cloneDeep(allPlugins[names[i]])); } return plugins } diff --git a/monkey/monkey_island/cc/ui/src/components/ui-components/InfoPane.js b/monkey/monkey_island/cc/ui/src/components/ui-components/InfoPane.js index 98a14be66..436aae5e5 100644 --- a/monkey/monkey_island/cc/ui/src/components/ui-components/InfoPane.js +++ b/monkey/monkey_island/cc/ui/src/components/ui-components/InfoPane.js @@ -1,9 +1,7 @@ -import {Card, Button} from 'react-bootstrap'; +import {Button, Card} from 'react-bootstrap'; import React from 'react'; import {FontAwesomeIcon} from '@fortawesome/react-fontawesome'; import {faQuestionCircle} from '@fortawesome/free-solid-svg-icons'; - -import {getObjectFromRegistryByRef} from './JsonSchemaHelpers'; import WarningIcon from './WarningIcon'; const WarningType = { diff --git a/monkey/monkey_island/cc/ui/src/services/configuration/propagation/exploitation.js b/monkey/monkey_island/cc/ui/src/services/configuration/propagation/exploitation.js index 39a8dac17..2b24b91f3 100644 --- a/monkey/monkey_island/cc/ui/src/services/configuration/propagation/exploitation.js +++ b/monkey/monkey_island/cc/ui/src/services/configuration/propagation/exploitation.js @@ -8,14 +8,14 @@ const EXPLOITATION_CONFIGURATION_SCHEMA = { 'items': BRUTE_FORCE_EXPLOITERS, 'title': 'Brute force exploiters', 'type': 'array', - 'uniqueItems': true, + 'uniqueItems': true }, 'vulnerability': { 'items': VULNERABILITY_EXPLOITERS, 'title': 'Vulnerability Exploiters', 'type': 'array', - 'uniqueItems': true, - }, + 'uniqueItems': true + } }, 'options': EXPLOITATION_OPTIONS_CONFIGURATION_SCHEMA, 'type': 'object'