UI: Reorganize and simplify configuration schema

This commit is contained in:
vakarisz 2022-07-14 17:05:54 +03:00
parent efbc1d3860
commit 1445bcf4ad
22 changed files with 187 additions and 184 deletions

View File

@ -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';

View File

@ -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,

View File

@ -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}
}

View File

@ -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}
}

View File

@ -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

View File

@ -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'
}
}
}

View File

@ -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;

View File

@ -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
}
};

View File

@ -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
}
}

View File

@ -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;

View File

@ -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 ' +

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;