2011-06-14 00:50:33 +00:00
|
|
|
##
|
2013-10-15 19:52:12 +00:00
|
|
|
# This module requires Metasploit: http//metasploit.com/download
|
2013-10-15 18:50:46 +00:00
|
|
|
# Current source: https://github.com/rapid7/metasploit-framework
|
2011-06-14 00:50:33 +00:00
|
|
|
##
|
|
|
|
|
|
|
|
require 'msf/core'
|
|
|
|
require 'rex'
|
|
|
|
|
|
|
|
class Metasploit3 < Msf::Post
|
|
|
|
|
2013-09-05 18:41:25 +00:00
|
|
|
include Msf::Post::File
|
|
|
|
include Msf::Post::Solaris::Priv
|
2011-06-14 00:50:33 +00:00
|
|
|
|
|
|
|
|
2013-08-30 21:28:54 +00:00
|
|
|
def initialize(info={})
|
|
|
|
super( update_info( info,
|
|
|
|
'Name' => 'Solaris Gather Virtual Environment Detection',
|
|
|
|
'Description' => %q{
|
|
|
|
This module attempts to determine whether the system is running
|
|
|
|
inside of a virtual environment and if so, which one. This
|
|
|
|
module supports detectoin of Solaris Zone, VMWare, VirtualBox, Xen,
|
|
|
|
and QEMU/KVM.},
|
|
|
|
'License' => MSF_LICENSE,
|
|
|
|
'Author' => [ 'Carlos Perez <carlos_perez[at]darkoperator.com>'],
|
|
|
|
'Platform' => [ 'solaris' ],
|
|
|
|
'SessionTypes' => [ 'shell' ]
|
|
|
|
))
|
|
|
|
end
|
2011-06-14 00:50:33 +00:00
|
|
|
|
2013-08-30 21:28:54 +00:00
|
|
|
# Run Method for when run command is issued
|
|
|
|
def run
|
|
|
|
print_status("Gathering System info ....")
|
|
|
|
vm = nil
|
|
|
|
kernel_type = cmd_exec("uname -v")
|
2011-06-14 00:50:33 +00:00
|
|
|
|
2013-08-30 21:28:54 +00:00
|
|
|
if kernel_type =~ /Generic_Virtual/i
|
|
|
|
vm = "Solaris Zone"
|
|
|
|
end
|
2011-06-14 00:50:33 +00:00
|
|
|
|
2013-08-30 21:28:54 +00:00
|
|
|
if not vm
|
2011-06-14 00:50:33 +00:00
|
|
|
|
2013-08-30 21:28:54 +00:00
|
|
|
prt_diag = cmd_exec("/usr/sbin/prtdiag -v").gsub("\n"," ")
|
2011-06-14 00:50:33 +00:00
|
|
|
|
2013-08-30 21:28:54 +00:00
|
|
|
case prt_diag
|
|
|
|
when /virtualbox/i
|
|
|
|
vm = "VirtualBox"
|
|
|
|
when /vmware/i
|
|
|
|
vm = "VMware"
|
|
|
|
when /xen/i
|
|
|
|
vm = "Xen"
|
|
|
|
when /qemu/i
|
|
|
|
vm = "Qemu/KVM"
|
|
|
|
end
|
|
|
|
end
|
2011-06-14 00:50:33 +00:00
|
|
|
|
2013-08-30 21:28:54 +00:00
|
|
|
if vm
|
|
|
|
print_good("This appears to be a #{vm} Virtual Machine")
|
|
|
|
else
|
|
|
|
print_status("This appears to be a Physical Machine")
|
|
|
|
end
|
2011-06-14 00:50:33 +00:00
|
|
|
|
2013-08-30 21:28:54 +00:00
|
|
|
end
|
2011-06-14 00:50:33 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
2012-03-18 05:07:27 +00:00
|
|
|
end
|