Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Path: blob/master/modules/post/solaris/gather/checkvm.rb
Views: 11784
##1# This module requires Metasploit: https://metasploit.com/download2# Current source: https://github.com/rapid7/metasploit-framework3##45class MetasploitModule < Msf::Post6include Msf::Post::File7include Msf::Post::Solaris::Priv89def initialize(info = {})10super(11update_info(12info,13'Name' => 'Solaris Gather Virtual Environment Detection',14'Description' => %q{15This module attempts to determine whether the system is running16inside of a virtual environment and if so, which one. This17module supports detection of Solaris Zone, VMWare, VirtualBox, Xen,18and QEMU/KVM.19},20'License' => MSF_LICENSE,21'Author' => [ 'Carlos Perez <carlos_perez[at]darkoperator.com>'],22'Platform' => [ 'solaris' ],23'SessionTypes' => [ 'shell' ]24)25)26end2728# Run Method for when run command is issued29def run30print_status('Gathering System info ....')31vm = nil32kernel_type = cmd_exec('uname -v')3334if kernel_type =~ /Generic_Virtual/i35vm = 'Solaris Zone'36end3738if !vm3940prt_diag = cmd_exec('/usr/sbin/prtdiag -v').gsub("\n", ' ')4142case prt_diag43when /virtualbox/i44vm = 'VirtualBox'45when /vmware/i46vm = 'VMware'47when /xen/i48vm = 'Xen'49when /qemu/i50vm = 'Qemu/KVM'51end52end5354if vm55print_good("This appears to be a #{vm} Virtual Machine")56else57print_status('This appears to be a Physical Machine')58end59end6061end626364