Created
October 28, 2019 05:58
-
-
Save h4z31/d07f6138a026cd8ef25890d4e65cff97 to your computer and use it in GitHub Desktop.
mark xref to specified address with tag feature in binaryninja
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from binaryninja import * | |
class ReferenceMarker(object): | |
def __init__(self, bv): | |
self.bv = bv | |
def xref_to(self, addr): | |
return self.bv.get_code_refs(addr) | |
def mark_all_references_to(self, addr): | |
tt = self.bv.create_tag_type("link to %x" % (addr), "x") | |
for r in self.xref_to(addr): | |
xref_func = r.function | |
xref_addr = r.address | |
xref_func.set_auto_instr_highlight(xref_addr, HighlightStandardColor.YellowHighlightColor) | |
self.bv.create_user_data_tag(xref_addr, tt, xref_func.name) | |
def mark(bv, addr): | |
ReferenceMarker(bv).mark_all_references_to(addr) | |
PluginCommand.register_for_address("marker", "mark and tag all reference to specified addr", mark) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment