From a4e66a0c9e586a57980f5c1184f2d38795c287e0 Mon Sep 17 00:00:00 2001 From: Ilija Lazoroski Date: Mon, 4 Jul 2022 13:11:30 +0200 Subject: [PATCH] UI: Add ransomware to config schema --- .../configuration-components/UiSchema.js | 12 ++++ .../services/configuration/config_schema.js | 11 +--- .../configuration/definitions/ransomware.js | 65 +++++++++++++++++++ 3 files changed, 79 insertions(+), 9 deletions(-) create mode 100644 monkey/monkey_island/cc/ui/src/services/configuration/definitions/ransomware.js 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 be1ab6abb..bc4a72a14 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 @@ -1,5 +1,6 @@ import AdvancedMultiSelect from '../ui-components/AdvancedMultiSelect'; import InfoBox from './InfoBox'; +import TextBox from './TextBox.js'; export default function UiSchema(props) { const UiSchema = { @@ -36,6 +37,17 @@ export default function UiSchema(props) { } } }, + payloads: { + classNames: 'config-template-no-header', + encryption: { + info_box : { + 'ui:field': InfoBox + }, + text_box: { + 'ui:field': TextBox + } + } + }, custom_pbas: { classNames: 'config-template-no-header' }, 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 index a0ad4818b..6700e5e4a 100644 --- a/monkey/monkey_island/cc/ui/src/services/configuration/config_schema.js +++ b/monkey/monkey_island/cc/ui/src/services/configuration/config_schema.js @@ -1,5 +1,5 @@ import {customPBAConfigurationSchema} from './definitions/custom_pbas.js'; -import {pluginConfigurationSchema} from './definitions/plugins.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'; @@ -27,14 +27,7 @@ export const SCHEMA = { } }, 'custom_pbas': customPBAConfigurationSchema, - 'payloads': { - 'title': 'Payloads', - 'type': 'array', - 'items': pluginConfigurationSchema, - 'default': [ - {'name': 'ransomware', 'safe': true, 'options': {}} - ] - }, + 'payloads': ransomwareSchema, 'credential_collectors': { 'title': 'Credential collectors', 'type': 'array', diff --git a/monkey/monkey_island/cc/ui/src/services/configuration/definitions/ransomware.js b/monkey/monkey_island/cc/ui/src/services/configuration/definitions/ransomware.js new file mode 100644 index 000000000..fa46d03c9 --- /dev/null +++ b/monkey/monkey_island/cc/ui/src/services/configuration/definitions/ransomware.js @@ -0,0 +1,65 @@ +export const ransomwareSchema = { + 'title': 'Payloads', + 'properties': { + 'encryption': { + 'title': 'Ransomware simulation', + 'type': 'object', + 'description': 'To simulate ransomware encryption, you\'ll need to provide Infection ' + + 'Monkey with files that it can safely encrypt. On each machine where you would like ' + + 'the ransomware simulation to run, create a directory and put some files in it.' + + '\n\nProvide the path to the directory that was created on each machine.', + 'properties': { + 'enabled': { + 'title': 'Encrypt files', + 'type': 'boolean', + 'default': true, + 'description': 'Ransomware encryption will be simulated by flipping every bit ' + + 'in the files contained within the target directories.' + }, + 'info_box': { + 'info': 'No files will be encrypted if a directory is not specified or doesn\'t ' + + 'exist on a victim machine.' + }, + 'directories': { + 'title': 'Directories to encrypt', + 'type': 'object', + 'properties': { + 'linux_target_dir': { + 'title': 'Linux target directory', + 'type': 'string', + 'format': 'valid-ransomware-target-path-linux', + 'default': '', + 'description': 'A path to a directory on Linux systems that contains ' + + 'files that you will allow Infection Monkey to encrypt. If no ' + + 'directory is specified, no files will be encrypted.' + }, + 'windows_target_dir': { + 'title': 'Windows target directory', + 'type': 'string', + 'format': 'valid-ransomware-target-path-windows', + 'default': '', + 'description': 'A path to a directory on Windows systems that contains ' + + 'files that you will allow Infection Monkey to encrypt. If no ' + + 'directory is specified, no files will be encrypted.' + } + } + }, + 'text_box': { + 'text': 'Note: A README.txt will be left in the specified target directory.' + } + } + }, + 'other_behaviors': { + 'title': 'Other ransomware behavior', + 'type': 'object', + 'properties': { + 'readme': { + 'title': 'Create a README.txt file', + 'type': 'boolean', + 'default': true, + 'description': 'Creates a README.txt ransomware note on infected systems.' + } + } + } + } +}