From c254a94fc05e6b0af4651f8a4ee2b715713ce39c Mon Sep 17 00:00:00 2001 From: Ilija Lazoroski Date: Fri, 1 Jul 2022 11:42:46 +0200 Subject: [PATCH] UI: Add credential collectors to the json schema --- .../configuration-components/UiSchema.js | 15 ++++++++--- .../ui-components/AdvancedMultiSelect.js | 4 +-- .../services/configuration/config_schema.js | 24 ++++++++++++------ .../definitions/credential_collectors.js | 25 +++++++++++++++++++ 4 files changed, 56 insertions(+), 12 deletions(-) create mode 100644 monkey/monkey_island/cc/ui/src/services/configuration/definitions/credential_collectors.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 86e5103f1..a4034e35e 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 @@ -9,14 +9,14 @@ export default function UiSchema(props) { classNames: 'config-template-no-header', 'ui:widget': AdvancedMultiSelect, brute_force_classes: { - classNames: 'config-template-no-header', + classNames: 'config-template-no-header' } }, vulnerability: { classNames: 'config-template-no-header', + 'ui:widget': AdvancedMultiSelect, vulnerability_classes: { - classNames: 'config-template-no-header', - //'ui:widget': AdvancedMultiSelect + classNames: 'config-template-no-header' } } }, @@ -27,6 +27,15 @@ export default function UiSchema(props) { } } } + }, + credential_collectors: { + collectors: { + classNames: 'config-template-no-header', + 'ui:widget': AdvancedMultiSelect, + credential_collectors_classes :{ + classNames: 'config-template-no-header' + } + } } }; return UiSchema[props.selectedSection] 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 f45a1c750..bcafbc035 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 @@ -52,7 +52,7 @@ class AdvancedMultiSelect extends React.Component { } onChange = (strValues) => { - console.log("Values"); + console.log('Values'); console.log(this.props); console.log(this.state); console.log(strValues); @@ -196,7 +196,7 @@ class AdvancedMultiSelect extends React.Component { id, multiple, required, - schema, + schema } = this.props; return ( 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 a2292ab57..eaa4b395b 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 @@ -2,13 +2,15 @@ import {customPBAConfigurationSchema} from './definitions/custom_pbas.js'; import {pluginConfigurationSchema} from './definitions/plugins.js'; import {propagationConfigurationSchema} from './definitions/propagation.js'; import {bruteForceExploiters, vulnerabilityExploiters} from './definitions/exploiter_classes.js'; +import {credentialCollectors} from './definitions/credential_collectors.js'; export const SCHEMA = { 'title': 'Monkey', 'type': 'object', 'definitions': { 'brute_force_classes': bruteForceExploiters, - 'vulnerability_classes': vulnerabilityExploiters + 'vulnerability_classes': vulnerabilityExploiters, + 'credential_collectors_classes': credentialCollectors }, 'properties': { 'propagation': propagationConfigurationSchema, @@ -38,12 +40,20 @@ export const SCHEMA = { }, 'credential_collectors': { 'title': 'Credential collectors', - 'type': 'array', - 'items': pluginConfigurationSchema, - 'default': [ - {'name': 'MimikatzCollector', 'safe': true, 'options':{}}, - {'name': 'SSHCollector', 'safe': true, 'options':{}} - ] + 'properties': { + 'collectors': { + 'title': 'Credential collectors', + 'type': 'array', + 'uniqueItems': true, + 'items': { + '$ref': '#/definitions/credential_collectors_classes' + }, + 'default': [ + 'MimikatzCollector', + 'SSHCollector' + ] + } + } }, 'advanced': { 'title': 'Advanced', diff --git a/monkey/monkey_island/cc/ui/src/services/configuration/definitions/credential_collectors.js b/monkey/monkey_island/cc/ui/src/services/configuration/definitions/credential_collectors.js new file mode 100644 index 000000000..5f73c33ac --- /dev/null +++ b/monkey/monkey_island/cc/ui/src/services/configuration/definitions/credential_collectors.js @@ -0,0 +1,25 @@ +export const credentialCollectors = { + 'title': 'Credential Collectors', + 'description': 'Click on a credential collector to find out what it collects.', + 'type': 'string', + 'pluginDefs': { + 'MimikatzCollector':{'name': 'MimikatzCollector', 'options': {}}, + 'SSHCollector':{'name': 'SSHCollector', 'options': {}} + }, + 'anyOf': [ + { + 'type': 'string', + 'enum': ['MimikatzCollector'], + 'title': 'Mimikatz Credentials Collector', + 'safe': true, + 'info': 'Collects credentials from Windows credential manager.' + }, + { + 'type': 'string', + 'enum': ['SSHCollector'], + 'title': 'SSH Credentials Collector', + 'safe': true, + 'info': 'Searches users\' home directories and collects SSH keypairs.' + } + ] +}