Skip to content

Instantly share code, notes, and snippets.

@nevermoe
Last active May 17, 2019 16:24
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save nevermoe/c81c8d6fd94645961beb5692d873b563 to your computer and use it in GitHub Desktop.
Save nevermoe/c81c8d6fd94645961beb5692d873b563 to your computer and use it in GitHub Desktop.
import idautils
import idaapi
import idc
LIGHT_BLUE = 0xFFFF00
GREEN = 0x00FF00
WHITE = 0xFFFFFF
for funcea in idautils.Functions():
xor_in_func = 0
bbs_in_func = idaapi.FlowChart(idaapi.get_func(funcea))
for bb in bbs_in_func:
xor_in_bb = 0
for head in idautils.Heads(bb.startEA, bb.endEA):
# clear color first
idc.SetColor(head, CIC_ITEM, WHITE)
if idc.GetMnem(head) == "xor" and idc.GetOpnd(head,0) != idc.GetOpnd(head,1) and idc.GetOpnd(head,1) != 'rsp' and idc.GetOpnd(head,1) != 'rbp':
xor_in_bb += 1
xor_in_func += 1
idc.SetColor(head, CIC_ITEM, BLUE)
if xor_in_bb > 0:
for head in idautils.Heads(bb.startEA, bb.endEA):
color = idc.GetColor(head, CIC_ITEM)
if color != LIGHT_BLUE:
idc.SetColor(head, CIC_ITEM, GREEN)
if xor_in_func > 0:
print idc.GetFunctionName(funcea)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment