UI: Improve the naming/handling of credential types in the UI

This commit is contained in:
vakaris_zilius 2022-09-06 12:56:06 +00:00
parent 9fb2804202
commit 792895a25c
5 changed files with 18 additions and 14 deletions

View File

@ -1,5 +1,5 @@
import {defaultCredentials} from '../../services/configuration/propagation/credentials';
import {CredentialTypes, SecretTypes} from '../utils/CredentialTypes.js';
import {PlaintextTypes, SecretTypes} from '../utils/CredentialTitles.js';
import _ from 'lodash';
export function reformatConfig(config, reverse = false) {
@ -37,16 +37,16 @@ export function formatCredentialsForForm(credentials) {
let secret = credentials[i]['secret'];
if(secret !== null){
if (secret.hasOwnProperty(SecretTypes.Password)) {
formattedCredentials['exploit_password_list'].push(secret['password'])
formattedCredentials['exploit_password_list'].push(secret[SecretTypes.Password])
}
if (secret.hasOwnProperty(SecretTypes.NTHash)) {
formattedCredentials['exploit_ntlm_hash_list'].push(secret['nt_hash'])
formattedCredentials['exploit_ntlm_hash_list'].push(secret[SecretTypes.NTHash])
}
if (secret.hasOwnProperty(SecretTypes.LMHash)) {
formattedCredentials['exploit_lm_hash_list'].push(secret['lm_hash'])
formattedCredentials['exploit_lm_hash_list'].push(secret[SecretTypes.LMHash])
}
if (secret.hasOwnProperty(SecretTypes.PrivateKey)) {
let keypair = {'public_key': secret['public_key'], 'private_key': secret['private_key']}
let keypair = {'public_key': secret[PlaintextTypes.PublicKey], 'private_key': secret[SecretTypes.PrivateKey]}
formattedCredentials['exploit_ssh_keys'].push(keypair)
}
}

View File

@ -1,4 +1,4 @@
import {CredentialTypes, SecretTypes} from '../utils/CredentialTypes.js';
import {CredentialTitles, SecretTypes} from '../utils/CredentialTitles.js';
export function getAllUsernames(stolen, configured) {
let usernames = new Set();
@ -37,17 +37,17 @@ export function getAllSecrets(stolen, configured) {
function reformatSecret(secret) {
if (secret.hasOwnProperty(SecretTypes.Password)) {
return {'type': CredentialTypes.Password, 'content': secret[SecretTypes.Password]}
return {'title': CredentialTitles.Password, 'content': secret[SecretTypes.Password]}
}
if (secret.hasOwnProperty(SecretTypes.NTHash)) {
return {'type': CredentialTypes.NTHash, 'content': secret[SecretTypes.NTHash]}
return {'title': CredentialTitles.NTHash, 'content': secret[SecretTypes.NTHash]}
}
if (secret.hasOwnProperty(SecretTypes.LMHash)) {
return {'type': CredentialTypes.LMHash, 'content': secret[SecretTypes.LMHash]}
return {'title': CredentialTitles.LMHash, 'content': secret[SecretTypes.LMHash]}
}
if (secret.hasOwnProperty(SecretTypes.PrivateKey)) {
return {
'type': CredentialTypes.SSHKeys,
'title': CredentialTitles.SSHKeys,
'content': secret[SecretTypes.PrivateKey]
}
}
@ -62,7 +62,7 @@ export function getCredentialsTableData(credentials) {
for (let i = 0; i < credentials.length; i++) {
let row_data = {};
row_data['username'] = identites[i];
row_data['type'] = secrets[i]['type'];
row_data['title'] = secrets[i]['title'];
table_data.push(row_data);
}

View File

@ -7,7 +7,7 @@ const columns = [
Header: 'Stolen Credentials',
columns: [
{Header: 'Username', accessor: 'username'},
{Header: 'Type', accessor: 'type'}
{Header: 'Type', accessor: 'title'}
]
}
];

View File

@ -24,7 +24,7 @@ class UsedCredentials extends React.Component {
</p>
<ul>
{allSecrets.map((x, index) => <li
key={index}>{x['type']}: {x['content'].substr(0, 3) + '******'}</li>)}
key={index}>{x['title']}: {x['content'].substr(0, 3) + '******'}</li>)}
</ul>
</>
:

View File

@ -1,4 +1,4 @@
export const CredentialTypes = {
export const CredentialTitles = {
Password: 'Clear Password',
SSHKeys: 'Clear SSH private key',
LMHash: 'LM hash',
@ -12,3 +12,7 @@ export const SecretTypes = {
LMHash: 'lm_hash',
NTHash: 'nt_hash'
}
export const PlaintextTypes = {
PublicKey: 'public_key'
}