checkvm post module for Solaris it will detect if Solaris is running in as a Zone, VMware, VirtualBox, Xen or Qemu/KVM virtual machine.
git-svn-id: file:///home/svn/framework3/trunk@12938 4d416f70-5f16-0410-b530-b9f4589650daunstable
parent
709402bba6
commit
6b1891d72a
|
@ -0,0 +1,76 @@
|
|||
# $Id$
|
||||
##
|
||||
|
||||
##
|
||||
# ## This file is part of the Metasploit Framework and may be subject to
|
||||
# redistribution and commercial restrictions. Please see the Metasploit
|
||||
# Framework web site for more information on licensing and terms of use.
|
||||
# http://metasploit.com/framework/
|
||||
##
|
||||
|
||||
require 'msf/core'
|
||||
require 'rex'
|
||||
require 'msf/core/post/common'
|
||||
require 'msf/core/post/file'
|
||||
require 'msf/core/post/solaris/priv'
|
||||
|
||||
class Metasploit3 < Msf::Post
|
||||
|
||||
include Msf::Post::Common
|
||||
include Msf::Post::File
|
||||
include Msf::Post::Priv
|
||||
|
||||
|
||||
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>'],
|
||||
'Version' => '$Revision$',
|
||||
'Platform' => [ 'solaris' ],
|
||||
'SessionTypes' => [ 'shell' ]
|
||||
))
|
||||
end
|
||||
|
||||
# Run Method for when run command is issued
|
||||
def run
|
||||
print_status("Gathering System info ....")
|
||||
vm = nil
|
||||
kernel_type = cmd_exec("uname -v")
|
||||
|
||||
if kernel_type =~ /Generic_Virtual/i
|
||||
vm = "Solaris Zone"
|
||||
end
|
||||
|
||||
if not vm
|
||||
|
||||
prt_diag = cmd_exec("/usr/sbin/prtdiag -v").gsub("\n"," ")
|
||||
|
||||
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
|
||||
|
||||
if vm
|
||||
print_good("This appears to be a #{vm} Virtual Machine")
|
||||
else
|
||||
print_status("This appears to be a Physical Machine")
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
|
||||
|
||||
end
|
Loading…
Reference in New Issue