diff --git a/monkey/common/data/zero_trust_consts.py b/monkey/common/data/zero_trust_consts.py index 8c67f5ebf..18c02e818 100644 --- a/monkey/common/data/zero_trust_consts.py +++ b/monkey/common/data/zero_trust_consts.py @@ -100,7 +100,8 @@ TESTS_MAP = { TEST_SCHEDULED_EXECUTION: { TEST_EXPLANATION_KEY: "The Monkey was executed in a scheduled manner.", FINDING_EXPLANATION_BY_STATUS_KEY: { - STATUS_INCONCLUSIVE: "Monkey was executed in a scheduled manner. Locate this activity in User-Behavior security software." + STATUS_INCONCLUSIVE: "Monkey was executed in a scheduled manner. Locate this activity in User-Behavior security software.", + STATUS_PASSED: "Monkey failed to execute in a scheduled manner." }, RECOMMENDATION_KEY: RECOMMENDATION_USER_BEHAVIOUR, PILLARS_KEY: [PEOPLE, NETWORKS], diff --git a/monkey/monkey_island/cc/ui/src/components/pages/ZeroTrustReportPage.js b/monkey/monkey_island/cc/ui/src/components/pages/ZeroTrustReportPage.js index a901c63cf..34fec0079 100755 --- a/monkey/monkey_island/cc/ui/src/components/pages/ZeroTrustReportPage.js +++ b/monkey/monkey_island/cc/ui/src/components/pages/ZeroTrustReportPage.js @@ -77,7 +77,9 @@ class ZeroTrustReportPageComponent extends AuthComponent { return (
- {print();}} /> + { + print(); + }}/>
@@ -85,43 +87,14 @@ class ZeroTrustReportPageComponent extends AuthComponent { {content}
- {print();}} /> + { + print(); + }}/>
) } - generateFindingsSection() { - return (
-

Findings

-

- Deep-dive into the details of each test, and see the explicit events and exact timestamps in which things - happened in your network. This will enable you to match up with your SOC logs and alerts and to gain deeper - insight as to what exactly happened during this test. -

- -
); - } - - generateRecommendationsSection() { - return (
-

Recommendations

-

- Analyze each zero trust recommendation by pillar, and see if you've followed through with it. See test results - to understand how the monkey tested your adherence to that recommendation. -

- { - Object.keys(this.state.recommendations).map((pillar) => - - ) - } -
); - } - generateOverviewSection() { return (

Summary

@@ -145,13 +118,44 @@ class ZeroTrustReportPageComponent extends AuthComponent { - +
); } + generateRecommendationsSection() { + return (
+

Recommendations

+

+ Analyze each zero trust recommendation by pillar, and see if you've followed through with it. See test results + to understand how the monkey tested your adherence to that recommendation. +

+ { + Object.keys(this.state.recommendations).map((pillar) => + + ) + } +
); + } + + generateFindingsSection() { + return (
+

Findings

+

+ Deep-dive into the details of each test, and see the explicit events and exact timestamps in which things + happened in your network. This will enable you to match up with your SOC logs and alerts and to gain deeper + insight as to what exactly happened during this test. +

+ +
); + } + stillLoadingDataFromServer() { return typeof this.state.findings === "undefined" || typeof this.state.pillars === "undefined" || typeof this.state.recommendations === "undefined"; } diff --git a/monkey/monkey_island/cc/ui/src/components/report-components/zerotrust/EventsButtonsComponent.js b/monkey/monkey_island/cc/ui/src/components/report-components/zerotrust/EventsButtonsComponent.js index 8a0d97272..10027c888 100644 --- a/monkey/monkey_island/cc/ui/src/components/report-components/zerotrust/EventsButtonsComponent.js +++ b/monkey/monkey_island/cc/ui/src/components/report-components/zerotrust/EventsButtonsComponent.js @@ -26,14 +26,9 @@ export default class EventsButtonsComponent extends Component {
- - { - const content = JSON.stringify(this.props.events, null, 2); - const blob = new Blob([content], {type: "text/plain;charset=utf-8"}); - FileSaver.saveAs(blob, this.props.exportFilename + ".json"); - }}/>
); diff --git a/monkey/monkey_island/cc/ui/src/components/report-components/zerotrust/venn-components/ArcNode.js b/monkey/monkey_island/cc/ui/src/components/report-components/zerotrust/venn-components/ArcNode.js index 5512d810b..aee1fb7f2 100644 --- a/monkey/monkey_island/cc/ui/src/components/report-components/zerotrust/venn-components/ArcNode.js +++ b/monkey/monkey_island/cc/ui/src/components/report-components/zerotrust/venn-components/ArcNode.js @@ -1,14 +1,9 @@ import React from 'react' import PropTypes from 'prop-types'; -import { Popover, OverlayTrigger } from 'react-bootstrap'; +import {Popover, OverlayTrigger} from 'react-bootstrap'; import * as d3 from 'd3' class ArcNode extends React.Component { - - handleClick(e_) { this.props.disableHover(this.refs.overlay); } - handleOver(e_) { if(this.props.hover) { this.refs.overlay.show(); } } - handleOut(e_) { if(this.props.hover){ this.refs.overlay.hide(); } } - render() { let {prefix, index, data} = this.props; @@ -16,31 +11,51 @@ class ArcNode extends React.Component { let id = prefix + 'Node_' + index; return ( - - {data.tooltip}} rootClose> - + {data.tooltip}} rootClose> + - - - - {data.icon + '\u2000'} - {data.label} - - - + /> + + + + {data.icon + '\u2000'} + {data.label} + + + ); } + + + handleClick(e_) { + this.props.disableHover(this.refs.overlay); + } + + handleOver(e_) { + if (this.props.hover) { + this.refs.overlay.show(); + } + } + + handleOut(e_) { + if (this.props.hover) { + this.refs.overlay.hide(); + } + } } ArcNode.propTypes = { diff --git a/monkey/monkey_island/cc/ui/src/components/report-components/zerotrust/venn-components/CircularNode.js b/monkey/monkey_island/cc/ui/src/components/report-components/zerotrust/venn-components/CircularNode.js index a74cd74b1..5c84d95a5 100644 --- a/monkey/monkey_island/cc/ui/src/components/report-components/zerotrust/venn-components/CircularNode.js +++ b/monkey/monkey_island/cc/ui/src/components/report-components/zerotrust/venn-components/CircularNode.js @@ -1,40 +1,59 @@ import React from 'react' import PillarLabel from "../PillarLabel"; -import { Popover, OverlayTrigger } from 'react-bootstrap'; +import {Popover, OverlayTrigger} from 'react-bootstrap'; import PropTypes from 'prop-types'; class CircularNode extends React.Component { - - handleClick(e_) { this.props.disableHover(this.refs.overlay); } - handleOver(e_) { if(this.props.hover) { this.refs.overlay.show(); } } - handleOut(e_) { if(this.props.hover){ this.refs.overlay.hide(); } } - render() { let {prefix, index, data} = this.props; let translate = 'translate(' + data.cx + ',' + data.cy + ')'; return ( - - {data.tooltip}} rootClose> - + {data.tooltip}} rootClose> + - - - - - + /> + + + + + ); } + + + handleClick(e_) { + this.props.disableHover(this.refs.overlay); + } + + handleOver(e_) { + if (this.props.hover) { + this.refs.overlay.show(); + } + } + + handleOut(e_) { + if (this.props.hover) { + this.refs.overlay.hide(); + } + } + } CircularNode.propTypes = { diff --git a/monkey/monkey_island/cc/ui/src/components/report-components/zerotrust/venn-components/VennDiagram.js b/monkey/monkey_island/cc/ui/src/components/report-components/zerotrust/venn-components/VennDiagram.js index 25d36131d..c1d5d2a68 100644 --- a/monkey/monkey_island/cc/ui/src/components/report-components/zerotrust/venn-components/VennDiagram.js +++ b/monkey/monkey_island/cc/ui/src/components/report-components/zerotrust/venn-components/VennDiagram.js @@ -12,11 +12,14 @@ class VennDiagram extends React.Component { this.state = {hover: true, currentPopover: undefined}; this._disableHover = this._disableHover.bind(this); - + this.width = this.height = 512; this.prefix = 'vennDiagram'; - this.fontStyles = [{size: Math.max(9, this.width / 28), color: 'white'}, { size: Math.max(6, this.width / 38), color: 'white'}, { size: Math.max(6, this.width / 48), color: 'white'} ]; + this.fontStyles = [{size: Math.max(9, this.width / 28), color: 'white'}, { + size: Math.max(6, this.width / 38), + color: 'white' + }, {size: Math.max(6, this.width / 48), color: 'white'}]; this.offset = this.width / 16; this.thirdWidth = this.width / 3; @@ -25,14 +28,43 @@ class VennDiagram extends React.Component { this.width1By11 = this.width / 11; this.width1By28 = this.width / 28; this.arcNodesGap = 4; - + this.layout = { Data: {cx: 0, cy: 0, r: this.width11By2, offset: {x: 0, y: 0}, popover: 'top'}, - People: {cx: -this.width2By7, cy: 0, r: this.width11By2, offset: {x: this.width1By11 + this.fontStyles[1].size / 5 * 3, y: 0}, popover: 'right'}, - Networks: {cx: this.width2By7, cy: 0, r: this.width11By2, offset: {x: -this.width1By11 - this.fontStyles[1].size / 5 * 3, y: 0}, popover: 'left'}, - Devices: {cx: 0, cy: this.width2By7, r: this.width11By2, offset: {x: 0, y: -this.width1By11 + this.fontStyles[1].size / 6 * 3}, popover: 'top'}, - Workloads: {cx: 0, cy: -this.width2By7, r: this.width11By2, offset: {x: 0, y: this.width1By11}, popover: 'bottom' }, - VisibilityAndAnalytics: {inner: this.thirdWidth - this.width1By28, outer: this.thirdWidth, icon: '\uf070', popover: 'left'}, + People: { + cx: -this.width2By7, + cy: 0, + r: this.width11By2, + offset: {x: this.width1By11 + this.fontStyles[1].size / 5 * 3, y: 0}, + popover: 'right' + }, + Networks: { + cx: this.width2By7, + cy: 0, + r: this.width11By2, + offset: {x: -this.width1By11 - this.fontStyles[1].size / 5 * 3, y: 0}, + popover: 'left' + }, + Devices: { + cx: 0, + cy: this.width2By7, + r: this.width11By2, + offset: {x: 0, y: -this.width1By11 + this.fontStyles[1].size / 6 * 3}, + popover: 'top' + }, + Workloads: { + cx: 0, + cy: -this.width2By7, + r: this.width11By2, + offset: {x: 0, y: this.width1By11}, + popover: 'bottom' + }, + VisibilityAndAnalytics: { + inner: this.thirdWidth - this.width1By28, + outer: this.thirdWidth, + icon: '\uf070', + popover: 'right' + }, AutomationAndOrchestration: { inner: this.thirdWidth - this.width1By28 * 2 - this.arcNodesGap, outer: this.thirdWidth - this.width1By28 - this.arcNodesGap, @@ -85,51 +117,61 @@ class VennDiagram extends React.Component { } - componentDidMount() { this.parseData(); if(this.state.currentPopover !== undefined) { this.state.currentPopover.show(); } } - - _disableHover(ref_) { this.setState({hover: false, currentPopover: ref_, data: this.state.data }); } - + componentDidMount() { + this.parseData(); + if (this.state.currentPopover !== undefined) { + this.state.currentPopover.show(); + } + } + + _disableHover(ref_) { + this.setState({hover: false, currentPopover: ref_, data: this.state.data}); + } + _onMouseMove(e) { - + let self = this; - + let hidden = 'none'; let html = ''; let bcolor = '#DEDEDE'; - - if(this.state.currentPopover !== undefined) { this.state.currentPopover.show(); } + + if (this.state.currentPopover !== undefined) { + this.state.currentPopover.show(); + } document.querySelectorAll('circle, path').forEach((d_, i_) => { - d_.setAttribute('opacity', "0.8"); + d_.setAttribute('opacity', "0.8"); }); if (e.target.id.includes('Node')) { - e.target.setAttribute('opacity', 0.95); + e.target.setAttribute('opacity', 0.95); + + // Set highest z-index + e.target.parentNode.parentNode.appendChild(e.target.parentNode); - // Set highest z-index - e.target.parentNode.parentNode.appendChild(e.target.parentNode); - } else { - // Return z indices to default - Object.keys(this.layout).forEach(function (d_, i_) { - document.querySelector('#' + self.prefix).appendChild(document.querySelector('#' + self.prefix + 'Node_' + i_).parentNode); }) + // Return z indices to default + Object.keys(this.layout).forEach(function (d_, i_) { + document.querySelector('#' + self.prefix).appendChild(document.querySelector('#' + self.prefix + 'Node_' + i_).parentNode); + }) } } - + _onClick(e) { - - if (!e.target.id.includes('Node')) { - - this.state.currentPopover.hide(); - this.setState({hover: true, currentPopover: undefined, data: this.state.data }); - } + + if (!e.target.id.includes('Node')) { + + this.state.currentPopover.hide(); + this.setState({hover: true, currentPopover: undefined, data: this.state.data}); + } } - + parseData() { - + let self = this; let data = []; const omit = (prop, {[prop]: _, ...rest}) => rest; @@ -157,23 +199,25 @@ class VennDiagram extends React.Component { this.setState({hover: true, activePopover: undefined, data: data}); this.render(); } - + buildTooltipHtmlContent(object_) { - return Object.keys(object_).map((key_, i_) => { return (

{key_}: {object_[key_]}

) }) + return Object.keys(object_).map((key_, i_) => { + return (

{key_}: {object_[key_]}

) + }) } setLayoutElement(rule_, key_, html_, d_) { - - if(rule_ === null) { console.log(Error('The node scores are invalid, please check the data or the rules set.')); } + + if (rule_ === null) { + console.log(Error('The node scores are invalid, please check the data or the rules set.')); + } if (key_ === 'Data') { this.layout[key_].fontStyle = this.fontStyles[0]; - } - else if(this.layout[key_].hasOwnProperty('cx')){ + } else if (this.layout[key_].hasOwnProperty('cx')) { this.layout[key_].fontStyle = this.fontStyles[1]; - } - else { + } else { this.layout[key_].fontStyle = this.fontStyles[2]; } @@ -218,11 +262,12 @@ class VennDiagram extends React.Component { }); return ( -
this.divElement = divElement} onMouseMove={this._onMouseMove.bind(this)} onClick={this._onClick.bind(this)}> - this.divElement = divElement} onMouseMove={this._onMouseMove.bind(this)} + onClick={this._onClick.bind(this)}> + {nodes} - +
) }