Consider non-threat issues when calculating threat count

This commit is contained in:
Shreya 2021-03-02 14:41:16 +05:30
parent 6babcd099a
commit 5f66a99f30
1 changed files with 21 additions and 3 deletions

View File

@ -46,6 +46,8 @@ class ReportPageComponent extends AuthComponent {
ZEROLOGON_PASSWORD_RESTORE_FAILED: 16
};
NotThreats = [this.Issue.ZEROLOGON_PASSWORD_RESTORE_FAILED];
Warning =
{
CROSS_SEGMENT: 0,
@ -253,9 +255,8 @@ class ReportPageComponent extends AuthComponent {
<div>
During this simulated attack the Monkey uncovered <span
className='badge badge-warning'>
{this.state.report.overview.issues.filter(function (x) {
return x === true;
}).length} threats</span>:
{this.getThreatCount()}
</span>:
<ul>
{this.state.report.overview.issues[this.Issue.STOLEN_SSH_KEYS] &&
<li>Stolen SSH keys are used to exploit other machines.</li>}
@ -415,6 +416,23 @@ class ReportPageComponent extends AuthComponent {
);
}
getThreatCount() {
let threatCount = this.state.report.overview.issues.filter(function (x) {
return x === true;
}).length
this.NotThreats.forEach(x => {
if (this.state.report.overview.issues[x] === true) {
threatCount -= 1;
}
});
if (threatCount === 1)
return "1 threat"
else
return threatCount + " threats"
}
generateZerologonOverview() {
let zerologonOverview = [];
if (this.state.report.overview.issues[this.Issue.ZEROLOGON]) {