def get_lines_rendering_info_ev(self, out, widget, rin): wt = ida_kernwin.get_widget_type(widget) if wt == ida_kernwin.BWN_PSEUDOCODE: vu = ida_hexrays.get_widget_vdui(widget) if vu: cf = vu.cfunc if cf.entry_ea not in self.funcs: return vusync = self.funcs[cf.entry_ea] ea = self.ea if ea in vusync: slist = vusync.get_items(ea) for section_lines in rin.sections_lines: for line in section_lines: lnnum = ida_kernwin.place_t.as_simpleline_place_t(line.at).n for sync_info in slist: ix, iy, ilen = sync_info if lnnum == iy: e = ida_kernwin.line_rendering_output_entry_t(line) e.bg_color = COLOR e.cpx = ix e.nchars = ilen e.flags |= ida_kernwin.LROEF_CPS_RANGE out.entries.push_back(e) return
def _highlight_disassesmbly(self, lines_out, widget, lines_in): """ TODO/XXX this is pretty gross """ ctx = self.get_context(IDA_GLOBAL_CTX) if not ctx.reader: return trail_length = 6 forward_color = self.palette.trail_forward current_color = self.palette.trail_current backward_color = self.palette.trail_backward r, g, b, _ = current_color.getRgb() current_color = 0xFF << 24 | b << 16 | g << 8 | r step_over = False modifiers = QtGui.QGuiApplication.keyboardModifiers() step_over = bool(modifiers & QtCore.Qt.ShiftModifier) #print("Stepping over?", step_over) forward_ips = ctx.reader.get_next_ips(trail_length, step_over) backward_ips = ctx.reader.get_prev_ips(trail_length, step_over) backward_trail, forward_trail = {}, {} trails = [(backward_ips, backward_trail, backward_color), (forward_ips, forward_trail, forward_color)] for addresses, trail, color in trails: for i, address in enumerate(addresses): percent = 1.0 - ((trail_length - i) / trail_length) # convert to bgr r, g, b, _ = color.getRgb() ida_color = b << 16 | g << 8 | r ida_color |= (0xFF - int(0xFF * percent)) << 24 # save the trail color trail[address] = ida_color for section in lines_in.sections_lines: for line in section: address = line.at.toea() if address == ctx.reader.ip: color = current_color elif address in backward_trail: color = backward_trail[address] elif address in forward_trail: color = forward_trail[address] else: continue entry = ida_kernwin.line_rendering_output_entry_t( line, ida_kernwin.LROEF_FULL_LINE, color) lines_out.entries.push_back(entry)
def get_lines_rendering_info(self, out, widget, rin): vu = ida_hexrays.get_widget_vdui(widget) if vu: entry_ea = vu.cfunc.entry_ea for section_lines in rin.sections_lines: for line in section_lines: coord = pseudo_line_t(entry_ea, _place_to_line_number(line.at)) color = self.marked_lines.get(coord, None) if color is not None: e = ida_kernwin.line_rendering_output_entry_t(line) e.bg_color = color out.entries.push_back(e)
def _highlight_lines(self, lines_out, to_paint, lines_in): """ Highlight the IDA viewer line numbers specified in to_paint. """ assert len(lines_in.sections_lines ) == 1, "Simpleviews should only have one section!?" color = ida_kernwin.CK_EXTRA1 if self.model.current_cursor.mapped else 0x400000FF for line in lines_in.sections_lines[0]: splace = ida_kernwin.place_t_as_simpleline_place_t(line.at) if splace.n in to_paint: entry = ida_kernwin.line_rendering_output_entry_t( line, ida_kernwin.LROEF_FULL_LINE, color) lines_out.entries.push_back(entry) to_paint.remove(splace.n) if not to_paint: break
def get_lines_rendering_info(self, out, widget, rin): for section_lines in rin.sections_lines: for line in section_lines: line_ea = line.at.toea() for ea, directives in self.color_info: if ea == line_ea: if not isinstance(directives, list): directives = [directives] for directive in directives: e = ida_kernwin.line_rendering_output_entry_t(line) if isinstance(directive, tuple): color, cpx, nchars = directive e.bg_color = color e.cpx = cpx e.nchars = nchars e.flags |= ida_kernwin.LROEF_CPS_RANGE else: e.bg_color = directive out.entries.push_back(e)