Merge pull request #1322 from guardicore/1241/ransomware-quickstart-hide-run-scoutsuite

Ransomware quickstart - Hide scoutsuite run options in ransomware mode
This commit is contained in:
Mike Salvatore 2021-07-14 14:29:41 -04:00 committed by GitHub
commit fb7a615766
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 23 additions and 5 deletions

View File

@ -27,6 +27,7 @@ import {StandardLayoutComponent} from './layouts/StandardLayoutComponent';
import LoadingScreen from './ui-components/LoadingScreen'; import LoadingScreen from './ui-components/LoadingScreen';
const reportZeroTrustRoute = '/report/zeroTrust'; const reportZeroTrustRoute = '/report/zeroTrust';
const islandModeRoute = '/api/island-mode'
class AppComponent extends AuthComponent { class AppComponent extends AuthComponent {
updateStatus = () => { updateStatus = () => {
@ -113,15 +114,26 @@ class AppComponent extends AuthComponent {
infection_done: false, infection_done: false,
report_done: false, report_done: false,
isLoggedIn: undefined, isLoggedIn: undefined,
needsRegistration: undefined needsRegistration: undefined,
islandMode: undefined
}, },
noAuthLoginAttempted: undefined noAuthLoginAttempted: undefined
}; };
} }
updateIslandMode() {
this.authFetch(islandModeRoute)
.then(res => res.json())
.then(res => {
this.setState({islandMode: res.mode})
}
);
}
componentDidMount() { componentDidMount() {
this.updateStatus(); this.updateStatus();
this.interval = setInterval(this.updateStatus, 10000); this.interval = setInterval(this.updateStatus, 10000);
this.updateIslandMode()
} }
componentWillUnmount() { componentWillUnmount() {
@ -147,6 +159,7 @@ class AppComponent extends AuthComponent {
completedSteps={this.state.completedSteps}/>)} completedSteps={this.state.completedSteps}/>)}
{this.renderRoute('/run-monkey', {this.renderRoute('/run-monkey',
<StandardLayoutComponent component={RunMonkeyPage} <StandardLayoutComponent component={RunMonkeyPage}
islandMode={this.state.islandMode}
onStatusChange={this.updateStatus} onStatusChange={this.updateStatus}
completedSteps={this.state.completedSteps}/>)} completedSteps={this.state.completedSteps}/>)}
{this.renderRoute('/infection/map', {this.renderRoute('/infection/map',

View File

@ -17,7 +17,7 @@ class RunMonkeyPageComponent extends AuthComponent {
Go ahead and run the monkey! Go ahead and run the monkey!
<i> (Or <Link to="/configure">configure the monkey</Link> to fine tune its behavior)</i> <i> (Or <Link to="/configure">configure the monkey</Link> to fine tune its behavior)</i>
</p> </p>
<RunOptions /> <RunOptions islandMode={this.props.islandMode}/>
</Col> </Col>
); );
} }

View File

@ -56,7 +56,11 @@ function RunOptions(props) {
return InlineSelection(defaultContents, newProps); return InlineSelection(defaultContents, newProps);
} }
function defaultContents() { function shouldShowScoutsuite(islandMode){
return islandMode !== 'ransomware';
}
function defaultContents(props) {
return ( return (
<> <>
<RunOnIslandButton title={'From Island'} <RunOnIslandButton title={'From Island'}
@ -69,14 +73,15 @@ function RunOptions(props) {
setComponent(LocalManualRunOptions, setComponent(LocalManualRunOptions,
{ips: ips, setComponent: setComponent}) {ips: ips, setComponent: setComponent})
}}/> }}/>
<AWSRunButton setComponent={setComponent}/> {shouldShowScoutsuite(props.islandMode) && <AWSRunButton setComponent={setComponent}/> }
<NextSelectionButton title={'Cloud security scan'} {shouldShowScoutsuite(props.islandMode) && <NextSelectionButton title={'Cloud security scan'}
description={'Explains how to enable cloud security scan.'} description={'Explains how to enable cloud security scan.'}
icon={faCloud} icon={faCloud}
onButtonClick={() => { onButtonClick={() => {
setComponent(CloudOptions, setComponent(CloudOptions,
{ips: ips, setComponent: setComponent}) {ips: ips, setComponent: setComponent})
}}/> }}/>
}
</> </>
); );
} }