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_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"
}
]
},
]

View File

@ -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 = <div>
<h2>Pillars Overview</h2>
<PillarGrades pillars={this.state.pillars} />
<h2>Test Status</h2>
TODO
<h2>Recommendations Status</h2>
<RecommendationsStatusTable recommendationsStatus={this.state.recommendations} />
<h2>Findings</h2>
<FindingsTable findings={this.state.findings} />
</div>;
@ -67,8 +68,8 @@ class ZeroTrustReportPageComponent extends AuthComponent {
PILLARS:
<pre>{JSON.stringify(this.state.pillars, undefined, 2)}</pre>
<br/>
TESTS:
<pre>{JSON.stringify(this.state.tests, undefined, 2)}</pre>
recommendations:
<pre>{JSON.stringify(this.state.recommendations, undefined, 2)}</pre>
<br/>
FINDINGS:
<pre>{JSON.stringify(this.state.findings, undefined, 2)}</pre>
@ -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')

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;