From 46ac53c5d1d931f6ea883e4677edf52a45a6ae9e Mon Sep 17 00:00:00 2001 From: Shreya Date: Fri, 2 Jul 2021 13:53:45 +0530 Subject: [PATCH] cc: Add ransomware report tab --- .../cc/ui/src/components/Main.js | 3 ++ .../cc/ui/src/components/pages/ReportPage.js | 25 ++++++++--- .../report-components/RansomwareReport.js | 45 +++++++++++++++++++ .../report-components/common/ReportHeader.js | 1 + 4 files changed, 69 insertions(+), 5 deletions(-) create mode 100644 monkey/monkey_island/cc/ui/src/components/report-components/RansomwareReport.js diff --git a/monkey/monkey_island/cc/ui/src/components/Main.js b/monkey/monkey_island/cc/ui/src/components/Main.js index 32480db8e..b5fc5f606 100644 --- a/monkey/monkey_island/cc/ui/src/components/Main.js +++ b/monkey/monkey_island/cc/ui/src/components/Main.js @@ -171,6 +171,9 @@ class AppComponent extends AuthComponent { {this.renderRoute('/report/zeroTrust', )} + {this.renderRoute('/report/ransomware', + )} {this.renderRoute('/license', { this.setState({zeroTrustReport: ztReport}) }); + this.setState({ + ransomwareReport: {'report': ''} + }); + // this.authFetch('/api/report/ransomware') + // .then(res => res.json()) + // .then(res => { + // this.setState({ + // ransomwareReport: res + // }); + // }); } } @@ -144,6 +157,8 @@ class ReportPageComponent extends AuthComponent { return (); case 'zeroTrust': return (); + case 'ransomware': + return (); } } diff --git a/monkey/monkey_island/cc/ui/src/components/report-components/RansomwareReport.js b/monkey/monkey_island/cc/ui/src/components/report-components/RansomwareReport.js new file mode 100644 index 000000000..31629fbf0 --- /dev/null +++ b/monkey/monkey_island/cc/ui/src/components/report-components/RansomwareReport.js @@ -0,0 +1,45 @@ +import React from 'react'; + +import ReportHeader, {ReportTypes} from './common/ReportHeader'; +import ReportLoader from './common/ReportLoader'; + +class RansomwareReport extends React.Component { + + constructor(props) { + super(props); + this.state = { + report: props.report + }; + } + + stillLoadingDataFromServer() { + return Object.keys(this.state.report).length === 0; + } + + generateReportContent() { + return ( +
+

+ This report shows information about the ransomware simulation run by Infection Monkey. +

+
+ ) + } + + render() { + let content = {}; + if (this.stillLoadingDataFromServer()) { + content = ; + } else { + content =
{this.generateReportContent()}
; + } + return ( +
+ +
+ {content} +
) + } +} + +export default RansomwareReport; diff --git a/monkey/monkey_island/cc/ui/src/components/report-components/common/ReportHeader.js b/monkey/monkey_island/cc/ui/src/components/report-components/common/ReportHeader.js index d942a53e2..6e7c25d2e 100644 --- a/monkey/monkey_island/cc/ui/src/components/report-components/common/ReportHeader.js +++ b/monkey/monkey_island/cc/ui/src/components/report-components/common/ReportHeader.js @@ -8,6 +8,7 @@ export const ReportTypes = { zeroTrust: 'Zero Trust', security: 'Security', attack: 'ATT&CK', + ransomware: 'Ransomware', null: '' };