Handle vault parsing exceptions

bug/bundler_fix
Martin Vigo 2016-01-15 14:54:59 -08:00
parent 3bee2fff70
commit 348ae586a7
1 changed files with 11 additions and 6 deletions

View File

@ -697,12 +697,17 @@ class Metasploit3 < Msf::Post
labels = ["name", "folder", "url", "notes", "undefined", "undefined2", "username", "password"] labels = ["name", "folder", "url", "notes", "undefined", "undefined2", "username", "password"]
vault_data = [] vault_data = []
for label in labels for label in labels
length = chunk[pointer..pointer + 3].unpack("H*").first.to_i(16) begin
encrypted_data = chunk[pointer + 4..pointer + 4 + length - 1] length = chunk[pointer..pointer + 3].unpack("H*").first.to_i(16)
label != "url" ? decrypted_data = decrypt_vault_password(vault_key, encrypted_data) : decrypted_data = [encrypted_data].pack("H*") encrypted_data = chunk[pointer + 4..pointer + 4 + length - 1]
decrypted_data = "" if decrypted_data.nil? label != "url" ? decrypted_data = decrypt_vault_password(vault_key, encrypted_data) : decrypted_data = [encrypted_data].pack("H*")
vault_data << decrypted_data if (label == "url" || label == "username" || label == "password") decrypted_data = "" if decrypted_data.nil?
pointer = pointer + 4 + length vault_data << decrypted_data if (label == "url" || label == "username" || label == "password")
pointer = pointer + 4 + length
rescue
vprint_error "Vault account could not be parsed"
return nil
end
end end
return vault_data[0] == "http://sn" ? nil : vault_data # TODO: Support secure notes return vault_data[0] == "http://sn" ? nil : vault_data # TODO: Support secure notes
end end