From 9fdbcc441db7f711173e2752307fc37f77cc6525 Mon Sep 17 00:00:00 2001 From: Ilija Lazoroski Date: Thu, 21 Jul 2022 10:53:08 +0200 Subject: [PATCH] UI: Check if any of the credentials are not null --- .../report-components/credentialParsing.js | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 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 ea95a88d8..c1eb57198 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 @@ -8,7 +8,10 @@ export function getAllUsernames(stolen, configured){ export function getCredentialsUsernames(credentials) { let usernames = []; for(let i = 0; i < credentials.length; i++){ - usernames.push(credentials[i]['identity']['username']); + let username = credentials[i]['identity']; + if(username !== null) { + usernames.push(username['username']); + } } return usernames; } @@ -16,10 +19,16 @@ export function getCredentialsUsernames(credentials) { export function getAllSecrets(stolen, configured){ let secrets = []; for(let i = 0; i < stolen.length; i++){ - secrets.push(getSecretsFromCredential(stolen[i]['secret'])); + let secret = stolen[i]['secret']; + if(secret !== null){ + secrets.push(getSecretsFromCredential(secret)); + } } for(let i = 0; i < configured.length; i++){ - secrets.push(getSecretsFromCredential(configured[i]['secret'])); + let secret = configured[i]['secret']; + if(secret !== null){ + secrets.push(getSecretsFromCredential(secret)); + } } return secrets; }