metasploit-framework/modules/post/solaris/gather/checkvm.rb

64 lines
1.5 KiB
Ruby
Raw Normal View History

##
# This module requires Metasploit: http://metasploit.com/download
# Current source: https://github.com/rapid7/metasploit-framework
##
2016-03-08 13:02:44 +00:00
class MetasploitModule < Msf::Post
2013-09-05 18:41:25 +00:00
include Msf::Post::File
include Msf::Post::Solaris::Priv
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
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")
2013-08-30 21:28:54 +00:00
if kernel_type =~ /Generic_Virtual/i
vm = "Solaris Zone"
end
2013-08-30 21:28:54 +00:00
if not vm
2013-08-30 21:28:54 +00:00
prt_diag = cmd_exec("/usr/sbin/prtdiag -v").gsub("\n"," ")
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
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
2013-08-30 21:28:54 +00:00
end
2012-03-18 05:07:27 +00:00
end