Update enum_vbox

bug/bundler_fix
jvazquez-r7 2015-06-22 17:54:17 -05:00
parent c20d2a1dd9
commit f216841d01
No known key found for this signature in database
GPG Key ID: 38D99152B9352D83
1 changed files with 30 additions and 20 deletions

View File

@ -29,27 +29,37 @@ class Metasploit3 < Msf::Post
def run
if session.platform =~ /win/
res = session.shell_command_token_win32('"c:\Program Files\Oracle\VirtualBox\vboxmanage" list -l vms') || ''
if res.include? "The system cannot find the path specified"
print_error "VirtualBox does not appear to be installed on this machine"
if session.type == 'meterpreter'
begin
res = cmd_exec('c:\\Program Files\\Oracle\\VirtualBox\\vboxmanage', 'list -l vms')
rescue ::Rex::Post::Meterpreter::RequestError
print_error('VirtualBox does not appear to be installed on this machine')
return nil
elsif res == "\n"
print_status "VirtualBox is installed but this user has no VMs registered. Try another user."
end
if res.empty?
print_status('VirtualBox is installed but this user has no VMs registered. Try another user.')
return nil
end
else
res = cmd_exec('"c:\\Program Files\\Oracle\\VirtualBox\\vboxmanage" list -l vms')
if res.empty?
print_error('VirtualBox isn\'t installed or this user has no VMs registered')
return nil
end
end
elsif session.platform =~ /unix|linux|bsd|osx/
res = session.shell_command('vboxmanage list -l vms')
unless res.start_with? "Sun VirtualBox"
print_error "VirtualBox does not appear to be installed on this machine"
return nil
end
unless res.include? "Name:"
print_status "VirtualBox is installed but this user has no VMs registered. Try another user."
res = cmd_exec('vboxmanage list -l vms')
unless res.start_with?('Sun VirtualBox') || res.include?('Name:')
print_error('VirtualBox isn\'t installed or this user has no VMs registered')
return nil
end
end
print_good res
store_loot('virtualbox_vms', "text/plain", session, res, "virtualbox_vms.txt", "Virtualbox Virtual Machines")
vprint_status(res)
store_path = store_loot('virtualbox_vms', "text/plain", session, res, "virtualbox_vms.txt", "Virtualbox Virtual Machines")
print_good("#{peer} - File successfully retrieved and saved on #{store_path}")
end