From 57e3677fce6616ccb845f4dbb61637ec1e34bf65 Mon Sep 17 00:00:00 2001 From: Itay Mizeretz Date: Tue, 17 Oct 2017 12:10:23 +0300 Subject: [PATCH] Show warning of new infections only if monkeys are running --- monkey_island/cc/services/config.py | 19 +++++++---- .../ui/src/components/pages/ConfigurePage.js | 33 +++++++++++++------ 2 files changed, 36 insertions(+), 16 deletions(-) diff --git a/monkey_island/cc/services/config.py b/monkey_island/cc/services/config.py index 700982164..200e24029 100644 --- a/monkey_island/cc/services/config.py +++ b/monkey_island/cc/services/config.py @@ -191,10 +191,13 @@ SCHEMA = { "description": "Determines whether the monkey should scan its subnets additionally" }, "depth": { - "title": "Depth" + WARNING_SIGN, + "title": "Distance from island", "type": "integer", "default": 2, - "description": "Amount of hops allowed for the monkey to spread" + "description": + "Amount of hops allowed for the monkey to spread from the island. " + + WARNING_SIGN + + " Note that setting this value too high may result in the monkey propagating too far" } } }, @@ -293,12 +296,14 @@ SCHEMA = { "description": "Determines the maximum number of machines the monkey is allowed to scan" }, "victims_max_exploit": { - "title": "Max victims to exploit" + WARNING_SIGN, + "title": "Max victims to exploit", "type": "integer", "default": 7, "description": "Determines the maximum number of machines the monkey" - " is allowed to successfully exploit" + " is allowed to successfully exploit. " + WARNING_SIGN + + " Note that setting this value too high may result in the monkey propagating to " + "a high number of machines" }, "timeout_between_iterations": { "title": "Wait time between iterations", @@ -576,7 +581,7 @@ SCHEMA = { "type": "object", "properties": { "exploiter_classes": { - "title": "Exploits" + WARNING_SIGN, + "title": "Exploits", "type": "array", "uniqueItems": True, "items": { @@ -590,7 +595,9 @@ SCHEMA = { "SambaCryExploiter", "ElasticGroovyExploiter" ], - "description": "Determines which exploits to use" + "description": + "Determines which exploits to use. " + WARNING_SIGN + + " Note that using unsafe exploits may cause crashes of the exploited machine/service" }, "skip_exploit_if_file_exist": { "title": "Skip exploit if file exists", diff --git a/monkey_island/cc/ui/src/components/pages/ConfigurePage.js b/monkey_island/cc/ui/src/components/pages/ConfigurePage.js index 417325e58..92d6a5687 100644 --- a/monkey_island/cc/ui/src/components/pages/ConfigurePage.js +++ b/monkey_island/cc/ui/src/components/pages/ConfigurePage.js @@ -17,7 +17,8 @@ class ConfigurePageComponent extends React.Component { saved: false, reset: false, sections: [], - selectedSection: 'basic' + selectedSection: 'basic', + allMonkeysAreDead: true }; } @@ -36,6 +37,7 @@ class ConfigurePageComponent extends React.Component { selectedSection: 'basic' }) }); + this.updateMonkeysRunning(); } onSubmit = ({formData}) => { @@ -99,6 +101,17 @@ class ConfigurePageComponent extends React.Component { }); }; + updateMonkeysRunning = () => { + fetch('/api') + .then(res => res.json()) + .then(res => { + // This check is used to prevent unnecessary re-rendering + this.setState({ + allMonkeysAreDead: (!res['completed_steps']['run_monkey']) || (res['completed_steps']['infection_done']) + }); + }); + }; + render() { let displayedSchema = {}; if (this.state.schema.hasOwnProperty('properties')) { @@ -120,7 +133,7 @@ class ConfigurePageComponent extends React.Component { this.state.selectedSection === 'basic_network' ?
- The Monkey scans its subnet if "Local network scan" is ticked. Additionally the monkey will scan machines + The Monkey scans its subnet if "Local network scan" is ticked. Additionally the monkey scans machines according to its range class.
:
@@ -131,14 +144,14 @@ class ConfigurePageComponent extends React.Component { onSubmit={this.onSubmit} onChange={this.onChange}>
-
- - Changing the configuration will only apply to new infections. -
-
- - Changing config values with the ⚠ mark may result in the monkey propagating too far or using dangerous exploits. -
+ { this.state.allMonkeysAreDead ? + '' : +
+ + Some monkeys are currently running. Note that changing the configuration will only apply to new + infections. +
+ }