use kind_of? for checking exceptions

bug/bundler_fix
Christian Mehlmauer 2014-12-30 21:16:57 +01:00
parent 3a73b40a1e
commit 6444d8ba64
No known key found for this signature in database
GPG Key ID: BCFF4FA966BC32C7
6 changed files with 29 additions and 14 deletions

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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