Path: blob/master/modules/auxiliary/admin/vmware/terminate_esx_sessions.rb
19758 views
##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 Terminate ESX Login Sessions',13'Description' => %(14This module will log into the Web API of VMWare and try to terminate15user login sessions as specified by the session keys.),16'Author' => ['theLightCosine'],17'License' => MSF_LICENSE,18'DefaultOptions' => { 'SSL' => true }19)2021register_options(22[23Opt::RPORT(443),24OptString.new('USERNAME', [ true, 'The username to Authenticate with.', 'root' ]),25OptString.new('PASSWORD', [ true, 'The password to Authenticate with.', 'password' ]),26OptString.new('KEYS', [true, 'The session key to terminate'])27]28)29end3031def run32if vim_do_login(datastore['USERNAME'], datastore['PASSWORD']) == :success33Shellwords.split(datastore['KEYS']).each do |key|34result = vim_terminate_session(key)35case result36when :notfound37print_error "The specified Session was not found. Check your key: #{key}"38when :success39print_good "The supplied session was terminated successfully: #{key}"40when :error41print_error "There was an error encountered terminating: #{key}"42end43end44else45print_error "Login Failure on #{datastore['RHOST']}"46return47end48end49end505152