Skip to content

Instantly share code, notes, and snippets.

@psifertex
Created September 4, 2019 21:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save psifertex/600094f554ccb90869f0234fa01e3135 to your computer and use it in GitHub Desktop.
Save psifertex/600094f554ccb90869f0234fa01e3135 to your computer and use it in GitHub Desktop.
inline string annotator for binary ninja
annotation=""
for instruction in current_basic_block.get_disassembly_text():
if instruction.address >= current_selection[0] and instruction.address < current_selection[1]:
address = instruction.address
value = instruction.tokens[-1].value
operand = instruction.tokens[-1].operand
type = IntegerDisplayType.CharacterConstantDisplayType
current_function.set_int_display_type(address, value, operand, type)
annotation += chr(instruction.tokens[-1].value)
log_info("Adding comment for string: %s" % annotation)
current_function.set_comment_at(current_selection[0], annotation)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment