From 52207c15b80ef2bc88a1ebe5a0f4cc4770254a11 Mon Sep 17 00:00:00 2001 From: Mike Salvatore Date: Fri, 23 Jul 2021 06:56:46 -0400 Subject: [PATCH] UI: Add lateral movement section to ransomware report --- .../report-components/RansomwareReport.js | 47 +-------------- .../ransomware/LateralMovement.tsx | 60 +++++++++++++++++++ 2 files changed, 62 insertions(+), 45 deletions(-) create mode 100644 monkey/monkey_island/cc/ui/src/components/report-components/ransomware/LateralMovement.tsx 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 index 688d3cc67..dd0cc2f53 100644 --- a/monkey/monkey_island/cc/ui/src/components/report-components/RansomwareReport.js +++ b/monkey/monkey_island/cc/ui/src/components/report-components/RansomwareReport.js @@ -2,8 +2,8 @@ import React from 'react'; import ReportHeader, {ReportTypes} from './common/ReportHeader'; import ReportLoader from './common/ReportLoader'; -import pluralize from 'pluralize' import FileEncryptionTable from './ransomware/FileEncryptionTable'; +import LateralMovement from './ransomware/LateralMovement'; import '../../styles/pages/report/RansomwareReport.scss'; @@ -16,55 +16,12 @@ class RansomwareReport extends React.Component { generateReportContent() { return (
- {this.getExploitationStats()} +
) } - getExploitationStats() { - return ( -
-

- Propagation -

- {this.getScannedVsExploitedStats()} - {this.getExploitationStatsPerExploit()} -
- ) - } - - getScannedVsExploitedStats() { - let num_scanned = this.props.report.propagation_stats.num_scanned_nodes; - let num_exploited = this.props.report.propagation_stats.num_exploited_nodes; - - return( -

- The Monkey discovered {num_scanned} machines - and successfully breached {num_exploited} of them. -

- ) - } - - getExploitationStatsPerExploit() { - 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]; - exploitation_details.push( -
- {count}  - {pluralize('machine', count)} {pluralize('was', count)} exploited by the  - {exploit}. -
- ); - } - - return exploitation_details; - } - render() { let content = {}; if (this.stillLoadingDataFromServer()) { diff --git a/monkey/monkey_island/cc/ui/src/components/report-components/ransomware/LateralMovement.tsx b/monkey/monkey_island/cc/ui/src/components/report-components/ransomware/LateralMovement.tsx new file mode 100644 index 000000000..c5a9f9f1e --- /dev/null +++ b/monkey/monkey_island/cc/ui/src/components/report-components/ransomware/LateralMovement.tsx @@ -0,0 +1,60 @@ +import React, {ReactElement} from 'react'; +import NumberedReportSection from './NumberedReportSection'; +import pluralize from 'pluralize' + +const LATERAL_MOVEMENT_DESCRIPTION = 'After the initial breach, the attacker will begin the Lateral \ + Movement phase of the attack. They will employ various \ + techniques in order to compromise other systems in your \ + network and encrypt as many files as possible.' + +type PropagationStats = { + num_scanned_nodes: number, + num_exploited_nodes: number, + num_exploited_per_exploit: Array, +} + +function LateralMovement({propagationStats}: {propagationStats: PropagationStats}): ReactElement { + let body = ( + <> + {getScannedVsExploitedStats(propagationStats.num_scanned_nodes, propagationStats.num_exploited_nodes)} + {getExploitationStatsPerExploit(propagationStats.num_exploited_per_exploit)} + + ) + + return ( + + ); +} + +function getScannedVsExploitedStats(num_scanned_nodes: number, num_exploited_nodes: number): ReactElement { + return( +

+ The Monkey discovered {num_scanned_nodes} machines + and successfully breached {num_exploited_nodes} of them. +

+ ); +} + +function getExploitationStatsPerExploit(num_exploited_per_exploit: Array): Array { + let exploitation_details = []; + + for (let exploit in num_exploited_per_exploit) { + let count = num_exploited_per_exploit[exploit]; + exploitation_details.push( +
+ {count}  + {pluralize('machine', count)} {pluralize('was', count)} exploited by the  + {exploit}. +
+ ); + } + + return exploitation_details; +} + +export default LateralMovement;