Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MSF not writing run-time errors in a spool file. #18953

Closed
kashyap-sodha opened this issue Mar 12, 2024 · 4 comments · Fixed by #18954
Closed

MSF not writing run-time errors in a spool file. #18953

kashyap-sodha opened this issue Mar 12, 2024 · 4 comments · Fixed by #18954
Labels

Comments

@kashyap-sodha
Copy link

kashyap-sodha commented Mar 12, 2024

Hi,
I'm trying to verify MSF runtime errors like Msf::OptionValidateError but it doesn't seem to be writing neither in the spool file nor in framework.log.

Steps to reproduce

How'd you, do it?

  1. Go to msfconsole
  2. use auxiliary/scanner/ftp/ftp_version
  3. Set RHOSTS to any random file.
  4. Spool an output file.
  5. Run it.
  6. You should see the Validation error in the msfconsole. Though it is not present in the spooled output file.
msfconsole_output spooled_output_file

This error does not get logged to framework.log regardless of the log level being set. Log
framework_log

Metasploit version

Framework: 6.3.27-dev
Console: 6.3.27-dev

@dwelch-r7
Copy link
Contributor

I believe that not logging this error out is intentional, the typical pattern is something like this

rescue ::Msf::OptionValidateError => e
  ::Msf::Ui::Formatter::OptionValidateError.print_error(mod_with_opts, e)

we're capturing the exception and using it to inform the user what option(s) failed to validate, since we're handling it there's not really a need for us to log it out

If you can provide some more details on what you're trying to achieve though maybe we can help point you in the right direction?

@kashyap-sodha
Copy link
Author

It was for some internal use which I can't disclose much about. But yeah, if that's intentional and can't be moved to logging, I can close this issue in that case. Thanks!

@adfoster-r7
Copy link
Contributor

adfoster-r7 commented Mar 12, 2024

Pull request: #18954

@kashyap-sodha If you're able to apply those changes locally, does that meet your expectations?

@adfoster-r7 adfoster-r7 reopened this Mar 12, 2024
@kashyap-sodha
Copy link
Author

Pull request: #18954

@kashyap-sodha If you're able to apply those changes locally, does that meet your expectations?

Hey @adfoster-r7 That seems to be working fine. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

3 participants