forked from p15670423/monkey
Show warning of new infections only if monkeys are running
This commit is contained in:
parent
b58c4ea622
commit
57e3677fce
|
@ -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",
|
||||
|
|
|
@ -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' ?
|
||||
<div className="alert alert-info">
|
||||
<i className="glyphicon glyphicon-info-sign" style={{'marginRight': '5px'}}/>
|
||||
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.
|
||||
</div>
|
||||
: <div />
|
||||
|
@ -131,14 +144,14 @@ class ConfigurePageComponent extends React.Component {
|
|||
onSubmit={this.onSubmit}
|
||||
onChange={this.onChange}>
|
||||
<div>
|
||||
<div className="alert alert-info">
|
||||
<i className="glyphicon glyphicon-info-sign" style={{'marginRight': '5px'}}/>
|
||||
Changing the configuration will only apply to new infections.
|
||||
</div>
|
||||
{ this.state.allMonkeysAreDead ?
|
||||
'' :
|
||||
<div className="alert alert-warning">
|
||||
<i className="glyphicon glyphicon-warning-sign" style={{'marginRight': '5px'}}/>
|
||||
Changing config values with the ⚠ mark may result in the monkey propagating too far or using dangerous exploits.
|
||||
Some monkeys are currently running. Note that changing the configuration will only apply to new
|
||||
infections.
|
||||
</div>
|
||||
}
|
||||
<div className="text-center">
|
||||
<button type="submit" className="btn btn-success btn-lg" style={{margin: '5px'}}>
|
||||
Submit
|
||||
|
|
Loading…
Reference in New Issue