diff --git a/monkey/monkey_island/cc/ui/src/components/pages/ReportPage.js b/monkey/monkey_island/cc/ui/src/components/pages/ReportPage.js index b48d95a20..936171aad 100644 --- a/monkey/monkey_island/cc/ui/src/components/pages/ReportPage.js +++ b/monkey/monkey_island/cc/ui/src/components/pages/ReportPage.js @@ -12,9 +12,10 @@ import AuthComponent from '../AuthComponent'; import PassTheHashMapPageComponent from "./PassTheHashMapPage"; import StrongUsers from "components/report-components/StrongUsers"; import AttackReport from "components/report-components/AttackReport"; +import ReportHeader, { ReportTypes } from "../report-components/ReportHeader"; let guardicoreLogoImage = require('../../images/guardicore-logo.png'); -let monkeyLogoImage = require('../../images/monkey-icon.svg'); + class ReportPageComponent extends AuthComponent { @@ -130,13 +131,16 @@ class ReportPageComponent extends AuthComponent { generateReportContent() { return (
+ { + // extract to print component. + }
- {this.generateReportHeader()} +
{this.generateReportOverviewSection()} {this.generateReportFindingsSection()} @@ -154,26 +158,6 @@ class ReportPageComponent extends AuthComponent { ); } - generateReportHeader() { - return ( - - ); - } - generateReportOverviewSection() { return (
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 69aaf198d..35e348e15 100644 --- a/monkey/monkey_island/cc/ui/src/components/pages/ZeroTrustReportPage.js +++ b/monkey/monkey_island/cc/ui/src/components/pages/ZeroTrustReportPage.js @@ -1,41 +1,32 @@ import React from 'react'; import {Button, Col} from 'react-bootstrap'; -import BreachedServers from 'components/report-components/BreachedServers'; -import ScannedServers from 'components/report-components/ScannedServers'; -import PostBreach from 'components/report-components/PostBreach'; -import {ReactiveGraph} from 'components/reactive-graph/ReactiveGraph'; -import {edgeGroupToColor, options} from 'components/map/MapOptions'; -import StolenPasswords from 'components/report-components/StolenPasswords'; -import CollapsibleWellComponent from 'components/report-components/CollapsibleWell'; -import {Line} from 'rc-progress'; import AuthComponent from '../AuthComponent'; -import PassTheHashMapPageComponent from "./PassTheHashMapPage"; -import StrongUsers from "components/report-components/StrongUsers"; -import AttackReport from "components/report-components/AttackReport"; - -let guardicoreLogoImage = require('../../images/guardicore-logo.png'); -let monkeyLogoImage = require('../../images/monkey-icon.svg'); +import ReportHeader, { ReportTypes } from "../report-components/ReportHeader"; +import ZeroTrustReportPillarGrades from "../report-components/zerotrust/ZeroTrustReportPillarGrades"; class ZeroTrustReportPageComponent extends AuthComponent { constructor(props) { super(props); + this.state = { - report: {}, + report: { + findings: undefined + }, allMonkeysAreDead: false, - runStarted: true + runStarted: false }; } render() { - let content; let res; this.getZeroTrustReportFromServer(res); - content = JSON.stringify(this.state.report); + + const content = this.generateReportContent(); return ( -

4. Security Report

+

5. Zero Trust Report

{content}
@@ -43,17 +34,52 @@ class ZeroTrustReportPageComponent extends AuthComponent { ); } - // This dups the regular report - getZeroTrustReportFromServer(res) { - //if (res['completed_steps']['run_monkey']) { - this.authFetch('/api/report/zero_trust') - .then(res => res.json()) - .then(res => { - this.setState({ - report: res - }); + generateReportContent() { + let content; + + console.log(this.state.report.findings); + + if (typeof this.state.report.findings === "undefined") { + content = "Still empty"; + } else { + content =
+ +
; + } + + return ( +
+
+ +
+ +
+ +
+ {content} + THIS IS THE RAW SERVER DATA +
+            {JSON.stringify(this.state.report, undefined, 2)}
+          
+
+
+ ) + } + + print() { + alert("unimplemented"); + } + + getZeroTrustReportFromServer() { + this.authFetch('/api/report/zero_trust') + .then(res => res.json()) + .then(res => { + this.setState({ + report: res }); - //} + }); } } diff --git a/monkey/monkey_island/cc/ui/src/components/report-components/ReportHeader.js b/monkey/monkey_island/cc/ui/src/components/report-components/ReportHeader.js new file mode 100644 index 000000000..adccb7371 --- /dev/null +++ b/monkey/monkey_island/cc/ui/src/components/report-components/ReportHeader.js @@ -0,0 +1,40 @@ +import React, {Component} from "react"; +import {Col} from "react-bootstrap"; + +let monkeyLogoImage = require('../../images/monkey-icon.svg'); + +export const ReportTypes = { + zeroTrust: "Zero Trust", + security: "Security", + null: "" +}; + +export class ReportHeader extends Component { + report_type; + + render() { + return + } +} + +export default ReportHeader; diff --git a/monkey/monkey_island/cc/ui/src/components/report-components/zerotrust/ZeroTrustPillars.js b/monkey/monkey_island/cc/ui/src/components/report-components/zerotrust/ZeroTrustPillars.js new file mode 100644 index 000000000..bd8898205 --- /dev/null +++ b/monkey/monkey_island/cc/ui/src/components/report-components/zerotrust/ZeroTrustPillars.js @@ -0,0 +1,11 @@ +export const ZeroTrustPillars = { + data: "Data", + people: "People", + network: "Networks", + workload: "Workload", + devices: "Devices", + visibility: "Visibility & Analytics", + automation: "Automation & Orchestration" +}; + +export default ZeroTrustPillars; diff --git a/monkey/monkey_island/cc/ui/src/components/report-components/zerotrust/ZeroTrustReportPillarGrades.js b/monkey/monkey_island/cc/ui/src/components/report-components/zerotrust/ZeroTrustReportPillarGrades.js new file mode 100644 index 000000000..125151ea7 --- /dev/null +++ b/monkey/monkey_island/cc/ui/src/components/report-components/zerotrust/ZeroTrustReportPillarGrades.js @@ -0,0 +1,40 @@ +import React, {Component} from "react"; +import ZeroTrustPillars from "./ZeroTrustPillars"; + +export class ZeroTrustReportPillarGrades extends Component { + render() { + let pillarsCounters = {}; + for(const pillar in ZeroTrustPillars){ + pillarsCounters[ZeroTrustPillars[pillar]] = 0; + } + + if (this.props.findings !== null) { + for (const finding of this.props.findings) { + console.log("finding: " + JSON.stringify(finding)); + if (typeof finding === 'object' && finding !== null) { + if (finding.hasOwnProperty("pillars")) { + for (const pillar of finding["pillars"]) { + pillarsCounters[pillar] = pillarsCounters[pillar] + 1; + } + } + } + } + } + + return ( +
+

+ Pillars Overview +

+

+ TODO: table with conditional colouring. +

+
+          {JSON.stringify(pillarsCounters, undefined, 2)}
+        
+
+ ) + } +} + +export default ZeroTrustReportPillarGrades;