Skip to content

Add consistent error logging for module loading and handle nil backtraces - #13757

Merged
adfoster-r7 merged 1 commit into
rapid7:masterfrom
adfoster-r7:add-consistent-error-logging-for-module-loading
Jun 23, 2020
Merged

Add consistent error logging for module loading and handle nil backtraces#13757
adfoster-r7 merged 1 commit into
rapid7:masterfrom
adfoster-r7:add-consistent-error-logging-for-module-loading

Conversation

@adfoster-r7

@adfoster-r7 adfoster-r7 commented Jun 23, 2020

Copy link
Copy Markdown
Contributor

Dependent on #13430

Updating the new error logging API to correctly handle the backtrace array being nil, which occurs when custom exception objects are created and passed to elog:

load_error(full_path, Errno::ENOENT.new)

Example:

2.6.6 :001 > Exception.new("Hello world").backtrace
 => nil 

Verification

List the steps needed to make sure this thing works

  • Force a syntax error on a module file for instance on exploit/windows/smb/ms08_067_netapi
  • Start msfconsole
  • use exploit/windows/smb/ms08_067_netapi
  • Verify the module doesn't load
  • Verify the framework log is populated with the correct error information
  • set LogLevel 3
  • use exploit/windows/smb/ms08_067_netapi
  • Verify the framework log now has additional backtrace information

Comment thread lib/rex/logging/log_dispatcher.rb Outdated
if error.backtrace
error_details << "\nCall stack:\n#{error.backtrace.join("\n")}"
else
error_details << "\nCall stack:\nnone"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
error_details << "\nCall stack:\nnone"
error_details << "\nCall stack:\nNone"

@agalway-r7 agalway-r7 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, tested locally so I'm happy to merge once my pedantic capitalization suggestion is resolved

@adfoster-r7
adfoster-r7 force-pushed the add-consistent-error-logging-for-module-loading branch from ddbfc07 to 2439342 Compare June 23, 2020 10:15
@adfoster-r7
adfoster-r7 merged commit 56fe6de into rapid7:master Jun 23, 2020
@adfoster-r7
adfoster-r7 deleted the add-consistent-error-logging-for-module-loading branch June 23, 2020 10:50
@adfoster-r7 adfoster-r7 added the rn-no-release-notes no release notes label Jun 23, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants