forked from p15670423/monkey
Island, Common: Small style improvements
This commit is contained in:
parent
16a59a3f5a
commit
b08097b131
|
@ -12,5 +12,5 @@ class LMHash(BaseModel):
|
||||||
@validator("lm_hash")
|
@validator("lm_hash")
|
||||||
def validate_hash_format(cls, nt_hash):
|
def validate_hash_format(cls, nt_hash):
|
||||||
if not re.match(ntlm_hash_regex, 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
|
return nt_hash
|
||||||
|
|
|
@ -12,5 +12,5 @@ class NTHash(InfectionMonkeyBaseModel):
|
||||||
@validator("nt_hash")
|
@validator("nt_hash")
|
||||||
def validate_hash_format(cls, nt_hash):
|
def validate_hash_format(cls, nt_hash):
|
||||||
if not re.match(ntlm_hash_regex, 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
|
return nt_hash
|
||||||
|
|
|
@ -8,14 +8,19 @@ export function reformatConfig(config, reverse = false) {
|
||||||
if (reverse) {
|
if (reverse) {
|
||||||
if (formattedConfig['payloads'].length === 1) {
|
if (formattedConfig['payloads'].length === 1) {
|
||||||
// Second click on Export
|
// Second click on Export
|
||||||
formattedConfig['payloads'] = [{'name': 'ransomware', 'options': formattedConfig['payloads'][0]['options']}];
|
formattedConfig['payloads'] = [{
|
||||||
|
'name': 'ransomware',
|
||||||
|
'options': formattedConfig['payloads'][0]['options']
|
||||||
|
}];
|
||||||
} else {
|
} 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'];
|
formattedConfig['keep_tunnel_open_time'] = formattedConfig['advanced']['keep_tunnel_open_time'];
|
||||||
} else {
|
} else {
|
||||||
if(formattedConfig['payloads'].length !== 0)
|
if (formattedConfig['payloads'].length !== 0) {
|
||||||
{
|
|
||||||
formattedConfig['payloads'] = formattedConfig['payloads'][0]['options'];
|
formattedConfig['payloads'] = formattedConfig['payloads'][0]['options'];
|
||||||
} else {
|
} else {
|
||||||
formattedConfig['payloads'] = {'encryption': {}, 'other_behaviors': {}}
|
formattedConfig['payloads'] = {'encryption': {}, 'other_behaviors': {}}
|
||||||
|
@ -36,17 +41,20 @@ export function formatCredentialsForForm(credentials) {
|
||||||
|
|
||||||
let secret = credentials[i]['secret'];
|
let secret = credentials[i]['secret'];
|
||||||
if (secret !== null) {
|
if (secret !== null) {
|
||||||
if (secret.hasOwnProperty(SecretTypes.Password)) {
|
if (Object.prototype.hasOwnProperty.call(secret, SecretTypes.Password)) {
|
||||||
formattedCredentials['exploit_password_list'].push(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])
|
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])
|
formattedCredentials['exploit_lm_hash_list'].push(secret[SecretTypes.LMHash])
|
||||||
}
|
}
|
||||||
if (secret.hasOwnProperty(SecretTypes.PrivateKey)) {
|
if (Object.prototype.hasOwnProperty.call(secret, SecretTypes.PrivateKey)) {
|
||||||
let keypair = {'public_key': secret[PlaintextTypes.PublicKey], 'private_key': secret[SecretTypes.PrivateKey]}
|
let keypair = {
|
||||||
|
'public_key': secret[PlaintextTypes.PublicKey],
|
||||||
|
'private_key': secret[SecretTypes.PrivateKey]
|
||||||
|
}
|
||||||
formattedCredentials['exploit_ssh_keys'].push(keypair)
|
formattedCredentials['exploit_ssh_keys'].push(keypair)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -78,8 +86,10 @@ export function formatCredentialsForIsland(credentials) {
|
||||||
for (let i = 0; i < ssh_keys.length; i++) {
|
for (let i = 0; i < ssh_keys.length; i++) {
|
||||||
formattedCredentials.push({
|
formattedCredentials.push({
|
||||||
'identity': null,
|
'identity': null,
|
||||||
'secret': {'private_key': ssh_keys[i]['private_key'],
|
'secret': {
|
||||||
'public_key': ssh_keys[i]['public_key']}
|
'private_key': ssh_keys[i]['private_key'],
|
||||||
|
'public_key': ssh_keys[i]['public_key']
|
||||||
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -36,16 +36,16 @@ export function getAllSecrets(stolen, configured) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function reformatSecret(secret) {
|
function reformatSecret(secret) {
|
||||||
if (secret.hasOwnProperty(SecretTypes.Password)) {
|
if (Object.prototype.hasOwnProperty.call(secret, SecretTypes.Password)) {
|
||||||
return {'title': CredentialTitles.Password, 'content': 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]}
|
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]}
|
return {'title': CredentialTitles.LMHash, 'content': secret[SecretTypes.LMHash]}
|
||||||
}
|
}
|
||||||
if (secret.hasOwnProperty(SecretTypes.PrivateKey)) {
|
if (Object.prototype.hasOwnProperty.call(secret, SecretTypes.PrivateKey)) {
|
||||||
return {
|
return {
|
||||||
'title': CredentialTitles.SSHKeys,
|
'title': CredentialTitles.SSHKeys,
|
||||||
'content': secret[SecretTypes.PrivateKey]
|
'content': secret[SecretTypes.PrivateKey]
|
||||||
|
|
Loading…
Reference in New Issue