diff options
| author | Peter LaFosse <peter@vector35.com> | 2017-01-05 09:14:31 -0500 |
|---|---|---|
| committer | Peter LaFosse <peter@vector35.com> | 2017-01-05 09:14:31 -0500 |
| commit | 4761ea9c83104b872d8d49fcde45f17d17e7872d (patch) | |
| tree | 0acca0d74701a834c36f85aebd7dd9955ecbfb8f /python/examples/jump_table.py | |
| parent | 96acbed85902d8dfd43ef624afac72145ae6e577 (diff) | |
Modifying how enumerations are exposed and used, and a bunch of cleanup of existing plugins
Diffstat (limited to 'python/examples/jump_table.py')
| -rw-r--r-- | python/examples/jump_table.py | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/python/examples/jump_table.py b/python/examples/jump_table.py index 0fd0dbab..f24eea12 100644 --- a/python/examples/jump_table.py +++ b/python/examples/jump_table.py @@ -20,7 +20,8 @@ # This plugin will attempt to resolve simple jump tables (an array of code pointers) and add the destinations # as indirect branch targets so that the flow graph reflects the jump table's control flow. -import binaryninja +from binaryninja.plugin import PluginCommand +from binaryninja.enum import InstructionTextTokenType import struct @@ -49,7 +50,7 @@ def find_jump_table(bv, addr): # Collect the branch targets for any tables referenced by the clicked instruction branches = [] for token in tokens: - if token.type == core.BNInstructionTextTokenType.PossibleAddressToken: # Table addresses will be a "possible address" token + if token.type == InstructionTextTokenType.PossibleAddressToken: # Table addresses will be a "possible address" token tbl = token.value print "Found possible table at 0x%x" % tbl i = 0 @@ -79,6 +80,7 @@ def find_jump_table(bv, addr): # Set the indirect branch targets on the jump instruction to be the list of targets discovered func.set_user_indirect_branches(jump_addr, branches) + # Create a plugin command so that the user can right click on an instruction referencing a jump table and # invoke the command -binaryninja.PluginCommand.register_for_address("Process jump table", "Look for jump table destinations", find_jump_table) +PluginCommand.register_for_address("Process jump table", "Look for jump table destinations", find_jump_table) |
