forked from p15670423/monkey
Add force-kill monkey toggle
This commit is contained in:
parent
74af4e1627
commit
4e223c5ae2
|
@ -31,7 +31,7 @@ class NodeService:
|
||||||
# node is infected
|
# node is infected
|
||||||
new_node = NodeService.monkey_to_net_node(monkey)
|
new_node = NodeService.monkey_to_net_node(monkey)
|
||||||
for key in monkey:
|
for key in monkey:
|
||||||
if key not in ["_id", "modifytime", "parent", "dead", "config"]:
|
if key not in ["_id", "modifytime", "parent", "dead"]:
|
||||||
new_node[key] = monkey[key]
|
new_node[key] = monkey[key]
|
||||||
|
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -77,6 +77,7 @@
|
||||||
"react-jsonschema-form": "^0.49.0",
|
"react-jsonschema-form": "^0.49.0",
|
||||||
"react-redux": "^5.0.6",
|
"react-redux": "^5.0.6",
|
||||||
"react-router-dom": "^4.2.2",
|
"react-router-dom": "^4.2.2",
|
||||||
|
"react-toggle": "^4.0.1",
|
||||||
"redux": "^3.7.2"
|
"redux": "^3.7.2"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,7 +13,8 @@ import ReportPage from 'components/pages/ReportPage';
|
||||||
|
|
||||||
require('normalize.css/normalize.css');
|
require('normalize.css/normalize.css');
|
||||||
require('react-data-components/css/table-twbs.css');
|
require('react-data-components/css/table-twbs.css');
|
||||||
require('styles/App.css');
|
require('styles/App.css')
|
||||||
|
require('react-toggle/style.css');
|
||||||
|
|
||||||
let logoImage = require('../images/monkey-logo.png');
|
let logoImage = require('../images/monkey-logo.png');
|
||||||
let guardicoreLogoImage = require('../images/guardicore-logo.png');
|
let guardicoreLogoImage = require('../images/guardicore-logo.png');
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import {Icon} from 'react-fa';
|
import {Icon} from 'react-fa';
|
||||||
|
import Toggle from 'react-toggle';
|
||||||
|
|
||||||
class PreviewPaneComponent extends React.Component {
|
class PreviewPaneComponent extends React.Component {
|
||||||
|
|
||||||
|
@ -57,6 +58,29 @@ class PreviewPaneComponent extends React.Component {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
forceKill(event, asset) {
|
||||||
|
let newConfig = asset.config;
|
||||||
|
newConfig['alive'] = !event.target.checked;
|
||||||
|
fetch('/api/monkey/' + asset.guid,
|
||||||
|
{
|
||||||
|
method: 'PATCH',
|
||||||
|
headers: {'Content-Type': 'application/json'},
|
||||||
|
body: JSON.stringify({config: newConfig})
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
forceKillRow(asset) {
|
||||||
|
return (
|
||||||
|
<tr>
|
||||||
|
<th>Force Kill</th>
|
||||||
|
<td>
|
||||||
|
<Toggle id={asset.id} checked={!asset.config.alive} icons={false}
|
||||||
|
onChange={(e) => this.forceKill(e, asset)} />
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
exploitsTimeline(asset) {
|
exploitsTimeline(asset) {
|
||||||
if (asset.exploits.length === 0) {
|
if (asset.exploits.length === 0) {
|
||||||
return (<div />);
|
return (<div />);
|
||||||
|
@ -106,6 +130,7 @@ class PreviewPaneComponent extends React.Component {
|
||||||
{this.ipsRow(asset)}
|
{this.ipsRow(asset)}
|
||||||
{this.servicesRow(asset)}
|
{this.servicesRow(asset)}
|
||||||
{this.accessibleRow(asset)}
|
{this.accessibleRow(asset)}
|
||||||
|
{this.forceKillRow(asset)}
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
{this.exploitsTimeline(asset)}
|
{this.exploitsTimeline(asset)}
|
||||||
|
|
Loading…
Reference in New Issue