diff --git a/monkey_island/cc/services/node.py b/monkey_island/cc/services/node.py index 47c8ca96b..85b05bdcb 100644 --- a/monkey_island/cc/services/node.py +++ b/monkey_island/cc/services/node.py @@ -31,7 +31,7 @@ class NodeService: # node is infected new_node = NodeService.monkey_to_net_node(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] else: diff --git a/monkey_island/cc/ui/package.json b/monkey_island/cc/ui/package.json index 73d84fa6b..5dead7e02 100644 --- a/monkey_island/cc/ui/package.json +++ b/monkey_island/cc/ui/package.json @@ -77,6 +77,7 @@ "react-jsonschema-form": "^0.49.0", "react-redux": "^5.0.6", "react-router-dom": "^4.2.2", + "react-toggle": "^4.0.1", "redux": "^3.7.2" } } diff --git a/monkey_island/cc/ui/src/components/Main.js b/monkey_island/cc/ui/src/components/Main.js index 7fe02519e..22aa91df4 100644 --- a/monkey_island/cc/ui/src/components/Main.js +++ b/monkey_island/cc/ui/src/components/Main.js @@ -13,7 +13,8 @@ import ReportPage from 'components/pages/ReportPage'; require('normalize.css/normalize.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 guardicoreLogoImage = require('../images/guardicore-logo.png'); diff --git a/monkey_island/cc/ui/src/components/preview-pane/PreviewPane.js b/monkey_island/cc/ui/src/components/preview-pane/PreviewPane.js index d7215746d..020c769e1 100644 --- a/monkey_island/cc/ui/src/components/preview-pane/PreviewPane.js +++ b/monkey_island/cc/ui/src/components/preview-pane/PreviewPane.js @@ -1,5 +1,6 @@ import React from 'react'; import {Icon} from 'react-fa'; +import Toggle from 'react-toggle'; 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 ( + + Force Kill + + this.forceKill(e, asset)} /> + + + ); + } + exploitsTimeline(asset) { if (asset.exploits.length === 0) { return (
); @@ -106,6 +130,7 @@ class PreviewPaneComponent extends React.Component { {this.ipsRow(asset)} {this.servicesRow(asset)} {this.accessibleRow(asset)} + {this.forceKillRow(asset)} {this.exploitsTimeline(asset)}