cc: Show exploitation stats on ransomware report page

This commit is contained in:
Shreya 2021-07-12 16:41:20 +05:30 committed by Mike Salvatore
parent c7d655ac7d
commit 3b7d35868a
1 changed files with 40 additions and 1 deletions

View File

@ -14,17 +14,56 @@ class RansomwareReport extends React.Component {
<p>
This report shows information about the ransomware simulation run by Infection Monkey.
</p>
{this.getExploitationStats()}
</div>
)
}
getExploitationStats() {
let num_scanned = this.props.report.propagation_stats.num_scanned_nodes;
let num_exploited = this.props.report.propagation_stats.num_exploited_nodes;
let exploit_counts = this.props.report.propagation_stats.num_exploited_per_exploit;
let exploitation_details = [];
for (let exploit in exploit_counts) {
let count = exploit_counts[exploit];
if (count === 1) {
exploitation_details.push(
<div>
<span className='badge badge-danger'>{count}</span> machine was exploited by
the <span className='badge badge-danger'>{exploit}</span>.
</div>
)
}
else {
exploitation_details.push(
<div>
<span className='badge badge-danger'>{count}</span> machines were exploited by
the <span className='badge badge-danger'>{exploit}</span>.
</div>
)
}
}
return (
<div>
<p>
The Monkey discovered <span className='badge badge-warning'>{num_scanned}</span> machines
and successfully breached <span className='badge badge-danger'>{num_exploited}</span> of them.
</p>
{exploitation_details}
</div>
)
}
render() {
let content = {};
if (this.stillLoadingDataFromServer()) {
content = <ReportLoader loading={true}/>;
} else {
content = <div> {this.generateReportContent()}</div>;
content = this.generateReportContent();
}
return (
<div className='report-page'>
<ReportHeader report_type={ReportTypes.ransomware}/>