Skip to content

Commit

Permalink
Handle failed jumps a little more loudly
Browse files Browse the repository at this point in the history
  • Loading branch information
Eric Hennenfent committed Jul 10, 2020
1 parent 7abbe16 commit e261756
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 11 deletions.
8 changes: 0 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,17 +47,9 @@ The Medium Level IL functions at a significantly higher level than the Lifted IL

This plugin has only been tested on 64-bit Ubuntu 16.04. However, since it does not rely on any strictly os-dependent code, it will likely work on other platforms.

## Installation
If available, this plugin uses PyQt5 to display the explanation window. If no working PyQt5 installation is found, it will fall back to using the `show_message_box` feature of the Binary Ninja API, which displays a window that behaves more or less the same, but is not resizable, and blocks any other interaction with Binary Ninja.
1. [Optional]: Install PyQt5 for your platform (`apt install python-pyqt5` on Ubuntu. For other platforms, see [this guide](https://github.com/nbsdx/binja-ui-api/blob/master/HowToPyQt5.pdf).)
2. Clone this repository into your [Binary Ninja Plugins Folder](https://github.com/Vector35/binaryninja-api/tree/dev/python/examples#loading-plugins)

## Contributing
This plugin is designed to make it simple to add support for new LLIL instructions or additional architectures. See [CONTRIBUTING.md](https://github.com/ehennenfent/binja_explain_instruction/blob/master/CONTRIBUTING.md). If you come across any inaccuracies, feel free to file a pull request or create an issue.

## Open Source
This plugin incorporates [code by Ryan Stortz (@withzombies)](https://gist.github.com/withzombies/d4f0502754407b22da02664d4eb2fbae) that is used to display information about the CPU state before the selected instruction is executed. See instruction_state.py

## Dependencies
* PyQt5 [Optional]
* Binary Ninja
4 changes: 2 additions & 2 deletions __init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,8 @@ def explain_instruction(bv, addr):
# Display what information we can calculate about the program state before the instruction is executed
try:
explain_window().state = get_state(bv, addr)
except AttributeError:
log_error("No instruction state support for this architecture")
except (AttributeError, TypeError) as e:
log_error("Failed to extract instruction state")

explain_window().show()

Expand Down
2 changes: 1 addition & 1 deletion instruction_state.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def get_state(bv, addr):

sp_max = func.get_reg_value_at(addr, sp).offset
# TODO: What happens when sp_max is None?
for i in range(sp_max if sp_max is not None else 0, 1):
for i in range(sp_max, 1):
out = func.get_stack_contents_at(addr, i, 1)
if IsRegisterValueInteresting(out):
output.append("[SP{:#x}] = {}".format(i, out))
Expand Down

0 comments on commit e261756

Please sign in to comment.