Add a service responsible for fetching and formatting data for ransomware report, file encryption table

This commit is contained in:
VakarisZ 2021-07-08 13:44:05 +03:00
parent 3b80221c38
commit f6eda771b2
2 changed files with 11 additions and 11 deletions

View File

@ -2,12 +2,14 @@ import flask_restful
from flask import jsonify
from monkey_island.cc.resources.auth.auth import jwt_required
from monkey_island.cc.services.ransomware.ransomware_report import RansomwareReportService
from monkey_island.cc.services.ransomware import ransomware_report
class RansomwareReport(flask_restful.Resource):
@jwt_required
def get(self):
return jsonify(
{"report": None, "propagation_stats": ransomware_report.get_propagation_stats()}
encrypted_files_table = RansomwareReportService.get_encrypted_files_table()
return jsonify({"encrypted_files_table": encrypted_files_table,
"propagation_stats": ransomware_report.get_propagation_stats()}
)

View File

@ -58,15 +58,13 @@ class ReportPageComponent extends AuthComponent {
this.getZeroTrustReportFromServer().then((ztReport) => {
this.setState({zeroTrustReport: ztReport})
});
this.setState({
ransomwareReport: {'report': ''}})
// this.authFetch('/api/report/ransomware')
// .then(res => res.json())
// .then(res => {
// this.setState({
// ransomwareReport: res
// });
// });
this.authFetch('/api/report/ransomware')
.then(res => res.json())
.then(res => {
this.setState({
ransomwareReport: res
});
});
if (this.shouldShowRansomwareReport(this.state.ransomwareReport)) {
this.state.sections.push({key: 'ransomware', title: 'Ransomware report'})
}