forked from p15670423/monkey
Merge pull request #1291 from guardicore/ransomware-reporting-tab
Add ransomware report tab
This commit is contained in:
commit
999399ae2d
|
@ -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}
|
||||||
|
|
|
@ -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 SecurityReport from '../report-components/SecurityReport';
|
||||||
import ZeroTrustReport from '../report-components/ZeroTrustReport'
|
import ZeroTrustReport from '../report-components/ZeroTrustReport';
|
||||||
|
import RansomwareReport from '../report-components/RansomwareReport';
|
||||||
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,11 +15,12 @@ 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),
|
||||||
|
@ -56,6 +58,18 @@ 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
|
||||||
|
// });
|
||||||
|
// });
|
||||||
|
if (this.shouldShowRansomwareReport(this.state.ransomwareReport)) {
|
||||||
|
this.state.sections.push({key: 'ransomware', title: 'Ransomware report'})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -84,6 +98,12 @@ class ReportPageComponent extends AuthComponent {
|
||||||
return ztReport
|
return ztReport
|
||||||
};
|
};
|
||||||
|
|
||||||
|
shouldShowRansomwareReport(report) { // TODO: Add proper check
|
||||||
|
if (report) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
componentWillUnmount() {
|
componentWillUnmount() {
|
||||||
clearInterval(this.state.ztReportRefreshInterval);
|
clearInterval(this.state.ztReportRefreshInterval);
|
||||||
}
|
}
|
||||||
|
@ -144,6 +164,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}/>);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,37 @@
|
||||||
|
import React from 'react';
|
||||||
|
|
||||||
|
import ReportHeader, {ReportTypes} from './common/ReportHeader';
|
||||||
|
import ReportLoader from './common/ReportLoader';
|
||||||
|
|
||||||
|
class RansomwareReport extends React.Component {
|
||||||
|
stillLoadingDataFromServer() {
|
||||||
|
return Object.keys(this.props.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;
|
|
@ -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: ''
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue