UI: Use simplified credentials in ReformatHook.js

This commit is contained in:
Ilija Lazoroski 2022-07-21 09:10:12 +02:00
parent 3b691b5c7d
commit 4f4bba23cf
1 changed files with 17 additions and 17 deletions

View File

@ -11,15 +11,15 @@ export function reformatConfig(config, reverse = false) {
}
export function formatCredentialsForForm(credentials) {
console.log(credentials);
let formattedCredentials = _.clone(defaultCredentials);
for (let i = 0; i < credentials.length; i++) {
for (let j = 0; j < credentials[i].identities.length; j++) {
formattedCredentials['exploit_user_list'].push(credentials[i]['identities'][j].username)
let identity = credentials[i]['identity'];
if(identity !== null) {
formattedCredentials['exploit_user_list'].push(identity.username)
}
for (let j = 0; j < credentials[i].secrets.length; j++) {
console.log(credentials[i])
let secret = credentials[i]['secrets'][j];
let secret = credentials[i]['secret'];
if(secret !== null){
if (secret['credential_type'] === 'PASSWORD') {
formattedCredentials['exploit_password_list'].push(secret['password'])
}
@ -43,41 +43,41 @@ export function formatCredentialsForIsland(credentials) {
let usernames = credentials['exploit_user_list'];
for (let i = 0; i < usernames.length; i++) {
formattedCredentials.push({
'identities': [{'username': usernames[i], 'credential_type': 'USERNAME'}],
'secrets': []
'identity': {'username': usernames[i], 'credential_type': 'USERNAME'},
'secret': null
})
}
let passwords = credentials['exploit_password_list'];
for (let i = 0; i < passwords.length; i++) {
formattedCredentials.push({
'identities': [],
'secrets': [{'credential_type': 'PASSWORD', 'password': passwords[i]}]
'identity': null,
'secret': {'credential_type': 'PASSWORD', 'password': passwords[i]}
})
}
let nt_hashes = credentials['exploit_ntlm_hash_list'];
for (let i = 0; i < nt_hashes.length; i++) {
formattedCredentials.push({
'identities': [],
'secrets': [{'credential_type': 'NT_HASH', 'nt_hash': nt_hashes[i]}]
'identity': null,
'secret': {'credential_type': 'NT_HASH', 'nt_hash': nt_hashes[i]}
})
}
let lm_hashes = credentials['exploit_lm_hash_list'];
for (let i = 0; i < lm_hashes.length; i++) {
formattedCredentials.push({
'identities': [],
'secrets': [{'credential_type': 'LM_HASH', 'lm_hash': lm_hashes[i]}]
'identity': null,
'secret': {'credential_type': 'LM_HASH', 'lm_hash': lm_hashes[i]}
})
}
let ssh_keys = credentials['exploit_ssh_keys'];
for (let i = 0; i < ssh_keys.length; i++) {
formattedCredentials.push({
'identities': [],
'secrets': [{'credential_type': 'SSH_KEYPAIR', 'private_key': ssh_keys[i]['private_key'],
'public_key': ssh_keys[i]['public_key']}]
'identity': null,
'secret': {'credential_type': 'SSH_KEYPAIR', 'private_key': ssh_keys[i]['private_key'],
'public_key': ssh_keys[i]['public_key']}
})
}