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/auxiliary/admin/vmware/poweron_vm.rb
Views: 11784
##1# This module requires Metasploit: https://metasploit.com/download2# Current source: https://github.com/rapid7/metasploit-framework3##45class MetasploitModule < Msf::Auxiliary6include Msf::Exploit::Remote::HttpClient7include Msf::Auxiliary::Report8include Msf::Exploit::Remote::VIMSoap910def initialize11super(12'Name' => 'VMWare Power On Virtual Machine',13'Description' => %Q{14This module will log into the Web API of VMWare and try to power on15a specified Virtual Machine.16},17'Author' => ['theLightCosine'],18'License' => MSF_LICENSE,19'DefaultOptions' => { 'SSL' => true }20)2122register_options(23[24Opt::RPORT(443),25OptString.new('USERNAME', [ true, "The username to Authenticate with.", 'root' ]),26OptString.new('PASSWORD', [ true, "The password to Authenticate with.", 'password' ]),27OptString.new('VM', [true, "The VM to try to Power On"])28])29end3031def run3233if vim_do_login(datastore['USERNAME'], datastore['PASSWORD']) == :success34vm_ref = vim_find_vm_by_name(datastore['VM'])35case vm_ref36when String37return_state = vim_powerON_vm(vm_ref)38case return_state39when 'success'40print_good "VM Powered On Successfully"41when 'alreadyON'42print_status "The Server says that VM #{datastore['VM']} is already on."43else44print_error "The server returned an unexpected status #{return_state}"45end46when :noresponse47print_error "The request timed out"48when :error49print_error @vim_soap_error50when nil51print_error "Could not locate VM #{datastore['VM']}"52end53else54print_error "Login Failure on #{datastore['RHOST']}"55return56end57end58end596061