From c8b4089bd2a11b158059f3601195a5c67da7355d Mon Sep 17 00:00:00 2001 From: Mike Salvatore Date: Mon, 1 Feb 2021 17:06:11 -0500 Subject: [PATCH] ui: display cross-segment issues as "pinged" if no services/ports Issue #819 --- .../report-components/SecurityReport.js | 70 ++++++++++++++----- 1 file changed, 52 insertions(+), 18 deletions(-) diff --git a/monkey/monkey_island/cc/ui/src/components/report-components/SecurityReport.js b/monkey/monkey_island/cc/ui/src/components/report-components/SecurityReport.js index 63749ced1..9a4e2120a 100644 --- a/monkey/monkey_island/cc/ui/src/components/report-components/SecurityReport.js +++ b/monkey/monkey_island/cc/ui/src/components/report-components/SecurityReport.js @@ -452,24 +452,58 @@ class ReportPageComponent extends AuthComponent { generateCrossSegmentIssue(crossSegmentIssue) { let crossSegmentIssueOverview = 'Communication possible from ' + crossSegmentIssue['source_subnet'] + ' to ' + crossSegmentIssue['target_subnet'] - return
  • - {crossSegmentIssueOverview} - -
      - {crossSegmentIssue['issues'].map(x => - x['is_self'] ? -
    • - {'Machine ' + x['hostname'] + ' has both ips: ' + x['source'] + ' and ' + x['target']} -
    • - : -
    • - {'IP ' + x['source'] + ' (' + x['hostname'] + ') connected to IP ' + x['target'] - + ' using the services: ' + Object.keys(x['services']).join(', ')} -
    • - )} -
    -
    -
  • ; + + return ( +
  • + {crossSegmentIssueOverview} + +
      + {crossSegmentIssue['issues'].map(issue => this.generateCrossSegmentIssueListItem(issue))} +
    +
    +
  • + ); + } + + generateCrossSegmentIssueListItem(issue) { + if (issue['is_self']) { + return this.generateCrossSegmentSingleHostMessage(issue); + } + + return this.generateCrossSegmentMultiHostMessage(issue); + } + + generateCrossSegmentSingleHostMessage(issue) { + return ( +
  • + {'Machine ' + issue['hostname'] + ' has both ips: ' + issue['source'] + ' and ' + issue['target']} +
  • + ); + } + + generateCrossSegmentMultiHostMessage(issue) { + return ( +
  • + { + Object.keys(issue['services']).length > 0 ? + this.generateCrossSegmentServiceMessage(issue) : + this.generateCrossSegmentPingMessage(issue) + } +
  • + ); + } + + generateCrossSegmentServiceMessage(issue) { + return ( + 'IP ' + issue['source'] + ' (' + issue['hostname'] + ') connected to IP ' + issue['target'] + + ' using the services: ' + Object.keys(issue['services']).join(', ') + ); + } + + generateCrossSegmentPingMessage(issue) { + return ( + `IP ${issue['source']} (${issue['hostname']}) successfully pinged IP ${issue['target']}` + ); } generateShellshockPathListBadges(paths) {