From 7dba3c4fede9fdf3d02fd8a53dd5d699432a4071 Mon Sep 17 00:00:00 2001 From: vakaris_zilius Date: Fri, 2 Sep 2022 12:46:11 +0000 Subject: [PATCH] UI: Remove duplicate credentials from report --- .../report-components/credentialParsing.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/monkey/monkey_island/cc/ui/src/components/report-components/credentialParsing.js b/monkey/monkey_island/cc/ui/src/components/report-components/credentialParsing.js index 7dfe5e9a7..fa5660d4e 100644 --- a/monkey/monkey_island/cc/ui/src/components/report-components/credentialParsing.js +++ b/monkey/monkey_island/cc/ui/src/components/report-components/credentialParsing.js @@ -1,10 +1,10 @@ import {CredentialTypes, SecretTypes} from '../utils/CredentialTypes.js'; export function getAllUsernames(stolen, configured) { - let usernames = []; - usernames.push(...getCredentialsUsernames(stolen)); - usernames.push(...getCredentialsUsernames(configured)); - return usernames; + let usernames = new Set(); + usernames.add(...getCredentialsUsernames(stolen)); + usernames.add(...getCredentialsUsernames(configured)); + return Array.from(usernames); } export function getCredentialsUsernames(credentials) { @@ -19,20 +19,20 @@ export function getCredentialsUsernames(credentials) { } export function getAllSecrets(stolen, configured) { - let secrets = []; + let secrets = new Set(); for (let i = 0; i < stolen.length; i++) { let secret = stolen[i]['secret']; if (secret !== null) { - secrets.push(reformatSecret(secret)); + secrets.add(reformatSecret(secret)); } } for (let i = 0; i < configured.length; i++) { let secret = configured[i]['secret']; if (secret !== null) { - secrets.push(reformatSecret(secret)); + secrets.add(reformatSecret(secret)); } } - return secrets; + return Array.from(secrets); } function reformatSecret(secret) {