Changes JSON to say if tests are conclusive

This commit is contained in:
Shay Nehmad 2019-08-05 16:16:53 +03:00
parent 1b958ed300
commit ec15561bcb
3 changed files with 14 additions and 5 deletions

View File

@ -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": [
{

View File

@ -1,6 +1,5 @@
import React, {Component} from "react";
import ReactTable from "react-table";
import ZeroTrustPillars from "./ZeroTrustPillars";
class PillarLabel extends Component {
render() {

View File

@ -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;
}
}
}
}