Added recommendation status table

This commit is contained in:
Shay Nehmad 2019-08-08 16:19:51 +03:00
parent 568257db26
commit e4738d026c
3 changed files with 106 additions and 18 deletions

View File

@ -12,7 +12,7 @@ REPORT_TYPES = [GENERAL_REPORT_TYPE, ZERO_TRUST_REPORT_TYPE]
REPORT_DATA_PILLARS = "pillars" REPORT_DATA_PILLARS = "pillars"
REPORT_DATA_FINDINGS = "findings" REPORT_DATA_FINDINGS = "findings"
REPORT_DATA_TEST_STATUS = "tests" REPORT_DATA_RECOMMENDATION_STATUS = "recommendations"
__author__ = ["itay.mizeretz", "shay.nehmad"] __author__ = ["itay.mizeretz", "shay.nehmad"]
@ -28,8 +28,8 @@ class Report(flask_restful.Resource):
return jsonify(get_all_findings()) return jsonify(get_all_findings())
elif report_data == REPORT_DATA_PILLARS: elif report_data == REPORT_DATA_PILLARS:
return jsonify(get_pillars_grades()) return jsonify(get_pillars_grades())
elif report_data == REPORT_DATA_TEST_STATUS: elif report_data == REPORT_DATA_RECOMMENDATION_STATUS:
return jsonify(get_tests_status()) return jsonify(get_recommendations_status())
flask_restful.abort(httplib.NOT_FOUND) flask_restful.abort(httplib.NOT_FOUND)
@ -68,18 +68,59 @@ def get_all_findings():
] ]
def get_tests_status(): def get_recommendations_status():
return [ return [
{ {
"Test": "Segmentation", "Recommendation": "Do network segmentation.",
"Conclusive": 6, "Status": "Positive",
"Inconclusive": 6, "Tests": [
"Positive": 6, {
"Unexecuted": False # There were results meaning the test was executed. "Test": "Test B for segmentation",
"Status": "Positive"
}, },
{ {
"Exploit": "network", "Test": "Test A for segmentation",
"Unexecuted": True # There were no results since the test wasn't executed. "Status": "Positive"
},
]
},
{
"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"
}
]
}, },
] ]

View File

@ -4,6 +4,7 @@ import AuthComponent from '../AuthComponent';
import ReportHeader, { ReportTypes } from "../report-components/common/ReportHeader"; import ReportHeader, { ReportTypes } from "../report-components/common/ReportHeader";
import PillarGrades from "../report-components/zerotrust/PillarGrades"; import PillarGrades from "../report-components/zerotrust/PillarGrades";
import FindingsTable from "../report-components/zerotrust/FindingsTable"; import FindingsTable from "../report-components/zerotrust/FindingsTable";
import RecommendationsStatusTable from "../report-components/zerotrust/RecommendationsStatus";
class ZeroTrustReportPageComponent extends AuthComponent { class ZeroTrustReportPageComponent extends AuthComponent {
@ -42,8 +43,8 @@ class ZeroTrustReportPageComponent extends AuthComponent {
content = <div> content = <div>
<h2>Pillars Overview</h2> <h2>Pillars Overview</h2>
<PillarGrades pillars={this.state.pillars} /> <PillarGrades pillars={this.state.pillars} />
<h2>Test Status</h2> <h2>Recommendations Status</h2>
TODO <RecommendationsStatusTable recommendationsStatus={this.state.recommendations} />
<h2>Findings</h2> <h2>Findings</h2>
<FindingsTable findings={this.state.findings} /> <FindingsTable findings={this.state.findings} />
</div>; </div>;
@ -67,8 +68,8 @@ class ZeroTrustReportPageComponent extends AuthComponent {
PILLARS: PILLARS:
<pre>{JSON.stringify(this.state.pillars, undefined, 2)}</pre> <pre>{JSON.stringify(this.state.pillars, undefined, 2)}</pre>
<br/> <br/>
TESTS: recommendations:
<pre>{JSON.stringify(this.state.tests, undefined, 2)}</pre> <pre>{JSON.stringify(this.state.recommendations, undefined, 2)}</pre>
<br/> <br/>
FINDINGS: FINDINGS:
<pre>{JSON.stringify(this.state.findings, undefined, 2)}</pre> <pre>{JSON.stringify(this.state.findings, undefined, 2)}</pre>
@ -78,7 +79,7 @@ class ZeroTrustReportPageComponent extends AuthComponent {
} }
stillLoadingDataFromServer() { 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() { print() {
@ -94,11 +95,11 @@ class ZeroTrustReportPageComponent extends AuthComponent {
findings: res findings: res
}); });
}); });
this.authFetch('/api/report/zero_trust/tests') this.authFetch('/api/report/zero_trust/recommendations')
.then(res => res.json()) .then(res => res.json())
.then(res => { .then(res => {
this.setState({ this.setState({
tests: res recommendations: res
}); });
}); });
this.authFetch('/api/report/zero_trust/pillars') this.authFetch('/api/report/zero_trust/pillars')

View File

@ -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 <i className={"fa " + statusToIcon[x.Status] + " fa-2x"} />;
}
},
{ Header: 'Tests', id:"Tests",
accessor: x => {
console.log(x.Tests);
return <TestsStatus tests={x.Tests} />;
}
}
]
}
];
class TestsStatus extends Component {
render() {
return (
<pre>{JSON.stringify(this.props.tests,null,2)}</pre>
);
}
}
export class RecommendationsStatusTable extends Component {
render() {
return <PagenatedTable data={this.props.recommendationsStatus} columns={columns} pageSize={5}/>;
}
}
export default RecommendationsStatusTable;