further clean up exception handling / session waiting for exploits
git-svn-id: file:///home/svn/framework3/trunk@9910 4d416f70-5f16-0410-b530-b9f4589650daunstable
parent
25bc9f2973
commit
6e34bc5420
|
@ -185,6 +185,10 @@ protected
|
|||
# Job run proc, sets up the exploit and kicks it off.
|
||||
#
|
||||
def job_run_proc(ctx)
|
||||
# Default session wait time..
|
||||
delay = payload.wfs_delay + exploit.wfs_delay
|
||||
delay = nil if exploit.passive?
|
||||
|
||||
begin
|
||||
exploit, payload = ctx
|
||||
|
||||
|
@ -196,19 +200,10 @@ protected
|
|||
# Launch the exploit
|
||||
exploit.exploit
|
||||
|
||||
# Wait the payload to acquire a session if this isn't a passive-style
|
||||
# exploit.
|
||||
if (exploit.passive? == false or force_wait_for_session == true)
|
||||
self.session = payload.wait_for_session(
|
||||
(exploit.passive? == true) ? nil : payload.wfs_delay + exploit.wfs_delay)
|
||||
end
|
||||
rescue ::Exception => e
|
||||
|
||||
# Check for a session even if an exception was hit
|
||||
if (not [::RuntimeError, ::Interrupt].include?(e.class) and
|
||||
(exploit.passive? == false or force_wait_for_session == true))
|
||||
self.session = payload.wait_for_session(
|
||||
(exploit.passive? == true) ? nil : payload.wfs_delay + exploit.wfs_delay)
|
||||
if [::RuntimeError, ::Interrupt].include?(e.class)
|
||||
# Wait for session, but don't wait long.
|
||||
delay = 0.01
|
||||
end
|
||||
|
||||
# Build a user-friendly error message
|
||||
|
@ -221,11 +216,18 @@ protected
|
|||
exploit.error = msg
|
||||
|
||||
# Log a more verbose version
|
||||
elog("Exploit exception (#{exploit.refname}): #{e.class} #{e}", 'core', LEV_0)
|
||||
elog("Exploit exception (#{exploit.refname}): #{e.class}: #{e}", 'core', LEV_0)
|
||||
dlog("Call stack:\n#{$@.join("\n")}", 'core', LEV_3)
|
||||
end
|
||||
|
||||
payload.stop_handler
|
||||
exploit.cleanup
|
||||
# Wait the payload to acquire a session if this isn't a passive-style
|
||||
# exploit.
|
||||
if (exploit.passive? == false or force_wait_for_session == true)
|
||||
begin
|
||||
self.session = payload.wait_for_session(delay)
|
||||
rescue ::Interrupt
|
||||
# Don't let interrupt pass upward
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue