use kind_of? for checking exceptions
parent
3a73b40a1e
commit
6444d8ba64
|
@ -153,15 +153,15 @@ protected
|
|||
mod.print_error("Auxiliary failed: #{e.class} #{e}")
|
||||
elog("Auxiliary failed: #{e.class} #{e}", 'core', LEV_0)
|
||||
|
||||
if(e.class.to_s != 'Msf::OptionValidateError')
|
||||
if e.kind_of?(Msf::OptionValidateError)
|
||||
dlog("Call stack:\n#{$@.join("\n")}", 'core', LEV_3)
|
||||
else
|
||||
mod.print_error("Call stack:")
|
||||
e.backtrace.each do |line|
|
||||
break if line =~ /lib.msf.base.simple.auxiliary.rb/
|
||||
mod.print_error(" #{line}")
|
||||
end
|
||||
elog("Call stack:\n#{$@.join("\n")}", 'core', LEV_0)
|
||||
else
|
||||
dlog("Call stack:\n#{$@.join("\n")}", 'core', LEV_3)
|
||||
end
|
||||
|
||||
mod.cleanup
|
||||
|
|
|
@ -148,15 +148,15 @@ module Exploit
|
|||
exploit.print_error("Exploit failed: #{e}")
|
||||
elog("Exploit failed (#{exploit.refname}): #{e}", 'core', LEV_0)
|
||||
|
||||
if(e.class.to_s != 'Msf::OptionValidateError')
|
||||
if e.kind_of?(Msf::OptionValidateError)
|
||||
dlog("Call stack:\n#{e.backtrace.join("\n")}", 'core', LEV_3)
|
||||
else
|
||||
mod.print_error("Call stack:")
|
||||
e.backtrace.each do |line|
|
||||
break if line =~ /lib.msf.base.simple.exploit.rb/
|
||||
mod.print_error(" #{line}")
|
||||
end
|
||||
elog("Call stack:\n#{e.backtrace.join("\n")}", 'core', LEV_0)
|
||||
else
|
||||
dlog("Call stack:\n#{e.backtrace.join("\n")}", 'core', LEV_3)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -123,15 +123,15 @@ protected
|
|||
mod.print_error("Post failed: #{e.class} #{e}")
|
||||
elog("Post failed: #{e.class} #{e}", 'core', LEV_0)
|
||||
|
||||
if(e.class.to_s != 'Msf::OptionValidateError')
|
||||
if e.kind_of?(Msf::OptionValidateError)
|
||||
dlog("Call stack:\n#{$@.join("\n")}", 'core', LEV_3)
|
||||
else
|
||||
mod.print_error("Call stack:")
|
||||
e.backtrace.each do |line|
|
||||
break if line =~ /lib.msf.base.simple.post.rb/
|
||||
mod.print_error(" #{line}")
|
||||
end
|
||||
elog("Call stack:\n#{$@.join("\n")}", 'core', LEV_0)
|
||||
else
|
||||
dlog("Call stack:\n#{$@.join("\n")}", 'core', LEV_3)
|
||||
end
|
||||
|
||||
mod.cleanup
|
||||
|
|
|
@ -120,12 +120,17 @@ class Auxiliary
|
|||
print_error("Auxiliary interrupted by the console user")
|
||||
rescue ::Exception => e
|
||||
print_error("Auxiliary failed: #{e.class} #{e}")
|
||||
if(e.class.to_s != 'Msf::OptionValidateError')
|
||||
elog("Auxiliary failed: #{e.class} #{e}", 'core', LEV_0)
|
||||
|
||||
if e.kind_of?(Msf::OptionValidateError)
|
||||
dlog("Call stack:\n#{e.backtrace.join("\n")}", 'core', LEV_3)
|
||||
else
|
||||
print_error("Call stack:")
|
||||
e.backtrace.each do |line|
|
||||
break if line =~ /lib.msf.base.simple/
|
||||
print_error(" #{line}")
|
||||
end
|
||||
elog("Call stack:\n#{e.backtrace.join("\n")}", 'core', LEV_0)
|
||||
end
|
||||
|
||||
return false
|
||||
|
@ -152,4 +157,3 @@ class Auxiliary
|
|||
end
|
||||
|
||||
end end end end
|
||||
|
||||
|
|
|
@ -121,12 +121,18 @@ class Exploit
|
|||
raise $!
|
||||
rescue ::Exception => e
|
||||
print_error("Exploit exception (#{mod.refname}): #{e.class} #{e}")
|
||||
if(e.class.to_s != 'Msf::OptionValidateError')
|
||||
|
||||
elog("Exploit exception (#{mod.refname}): #{e.class} #{e}", 'core', LEV_0)
|
||||
|
||||
if e.kind_of?(Msf::OptionValidateError)
|
||||
dlog("Call stack:\n#{e.backtrace.join("\n")}", 'core', LEV_3)
|
||||
else
|
||||
print_error("Call stack:")
|
||||
e.backtrace.each do |line|
|
||||
break if line =~ /lib.msf.base.simple/
|
||||
print_error(" #{line}")
|
||||
end
|
||||
elog("Call stack:\n#{e.backtrace.join("\n")}", 'core', LEV_0)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -122,12 +122,18 @@ class Post
|
|||
print_error("Post interrupted by the console user")
|
||||
rescue ::Exception => e
|
||||
print_error("Post failed: #{e.class} #{e}")
|
||||
if (e.class.to_s != 'Msf::OptionValidateError')
|
||||
|
||||
elog("Post failed: #{e.class} #{e}", 'core', LEV_0)
|
||||
|
||||
if e.kind_of?(Msf::OptionValidateError)
|
||||
dlog("Call stack:\n#{e.backtrace.join("\n")}", 'core', LEV_3)
|
||||
else
|
||||
print_error("Call stack:")
|
||||
e.backtrace.each do |line|
|
||||
break if line =~ /lib.msf.base.simple/
|
||||
print_error(" #{line}")
|
||||
end
|
||||
elog("Call stack:\n#{e.backtrace.join("\n")}", 'core', LEV_0)
|
||||
end
|
||||
|
||||
return false
|
||||
|
@ -154,4 +160,3 @@ class Post
|
|||
end
|
||||
|
||||
end end end end
|
||||
|
||||
|
|
Loading…
Reference in New Issue