Skip to content

Commit 3a73b40

Browse files
committed
more error handling
1 parent 7b52bcb commit 3a73b40

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

lib/msf/core/exploit_driver.rb

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -271,14 +271,20 @@ def job_run_proc(ctx)
271271
exploit.fail_reason = Msf::Exploit::Failure::Unknown
272272
end
273273

274+
elog("Exploit failed (#{exploit.refname}): #{msg}", 'core', LEV_0)
275+
274276
if exploit.fail_reason == Msf::Exploit::Failure::Unknown
275277
exploit.print_error("Exploit failed: #{msg}")
278+
exploit.print_error("Call stack:")
279+
e.backtrace.each do |line|
280+
break if line =~ /lib.msf.base.core.exploit_driver.rb/
281+
exploit.print_error(" #{line}")
282+
end
283+
elog("Call stack:\n#{e.backtrace.join("\n")}", 'core', LEV_0)
276284
else
277285
exploit.print_error("Exploit failed [#{exploit.fail_reason}]: #{msg}")
286+
dlog("Call stack:\n#{e.backtrace.join("\n")}", 'core', LEV_3)
278287
end
279-
280-
elog("Exploit failed (#{exploit.refname}): #{msg}", 'core', LEV_0)
281-
dlog("Call stack:\n#{e.backtrace.join("\n")}", 'core', LEV_3)
282288
end
283289

284290
# Record the error to various places
@@ -329,4 +335,3 @@ def job_cleanup_proc(ctx)
329335
end
330336

331337
end
332-

0 commit comments

Comments
 (0)