Last active
May 17, 2019 16:24
-
-
Save nevermoe/c81c8d6fd94645961beb5692d873b563 to your computer and use it in GitHub Desktop.
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
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