Example #1
0
 def colorize_node(self, ea, color):
     # Colorizes an entire code block
     func = idaapi.get_func(ea)
     if func:
         for block in idaapi.FlowChart(func):
             if block.startEA <= ea and block.endEA > ea:
                 ea = block.startEA
                 while ea < block.endEA:
                     idaapi.set_item_color(ea, color)
                     ea = idc.NextHead(ea)
                 break
Example #2
0
    def cb_curline(self, ea):
        if self.prev_loc:
            prev_ea, prev_color = self.prev_loc
            cur_color = idaapi.get_item_color(prev_ea)
            # race condition: block/instruction's color may have been modified
            # after it was saved
            if (cur_color != prev_color) and (cur_color != COL_CURLINE):
                prev_color = cur_color
            idaapi.set_item_color(prev_ea, prev_color)

        self.prev_loc = [ea, idaapi.get_item_color(ea)]
        idaapi.set_item_color(ea, COL_CURLINE)
def color(ea, nbins, c):
    '''Color 'nbins' instructions starting from ea'''
    colors = defaultdict(int, {
            'black' : 0x000000,
            'red' : 0x0000FF,
            'blue' : 0xFF0000,
            'green' : 0x00FF00
        }
    )
    for _ in range(nbins):
        idaapi.del_item_color(ea)
        idaapi.set_item_color(ea, colors[c])
        ea += idc.ItemSize(ea)
Example #4
0
 def cb_restore_last_line(self):
     if self.prev_loc:
         ea, col = self.prev_loc
         idaapi.set_item_color(ea, col)
Example #5
0
 def cb_color(self, ea):
     idaapi.set_item_color(ea, COL_CBTRACE)
def colorize(addr, color):
	idaapi.set_item_color(addr, color)
Example #7
-1
 def highlight(self, color=COLOR):
     for ea in idautils.Heads():
         if idaapi.isCode(idaapi.getFlags(ea)) and idaapi.is_call_insn(ea):
             current_color = idaapi.get_item_color(ea)
             if current_color == self.COLOR:
                 idaapi.set_item_color(ea, idc.DEFCOLOR)
             elif current_color == idc.DEFCOLOR:
                 idaapi.set_item_color(ea, self.COLOR)