Fixes #5684 by backing off of post module setup if we don't have enough of a meterpreter session to work with yet.
git-svn-id: file:///home/svn/framework3/trunk@13892 4d416f70-5f16-0410-b530-b9f4589650da
This commit is contained in:
parent
cce4aafd9b
commit
153a73c75f
|
@ -35,9 +35,26 @@ class Post < Msf::Module
|
|||
if not session
|
||||
raise Msf::OptionValidateError.new(["SESSION"])
|
||||
end
|
||||
check_for_session_readiness() unless session.type == "meterpreter"
|
||||
|
||||
@session.init_ui(self.user_input, self.user_output)
|
||||
end
|
||||
|
||||
# Meterpreter sometimes needs a little bit of extra time to
|
||||
# actually be responsive for post modules. Default tries
|
||||
# and retries for 5 seconds.
|
||||
def check_for_session_readiness(tries=10)
|
||||
session_ready_count = 0
|
||||
session_ready = false
|
||||
until session.sys or session_ready_count > tries
|
||||
select(nil,nil,nil,0.5)
|
||||
session_ready_count += 1
|
||||
end
|
||||
session_ready = !!session.sys
|
||||
raise "Could not get a hold of the session." unless session_ready
|
||||
return session_ready
|
||||
end
|
||||
|
||||
#
|
||||
# Default cleanup handler does nothing
|
||||
#
|
||||
|
|
Loading…
Reference in New Issue