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")
|
||||
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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -6,16 +6,21 @@ export function reformatConfig(config, reverse = false) {
|
|||
let formattedConfig = _.clone(config);
|
||||
|
||||
if (reverse) {
|
||||
if(formattedConfig['payloads'].length === 1){
|
||||
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': {}}
|
||||
|
@ -30,23 +35,26 @@ export function formatCredentialsForForm(credentials) {
|
|||
let formattedCredentials = _.clone(defaultCredentials);
|
||||
for (let i = 0; i < credentials.length; i++) {
|
||||
let identity = credentials[i]['identity'];
|
||||
if(identity !== null) {
|
||||
if (identity !== null) {
|
||||
formattedCredentials['exploit_user_list'].push(identity.username)
|
||||
}
|
||||
|
||||
let secret = credentials[i]['secret'];
|
||||
if(secret !== null){
|
||||
if (secret.hasOwnProperty(SecretTypes.Password)) {
|
||||
if (secret !== null) {
|
||||
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']
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
|
|
@ -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]
|
||||
|
|
Loading…
Reference in New Issue