diff --git a/monkey/monkey_island/cc/resources/reporting/report.py b/monkey/monkey_island/cc/resources/reporting/report.py index b9e16427d..5c9ff314a 100644 --- a/monkey/monkey_island/cc/resources/reporting/report.py +++ b/monkey/monkey_island/cc/resources/reporting/report.py @@ -12,7 +12,7 @@ REPORT_TYPES = [GENERAL_REPORT_TYPE, ZERO_TRUST_REPORT_TYPE] REPORT_DATA_PILLARS = "pillars" REPORT_DATA_FINDINGS = "findings" -REPORT_DATA_TEST_STATUS = "tests" +REPORT_DATA_RECOMMENDATION_STATUS = "recommendations" __author__ = ["itay.mizeretz", "shay.nehmad"] @@ -28,8 +28,8 @@ class Report(flask_restful.Resource): return jsonify(get_all_findings()) elif report_data == REPORT_DATA_PILLARS: return jsonify(get_pillars_grades()) - elif report_data == REPORT_DATA_TEST_STATUS: - return jsonify(get_tests_status()) + elif report_data == REPORT_DATA_RECOMMENDATION_STATUS: + return jsonify(get_recommendations_status()) flask_restful.abort(httplib.NOT_FOUND) @@ -68,18 +68,59 @@ def get_all_findings(): ] -def get_tests_status(): +def get_recommendations_status(): return [ { - "Test": "Segmentation", - "Conclusive": 6, - "Inconclusive": 6, - "Positive": 6, - "Unexecuted": False # There were results meaning the test was executed. + "Recommendation": "Do network segmentation.", + "Status": "Positive", + "Tests": [ + { + "Test": "Test B for segmentation", + "Status": "Positive" + }, + { + "Test": "Test A for segmentation", + "Status": "Positive" + }, + ] }, { - "Exploit": "network", - "Unexecuted": True # There were no results since the test wasn't executed. + "Recommendation": "Install AV software.", + "Status": "Unexecuted", + "Tests": [ + { + "Test": "Search for active AV software processes", + "Status": "Unexecuted" + } + ] + }, + { + "Recommendation": "Analyze malicious network traffic.", + "Status": "Inconclusive", + "Tests": [ + { + "Test": "Use exploits.", + "Status": "Inconclusive" + }, + { + "Test": "Bruteforce passwords.", + "Status": "Inconclusive" + } + ] + }, + { + "Recommendation": "Data at trasnit should be...", + "Status": "Conclusive", + "Tests": [ + { + "Test": "Scan HTTP.", + "Status": "Conclusive" + }, + { + "Test": "Scan elastic.", + "Status": "Unexecuted" + } + ] }, ] 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 c81509a8a..dc0730102 100644 --- a/monkey/monkey_island/cc/ui/src/components/pages/ZeroTrustReportPage.js +++ b/monkey/monkey_island/cc/ui/src/components/pages/ZeroTrustReportPage.js @@ -4,6 +4,7 @@ import AuthComponent from '../AuthComponent'; import ReportHeader, { ReportTypes } from "../report-components/common/ReportHeader"; import PillarGrades from "../report-components/zerotrust/PillarGrades"; import FindingsTable from "../report-components/zerotrust/FindingsTable"; +import RecommendationsStatusTable from "../report-components/zerotrust/RecommendationsStatus"; class ZeroTrustReportPageComponent extends AuthComponent { @@ -42,8 +43,8 @@ class ZeroTrustReportPageComponent extends AuthComponent { content =

Pillars Overview

-

Test Status

- TODO +

Recommendations Status

+

Findings

; @@ -67,8 +68,8 @@ class ZeroTrustReportPageComponent extends AuthComponent { PILLARS:
{JSON.stringify(this.state.pillars, undefined, 2)}

- TESTS: -
{JSON.stringify(this.state.tests, undefined, 2)}
+ recommendations: +
{JSON.stringify(this.state.recommendations, undefined, 2)}

FINDINGS:
{JSON.stringify(this.state.findings, undefined, 2)}
@@ -78,7 +79,7 @@ class ZeroTrustReportPageComponent extends AuthComponent { } stillLoadingDataFromServer() { - return typeof this.state.findings === "undefined" || typeof this.state.pillars === "undefined" || typeof this.state.tests === "undefined"; + return typeof this.state.findings === "undefined" || typeof this.state.pillars === "undefined" || typeof this.state.recommendations === "undefined"; } print() { @@ -94,11 +95,11 @@ class ZeroTrustReportPageComponent extends AuthComponent { findings: res }); }); - this.authFetch('/api/report/zero_trust/tests') + this.authFetch('/api/report/zero_trust/recommendations') .then(res => res.json()) .then(res => { this.setState({ - tests: res + recommendations: res }); }); this.authFetch('/api/report/zero_trust/pillars') diff --git a/monkey/monkey_island/cc/ui/src/components/report-components/zerotrust/RecommendationsStatus.js b/monkey/monkey_island/cc/ui/src/components/report-components/zerotrust/RecommendationsStatus.js new file mode 100644 index 000000000..b23f84d16 --- /dev/null +++ b/monkey/monkey_island/cc/ui/src/components/report-components/zerotrust/RecommendationsStatus.js @@ -0,0 +1,46 @@ +import React, {Component} from "react"; +import PagenatedTable from "../common/PagenatedTable"; + +const columns = [ + { + Header: 'Recommendations status', + columns: [ + { Header: 'Recommendation', accessor: 'Recommendation', + style: {'whiteSpace': 'unset'} // This enables word wrap + }, + { Header: 'Status', id: "Status", + accessor: x => { + const statusToIcon = { + "Positive": "fa-shield alert-success", + "Inconclusive": "fa-question alert-info", + "Conclusive": "fa-unlock-alt alert-danger", + "Unexecuted": "fa-toggle-off", + }; + return ; + } + }, + { Header: 'Tests', id:"Tests", + accessor: x => { + console.log(x.Tests); + return ; + } + } + ] + } +]; + +class TestsStatus extends Component { + render() { + return ( +
{JSON.stringify(this.props.tests,null,2)}
+ ); + } +} + +export class RecommendationsStatusTable extends Component { + render() { + return ; + } +} + +export default RecommendationsStatusTable;