Store the last generated error

git-svn-id: file:///home/svn/framework3/trunk@8927 4d416f70-5f16-0410-b530-b9f4589650da
unstable
HD Moore 2010-03-26 01:18:10 +00:00
parent 52da4d13bf
commit ee2e796a19
3 changed files with 9 additions and 1 deletions

View File

@ -1,4 +1,3 @@
module Msf
module Simple module Simple
### ###
@ -93,10 +92,12 @@ protected
mod.framework.events.on_module_run(mod) mod.framework.events.on_module_run(mod)
mod.run mod.run
rescue ::Interrupt rescue ::Interrupt
mod.error = $!
mod.print_error("Auxiliary interrupted by the console user") mod.print_error("Auxiliary interrupted by the console user")
mod.cleanup mod.cleanup
return return
rescue ::Exception => e rescue ::Exception => e
mod.error = e
mod.print_error("Auxiliary failed: #{e.class} #{e}") mod.print_error("Auxiliary failed: #{e.class} #{e}")
if(e.class.to_s != 'Msf::OptionValidateError') if(e.class.to_s != 'Msf::OptionValidateError')
mod.print_error("Call stack:") mod.print_error("Call stack:")

View File

@ -130,8 +130,10 @@ module Exploit
return session return session
rescue ::Interrupt rescue ::Interrupt
exploit.error = $!
raise $! raise $!
rescue ::Exception => e rescue ::Exception => e
exploit.error = e
exploit.print_error("Exploit failed: #{e}") exploit.print_error("Exploit failed: #{e}")
elog("Exploit failed (#{exploit.refname}): #{e}", 'core', LEV_0) elog("Exploit failed (#{exploit.refname}): #{e}", 'core', LEV_0)
dlog("Call stack:\n#{e.backtrace.join("\n")}", 'core', LEV_3) dlog("Call stack:\n#{e.backtrace.join("\n")}", 'core', LEV_3)

View File

@ -600,6 +600,11 @@ class Module
# #
attr_accessor :module_store attr_accessor :module_store
#
# The last exception to occur using this module
#
attr_accessor :error
protected protected
# #