cc: Add ransomware report tab

This commit is contained in:
Shreya 2021-07-02 13:53:45 +05:30
parent f698c889e3
commit 46ac53c5d1
4 changed files with 69 additions and 5 deletions

View File

@ -171,6 +171,9 @@ class AppComponent extends AuthComponent {
{this.renderRoute('/report/zeroTrust', {this.renderRoute('/report/zeroTrust',
<StandardLayoutComponent component={ReportPage} <StandardLayoutComponent component={ReportPage}
completedSteps={this.state.completedSteps}/>)} completedSteps={this.state.completedSteps}/>)}
{this.renderRoute('/report/ransomware',
<StandardLayoutComponent component={ReportPage}
completedSteps={this.state.completedSteps}/>)}
{this.renderRoute('/license', {this.renderRoute('/license',
<StandardLayoutComponent component={LicensePage} <StandardLayoutComponent component={LicensePage}
onStatusChange={this.updateStatus} onStatusChange={this.updateStatus}

View File

@ -3,9 +3,10 @@ import {Route} from 'react-router-dom';
import {Col, Nav} from 'react-bootstrap'; import {Col, Nav} from 'react-bootstrap';
import AuthComponent from '../AuthComponent'; import AuthComponent from '../AuthComponent';
import MustRunMonkeyWarning from '../report-components/common/MustRunMonkeyWarning'; import MustRunMonkeyWarning from '../report-components/common/MustRunMonkeyWarning';
import AttackReport from '../report-components/AttackReport' import AttackReport from '../report-components/AttackReport';
import SecurityReport from '../report-components/SecurityReport' import RansomwareReport from '../report-components/RansomwareReport';
import ZeroTrustReport from '../report-components/ZeroTrustReport' import SecurityReport from '../report-components/SecurityReport';
import ZeroTrustReport from '../report-components/ZeroTrustReport';
import {extractExecutionStatusFromServerResponse} from '../report-components/common/ExecutionStatus'; import {extractExecutionStatusFromServerResponse} from '../report-components/common/ExecutionStatus';
import MonkeysStillAliveWarning from '../report-components/common/MonkeysStillAliveWarning'; import MonkeysStillAliveWarning from '../report-components/common/MonkeysStillAliveWarning';
@ -14,17 +15,19 @@ class ReportPageComponent extends AuthComponent {
constructor(props) { constructor(props) {
super(props); super(props);
this.sectionsOrder = ['security', 'zeroTrust', 'attack']; this.sectionsOrder = ['security', 'zeroTrust', 'attack', 'ransomware'];
this.state = { this.state = {
securityReport: {}, securityReport: {},
attackReport: {}, attackReport: {},
zeroTrustReport: {}, zeroTrustReport: {},
ransomwareReport: {},
allMonkeysAreDead: false, allMonkeysAreDead: false,
runStarted: true, runStarted: true,
selectedSection: ReportPageComponent.selectReport(this.sectionsOrder), selectedSection: ReportPageComponent.selectReport(this.sectionsOrder),
sections: [{key: 'security', title: 'Security report'}, sections: [{key: 'security', title: 'Security report'},
{key: 'zeroTrust', title: 'Zero trust report'}, {key: 'zeroTrust', title: 'Zero trust report'},
{key: 'attack', title: 'ATT&CK report'}] {key: 'attack', title: 'ATT&CK report'},
{key: 'ransomware', title: 'Ransomware report'}]
}; };
} }
@ -56,6 +59,16 @@ class ReportPageComponent extends AuthComponent {
this.getZeroTrustReportFromServer().then((ztReport) => { this.getZeroTrustReportFromServer().then((ztReport) => {
this.setState({zeroTrustReport: ztReport}) 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 (<AttackReport report={this.state.attackReport}/>); return (<AttackReport report={this.state.attackReport}/>);
case 'zeroTrust': case 'zeroTrust':
return (<ZeroTrustReport report={this.state.zeroTrustReport}/>); return (<ZeroTrustReport report={this.state.zeroTrustReport}/>);
case 'ransomware':
return (<RansomwareReport report={this.state.ransomwareReport}/>);
} }
} }

View File

@ -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 (
<div>
<p>
This report shows information about the ransomware simulation run by Infection Monkey.
</p>
</div>
)
}
render() {
let content = {};
if (this.stillLoadingDataFromServer()) {
content = <ReportLoader loading={true}/>;
} else {
content = <div> {this.generateReportContent()}</div>;
}
return (
<div className='report-page'>
<ReportHeader report_type={ReportTypes.ransomware}/>
<hr/>
{content}
</div>)
}
}
export default RansomwareReport;

View File

@ -8,6 +8,7 @@ export const ReportTypes = {
zeroTrust: 'Zero Trust', zeroTrust: 'Zero Trust',
security: 'Security', security: 'Security',
attack: 'ATT&CK', attack: 'ATT&CK',
ransomware: 'Ransomware',
null: '' null: ''
}; };