Skip to content

Instantly share code, notes, and snippets.

@nkaretnikov
Last active February 3, 2020 15:47
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 nkaretnikov/a7893dfa0833ac543dc67e82af6ac900 to your computer and use it in GitHub Desktop.
Save nkaretnikov/a7893dfa0833ac543dc67e82af6ac900 to your computer and use it in GitHub Desktop.
ida_highlight
from idaapi import *
from idc import *
TRACE_FILE = AskFile(0, "*.txt", "Select trace file")
if not TRACE_FILE:
Warning("Failed to select trace file")
else:
HIGHLIGHT = AskLong(0, "Choose action: 0 = clear, 1 = highlight")
if HIGHLIGHT != 0 and HIGHLIGHT != 1:
Warning("Invalid action: {}".format(HIGHLIGHT))
else:
color = 0xff0000 if HIGHLIGHT else 0xffffff
with open(TRACE_FILE) as lines:
for i, line in enumerate(lines):
if i == 0: # skip the header
continue
addr = int(line, 16)
idc.SetColor(addr, idc.CIC_ITEM, color)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment