From 66c2bc492cea4e56ac79394a1f282d3fac4f25d6 Mon Sep 17 00:00:00 2001 From: Ilija Lazoroski Date: Mon, 4 Jul 2022 14:45:09 +0200 Subject: [PATCH] UI: Fix custom pbas in the schema --- .../configuration-components/UiSchema.js | 36 ++++++++++++++++++- .../configuration/definitions/custom_pbas.js | 16 +++++++-- 2 files changed, 49 insertions(+), 3 deletions(-) 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 78b10276d..43423263f 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,6 +1,8 @@ import AdvancedMultiSelect from '../ui-components/AdvancedMultiSelect'; import InfoBox from './InfoBox'; import TextBox from './TextBox.js'; +import PbaInput from './PbaInput'; +import {API_PBA_LINUX, API_PBA_WINDOWS} from '../pages/ConfigurePage'; export default function UiSchema(props) { const UiSchema = { @@ -78,7 +80,39 @@ export default function UiSchema(props) { } }, custom_pbas: { - classNames: 'config-template-no-header' + classNames: 'config-template-no-header', + linux_command: { + 'ui:widget': 'textarea', + 'ui:emptyValue': '' + }, + linux_file: { + 'ui:widget': PbaInput, + 'ui:options': { + filename: props.linux_filename, + apiEndpoint: API_PBA_LINUX, + setPbaFilename: props.setPbaFilenameLinux + } + }, + windows_command: { + 'ui:widget': 'textarea', + 'ui:emptyValue': '' + }, + windows_file: { + 'ui:widget': PbaInput, + 'ui:options': { + filename: props.windows_filename, + apiEndpoint: API_PBA_WINDOWS, + setPbaFilename: props.setPbaFilenameWindows + } + }, + linux_filename: { + classNames: 'linux-pba-file-info', + 'ui:emptyValue': '' + }, + windows_filename: { + classNames: 'windows-pba-file-info', + 'ui:emptyValue': '' + } }, post_breach_actions: { classNames: 'config-template-no-header', diff --git a/monkey/monkey_island/cc/ui/src/services/configuration/definitions/custom_pbas.js b/monkey/monkey_island/cc/ui/src/services/configuration/definitions/custom_pbas.js index 9ff14d3cc..06d51a304 100644 --- a/monkey/monkey_island/cc/ui/src/services/configuration/definitions/custom_pbas.js +++ b/monkey/monkey_island/cc/ui/src/services/configuration/definitions/custom_pbas.js @@ -10,14 +10,20 @@ export const customPBAConfigurationSchema = { 'file on exploited machines.\nExample: ' + '"chmod +x ./my_script.sh; ./my_script.sh ; rm ./my_script.sh"' }, - 'linux_filename': { + 'linux_file': { 'title': 'Linux post-breach file', 'type': 'string', + 'format': 'data-url', 'description': 'File to be uploaded after breaching. ' + 'Use the "Linux post-breach command" field to ' + 'change permissions, run, or delete the file. ' + 'Reference your file by filename.' }, + 'linux_filename': { + 'title': 'Linux PBA filename', + 'type': 'string', + 'default': '' + }, 'windows_command': { 'title': 'Windows post-breach command', 'type': 'string', @@ -27,13 +33,19 @@ export const customPBAConfigurationSchema = { 'file on exploited machine.\nExample: ' + '"my_script.bat & del my_script.bat"' }, - 'windows_filename':{ + 'windows_file':{ 'title': 'Windows post-breach file', 'type': 'string', + 'format': 'data-url', 'description': 'File to be uploaded after breaching. ' + 'Use the "Windows post-breach command" field to ' + 'change permissions, run or delete the file. ' + 'Reference your file by filename.' + }, + 'windows_filename': { + 'title': 'Windows PBA filename', + 'type': 'string', + 'default': '' } } }