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

Update python meterpreter to include hex error code when format message fails #659

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion python/meterpreter/ext_server_stdapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -2899,7 +2899,7 @@ def stdapi_railgun_api(request, response):
if last_error == ERROR_SUCCESS:
error_message = 'The operation completed successfully.'
else:
error_message = 'FormatMessage failed to retrieve the error.'
error_message = 'FormatMessage failed to retrieve the error for value ' + hex(last_error) + '.'
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Making this change so that it's more clear when an exception is raised that relies on this value, what the underlying problem is

Before:

[-] [should start W32Time] Exception: RuntimeError : Could not open service. OpenServiceA error: FormatMessage failed to retrieve the error for value.

After:

[-] [should start W32Time] Exception: RuntimeError : Could not open service. OpenServiceA error: FormatMessage failed to retrieve the error for value 0x6.

else:
raise RuntimeError('unknown platform')

Expand Down