Skip to content

Allow set_comment to work with no decompiler available #80

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

withzombies
Copy link

Currently, if you do not have a decompiler for the platform, the set_comment function fails.

This PR adds a check to see if the hex rays plugin has been initialized and only sets the function comment if not.

Hex-Rays init_hexrays_plugin returns True if you have any decompilers.
As far as I know, there's no API to ask if any support our current
target. So catch the error and bail out.
Copy link
Owner

@mrexodia mrexodia left a comment

Choose a reason for hiding this comment

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

Thanks a lot! Added a small comment/question.

# Reference: https://cyber.wtf/2019/03/22/using-ida-python-to-analyze-trickbot/
# Check if the address corresponds to a line
cfunc = decompile_checked(address)
try:
Copy link
Owner

Choose a reason for hiding this comment

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

This will hide a real decompilation error. Did you observe ida_hexrays.init_hexrays_plugin() succeeding but the decompilation failing if you do not have a decompiler available?

Copy link
Author

Choose a reason for hiding this comment

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

If you have a HexRays decompiler but not the right decompiler for the executable , the init function still returns true.

For example, I hit this when reversing an x86 binary but I only have the x64 and ARM64 decompilers.

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

Successfully merging this pull request may close these issues.

2 participants