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 flask import jsonify
from monkey_island.cc.resources.auth.auth import jwt_required 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 from monkey_island.cc.services.ransomware import ransomware_report
class RansomwareReport(flask_restful.Resource): class RansomwareReport(flask_restful.Resource):
@jwt_required @jwt_required
def get(self): def get(self):
return jsonify( encrypted_files_table = RansomwareReportService.get_encrypted_files_table()
{"report": None, "propagation_stats": ransomware_report.get_propagation_stats()} 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.getZeroTrustReportFromServer().then((ztReport) => {
this.setState({zeroTrustReport: ztReport}) this.setState({zeroTrustReport: ztReport})
}); });
this.setState({ this.authFetch('/api/report/ransomware')
ransomwareReport: {'report': ''}}) .then(res => res.json())
// this.authFetch('/api/report/ransomware') .then(res => {
// .then(res => res.json()) this.setState({
// .then(res => { ransomwareReport: res
// this.setState({ });
// ransomwareReport: res });
// });
// });
if (this.shouldShowRansomwareReport(this.state.ransomwareReport)) { if (this.shouldShowRansomwareReport(this.state.ransomwareReport)) {
this.state.sections.push({key: 'ransomware', title: 'Ransomware report'}) this.state.sections.push({key: 'ransomware', title: 'Ransomware report'})
} }