Handle cases where the exploit succeeds but then throws an exception, printing the "exploit failed" message. Closes #2260
git-svn-id: file:///home/svn/framework3/trunk@9840 4d416f70-5f16-0410-b530-b9f4589650daunstable
parent
9e360f19e0
commit
d9402edde3
|
@ -122,13 +122,10 @@ module Exploit
|
|||
end
|
||||
|
||||
# Let's rock this party
|
||||
session = driver.run
|
||||
driver.run
|
||||
|
||||
# Save the job identifier this exploit is running as
|
||||
exploit.job_id = driver.job_id
|
||||
|
||||
return session
|
||||
|
||||
rescue ::Interrupt
|
||||
exploit.error = $!
|
||||
raise $!
|
||||
|
@ -137,8 +134,9 @@ module Exploit
|
|||
exploit.print_error("Exploit failed: #{e}")
|
||||
elog("Exploit failed (#{exploit.refname}): #{e}", 'core', LEV_0)
|
||||
dlog("Call stack:\n#{e.backtrace.join("\n")}", 'core', LEV_3)
|
||||
return
|
||||
end
|
||||
|
||||
driver.session
|
||||
end
|
||||
|
||||
#
|
||||
|
|
|
@ -171,10 +171,11 @@ class ExploitDriver
|
|||
#
|
||||
attr_accessor :job_id
|
||||
attr_accessor :force_wait_for_session # :nodoc:
|
||||
attr_accessor :session # :nodoc:
|
||||
|
||||
protected
|
||||
|
||||
attr_accessor :session # :nodoc:
|
||||
|
||||
|
||||
#
|
||||
# Job run proc, sets up the exploit and kicks it off.
|
||||
|
@ -198,16 +199,22 @@ protected
|
|||
(exploit.passive? == true) ? nil : payload.wfs_delay + exploit.wfs_delay)
|
||||
end
|
||||
rescue ::Exception
|
||||
|
||||
# Check for a session even if an exception was hit
|
||||
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
|
||||
|
||||
exploit.framework.events.on_module_error(exploit, $!)
|
||||
exploit.print_error("Exploit failed: #{$!}")
|
||||
exploit.print_error("Exploit exception: #{$!}")
|
||||
exploit.error = $!
|
||||
|
||||
elog("Exploit failed (#{exploit.refname}): #{$!.class} #{$!}", 'core', LEV_0)
|
||||
elog("Exploit exception (#{exploit.refname}): #{$!.class} #{$!}", 'core', LEV_0)
|
||||
dlog("Call stack:\n#{$@.join("\n")}", 'core', LEV_3)
|
||||
|
||||
payload.stop_handler
|
||||
exploit.cleanup
|
||||
return
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -154,7 +154,7 @@ class Exploit
|
|||
rescue ::Interrupt
|
||||
raise $!
|
||||
rescue ::Exception => e
|
||||
print_error("Exploit failed (#{mod.refname}): #{e.class} #{e}")
|
||||
print_error("Exploit exception (#{mod.refname}): #{e.class} #{e}")
|
||||
if(e.class.to_s != 'Msf::OptionValidateError')
|
||||
print_error("Call stack:")
|
||||
e.backtrace.each do |line|
|
||||
|
|
Loading…
Reference in New Issue