From ec15561bcb9147c261aa50bf93f8dd2dc2dd5a96 Mon Sep 17 00:00:00 2001 From: Shay Nehmad Date: Mon, 5 Aug 2019 16:16:53 +0300 Subject: [PATCH] Changes JSON to say if tests are conclusive --- .../cc/resources/reporting/report.py | 2 ++ .../zerotrust/ZeroTrustReportFindingsTable.js | 1 - .../zerotrust/ZeroTrustReportPillarGrades.js | 16 ++++++++++++---- 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/monkey/monkey_island/cc/resources/reporting/report.py b/monkey/monkey_island/cc/resources/reporting/report.py index 9c6cf88da..1b2895f8f 100644 --- a/monkey/monkey_island/cc/resources/reporting/report.py +++ b/monkey/monkey_island/cc/resources/reporting/report.py @@ -25,6 +25,7 @@ class Report(flask_restful.Resource): "findings": [ { "test": "Monkey 8 found a machine with no AV software active.", + "conclusive": False, "pillars": ["Devices"], "events": [ { @@ -37,6 +38,7 @@ class Report(flask_restful.Resource): }, { "test": "Monkey 6 successfully exploited machine XXX with shellshock.", + "conclusive": True, "pillars": ["Devices", "Networks"], "events": [ { diff --git a/monkey/monkey_island/cc/ui/src/components/report-components/zerotrust/ZeroTrustReportFindingsTable.js b/monkey/monkey_island/cc/ui/src/components/report-components/zerotrust/ZeroTrustReportFindingsTable.js index aa93a8d41..040bac420 100644 --- a/monkey/monkey_island/cc/ui/src/components/report-components/zerotrust/ZeroTrustReportFindingsTable.js +++ b/monkey/monkey_island/cc/ui/src/components/report-components/zerotrust/ZeroTrustReportFindingsTable.js @@ -1,6 +1,5 @@ import React, {Component} from "react"; import ReactTable from "react-table"; -import ZeroTrustPillars from "./ZeroTrustPillars"; class PillarLabel extends Component { render() { 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 index e8638d6b1..9a551e0a2 100644 --- 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 @@ -1,20 +1,28 @@ import React, {Component} from "react"; import ZeroTrustPillars from "./ZeroTrustPillars"; +import ZeroTrustReportFindingsTable from "./ZeroTrustReportFindingsTable"; export class ZeroTrustReportPillarGrades extends Component { render() { let pillarsCounters = {}; - for(const pillar in ZeroTrustPillars){ - pillarsCounters[ZeroTrustPillars[pillar]] = 0; + for(const pillar in ZeroTrustPillars) { + pillarsCounters[ZeroTrustPillars[pillar]] = { + "conclusive": 0, + "possible": 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")) { + if (finding.hasOwnProperty("pillars") && finding.hasOwnProperty("conclusive")) { for (const pillar of finding["pillars"]) { - pillarsCounters[pillar] = pillarsCounters[pillar] + 1; + if (finding.conclusive) { + pillarsCounters[pillar]["conclusive"] += 1; + } else { + pillarsCounters[pillar]["possible"] += 1; + } } } }