Island, Common: Small style improvements

This commit is contained in:
vakaris_zilius 2022-09-06 13:24:03 +00:00
parent 16a59a3f5a
commit b08097b131
4 changed files with 35 additions and 25 deletions

View File

@ -12,5 +12,5 @@ class LMHash(BaseModel):
@validator("lm_hash")
def validate_hash_format(cls, nt_hash):
if not re.match(ntlm_hash_regex, nt_hash):
raise ValueError(f"Invalid lm hash provided: {nt_hash}")
raise ValueError(f"Invalid LM hash provided: {nt_hash}")
return nt_hash

View File

@ -12,5 +12,5 @@ class NTHash(InfectionMonkeyBaseModel):
@validator("nt_hash")
def validate_hash_format(cls, nt_hash):
if not re.match(ntlm_hash_regex, nt_hash):
raise ValueError(f"Invalid nt hash provided: {nt_hash}")
raise ValueError(f"Invalid NT hash provided: {nt_hash}")
return nt_hash

View File

@ -8,14 +8,19 @@ export function reformatConfig(config, reverse = false) {
if (reverse) {
if (formattedConfig['payloads'].length === 1) {
// Second click on Export
formattedConfig['payloads'] = [{'name': 'ransomware', 'options': formattedConfig['payloads'][0]['options']}];
formattedConfig['payloads'] = [{
'name': 'ransomware',
'options': formattedConfig['payloads'][0]['options']
}];
} else {
formattedConfig['payloads'] = [{'name': 'ransomware', 'options': formattedConfig['payloads']}];
formattedConfig['payloads'] = [{
'name': 'ransomware',
'options': formattedConfig['payloads']
}];
}
formattedConfig['keep_tunnel_open_time'] = formattedConfig['advanced']['keep_tunnel_open_time'];
} else {
if(formattedConfig['payloads'].length !== 0)
{
if (formattedConfig['payloads'].length !== 0) {
formattedConfig['payloads'] = formattedConfig['payloads'][0]['options'];
} else {
formattedConfig['payloads'] = {'encryption': {}, 'other_behaviors': {}}
@ -36,17 +41,20 @@ export function formatCredentialsForForm(credentials) {
let secret = credentials[i]['secret'];
if (secret !== null) {
if (secret.hasOwnProperty(SecretTypes.Password)) {
if (Object.prototype.hasOwnProperty.call(secret, SecretTypes.Password)) {
formattedCredentials['exploit_password_list'].push(secret[SecretTypes.Password])
}
if (secret.hasOwnProperty(SecretTypes.NTHash)) {
if (Object.prototype.hasOwnProperty.call(secret, SecretTypes.NTHash)) {
formattedCredentials['exploit_ntlm_hash_list'].push(secret[SecretTypes.NTHash])
}
if (secret.hasOwnProperty(SecretTypes.LMHash)) {
if (Object.prototype.hasOwnProperty.call(secret, SecretTypes.LMHash)) {
formattedCredentials['exploit_lm_hash_list'].push(secret[SecretTypes.LMHash])
}
if (secret.hasOwnProperty(SecretTypes.PrivateKey)) {
let keypair = {'public_key': secret[PlaintextTypes.PublicKey], 'private_key': secret[SecretTypes.PrivateKey]}
if (Object.prototype.hasOwnProperty.call(secret, SecretTypes.PrivateKey)) {
let keypair = {
'public_key': secret[PlaintextTypes.PublicKey],
'private_key': secret[SecretTypes.PrivateKey]
}
formattedCredentials['exploit_ssh_keys'].push(keypair)
}
}
@ -78,8 +86,10 @@ export function formatCredentialsForIsland(credentials) {
for (let i = 0; i < ssh_keys.length; i++) {
formattedCredentials.push({
'identity': null,
'secret': {'private_key': ssh_keys[i]['private_key'],
'public_key': ssh_keys[i]['public_key']}
'secret': {
'private_key': ssh_keys[i]['private_key'],
'public_key': ssh_keys[i]['public_key']
}
})
}

View File

@ -36,16 +36,16 @@ export function getAllSecrets(stolen, configured) {
}
function reformatSecret(secret) {
if (secret.hasOwnProperty(SecretTypes.Password)) {
if (Object.prototype.hasOwnProperty.call(secret, SecretTypes.Password)) {
return {'title': CredentialTitles.Password, 'content': secret[SecretTypes.Password]}
}
if (secret.hasOwnProperty(SecretTypes.NTHash)) {
if (Object.prototype.hasOwnProperty.call(secret, SecretTypes.NTHash)) {
return {'title': CredentialTitles.NTHash, 'content': secret[SecretTypes.NTHash]}
}
if (secret.hasOwnProperty(SecretTypes.LMHash)) {
if (Object.prototype.hasOwnProperty.call(secret, SecretTypes.LMHash)) {
return {'title': CredentialTitles.LMHash, 'content': secret[SecretTypes.LMHash]}
}
if (secret.hasOwnProperty(SecretTypes.PrivateKey)) {
if (Object.prototype.hasOwnProperty.call(secret, SecretTypes.PrivateKey)) {
return {
'title': CredentialTitles.SSHKeys,
'content': secret[SecretTypes.PrivateKey]