diff --git a/monkey/monkey_island/cc/ui/src/components/Main.js b/monkey/monkey_island/cc/ui/src/components/Main.js index dc1e063ff..c068b9caf 100644 --- a/monkey/monkey_island/cc/ui/src/components/Main.js +++ b/monkey/monkey_island/cc/ui/src/components/Main.js @@ -27,6 +27,7 @@ import {StandardLayoutComponent} from './layouts/StandardLayoutComponent'; import LoadingScreen from './ui-components/LoadingScreen'; const reportZeroTrustRoute = '/report/zeroTrust'; +const islandModeRoute = '/api/island-mode' class AppComponent extends AuthComponent { updateStatus = () => { @@ -113,15 +114,26 @@ class AppComponent extends AuthComponent { infection_done: false, report_done: false, isLoggedIn: undefined, - needsRegistration: undefined + needsRegistration: undefined, + islandMode: undefined }, noAuthLoginAttempted: undefined }; } + updateIslandMode() { + this.authFetch(islandModeRoute) + .then(res => res.json()) + .then(res => { + this.setState({islandMode: res.mode}) + } + ); + } + componentDidMount() { this.updateStatus(); this.interval = setInterval(this.updateStatus, 10000); + this.updateIslandMode() } componentWillUnmount() { @@ -147,6 +159,7 @@ class AppComponent extends AuthComponent { completedSteps={this.state.completedSteps}/>)} {this.renderRoute('/run-monkey', )} {this.renderRoute('/infection/map', diff --git a/monkey/monkey_island/cc/ui/src/components/pages/RunMonkeyPage/RunMonkeyPage.js b/monkey/monkey_island/cc/ui/src/components/pages/RunMonkeyPage/RunMonkeyPage.js index 2a27c5be3..b87c118f9 100644 --- a/monkey/monkey_island/cc/ui/src/components/pages/RunMonkeyPage/RunMonkeyPage.js +++ b/monkey/monkey_island/cc/ui/src/components/pages/RunMonkeyPage/RunMonkeyPage.js @@ -17,7 +17,7 @@ class RunMonkeyPageComponent extends AuthComponent { Go ahead and run the monkey! (Or configure the monkey to fine tune its behavior)

- + ); } diff --git a/monkey/monkey_island/cc/ui/src/components/pages/RunMonkeyPage/RunOptions.js b/monkey/monkey_island/cc/ui/src/components/pages/RunMonkeyPage/RunOptions.js index f38c48990..1cc2aed7b 100644 --- a/monkey/monkey_island/cc/ui/src/components/pages/RunMonkeyPage/RunOptions.js +++ b/monkey/monkey_island/cc/ui/src/components/pages/RunMonkeyPage/RunOptions.js @@ -11,7 +11,6 @@ import AWSRunButton from './RunOnAWS/AWSRunButton'; import CloudOptions from './scoutsuite-setup/CloudOptions'; const CONFIG_URL = '/api/configuration/island'; -const MODE_URL = '/api/island-mode' function RunOptions(props) { @@ -57,22 +56,11 @@ function RunOptions(props) { return InlineSelection(defaultContents, newProps); } - function getIslandMode() { - let mode = 'advanced'; - authComponent.authFetch(MODE_URL) - .then(res => res.json()) - .then(res => { - mode = res.mode - } - ); - return mode; + function shouldShowScoutsuite(islandMode){ + return islandMode !== 'ransomware'; } - function shouldShowScoutsuite(){ - return getIslandMode() === 'advanced'; - } - - function defaultContents() { + function defaultContents(props) { return ( <> - {shouldShowScoutsuite() && } - {shouldShowScoutsuite() && } + {shouldShowScoutsuite(props.islandMode) && {