From a284467a1a98e3353fac7757e6c97b2588ab28ea Mon Sep 17 00:00:00 2001 From: VakarisZ Date: Wed, 31 Mar 2021 11:55:22 +0300 Subject: [PATCH] Improved UI by creating distinct functions related to immediate threats report component --- .../report-components/SecurityReport.js | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) 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 815be49a6..9ac409e8e 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 @@ -435,6 +435,13 @@ class ReportPageComponent extends AuthComponent { return overviews; } + isIssuePotentialSecurityIssue(issueName) { + let issueDescriptor = this.IssueDescriptorEnum[issueName]; + return issueDescriptor.hasOwnProperty(this.issueContentTypes.TYPE) && + issueDescriptor[this.issueContentTypes.TYPE] === this.issueTypes.WARNING && + issueDescriptor.hasOwnProperty(this.issueContentTypes.OVERVIEW); + } + getImmediateThreats() { let threatCount = this.getImmediateThreatCount() return ( @@ -467,6 +474,32 @@ class ReportPageComponent extends AuthComponent { return threatCount; } + isIssueImmediateThreat(issueName) { + let issueDescriptor = this.IssueDescriptorEnum[issueName]; + return issueDescriptor.hasOwnProperty(this.issueContentTypes.TYPE) && + issueDescriptor[this.issueContentTypes.TYPE] === this.issueTypes.DANGER && + issueDescriptor.hasOwnProperty(this.issueContentTypes.OVERVIEW); + } + + getImmediateThreatsOverviews() { + let overviews = []; + let issues = this.state.report.overview.issues; + + for(let i=0; i < issues.length; i++) { + if (this.isIssueImmediateThreat(issues[i])) { + if (issues[i] === 'ZerologonExploiter' && issues.includes('zerologon_pass_restore_failed')){ + overviews.push(this.getIssueOverview(this.IssueDescriptorEnum['zerologon_pass_restore_failed'])); + } else { + overviews.push(this.getIssueOverview(this.IssueDescriptorEnum[issues[i]])); + } + } + } + return overviews; + } + + getIssueOverview(issueDescriptor) { + return issueDescriptor[this.issueContentTypes.OVERVIEW](); + } generateReportRecommendationsSection() { return (