colorize_disassembly_on_the_fly

summary: colorize lines interactively

description:

This builds upon the ida_kernwin.UI_Hooks.get_lines_rendering_info feature, to provide a quick & easy way to colorize disassembly lines.

Contrary to @colorize_disassembly, the coloring is not persisted in the database, and will therefore be lost after the session.

By triggering the action multiple times, the user can “carousel” across 4 predefined colors (and return to the “no color” state.)

keywords: coloring

see_also: colorize_disassembly

level: advanced

Attributes

ACTION_NAME

ACTION_LABEL

ACTION_SHORTCUT

ACTION_HELP

otf_coloring

Classes

on_the_fly_coloring_hooks_t

carousel_color_ah_t

The action that will be invoked by IDA when the user

Module Contents

class colorize_disassembly_on_the_fly.on_the_fly_coloring_hooks_t

Bases: ida_kernwin.UI_Hooks

AVAILABLE_COLORS
by_widget
get_lines_rendering_info(out, widget, rin)

Called by IDA, at rendering-time.

We’ll look in our set of marked lines, and for those that are found, will produce additional rendering information for IDA to use.

carousel_color(viewer, title)

This performs the work of iterating across the available colors (and the ‘no-color’ state.)

class colorize_disassembly_on_the_fly.carousel_color_ah_t(hooks)

Bases: ida_kernwin.action_handler_t

The action that will be invoked by IDA when the user activates its shortcut.

hooks
activate(ctx)

Activate an action. This function implements the core behavior of an action. It is called when the action is triggered, from a menu, from a popup menu, from the toolbar, or programmatically.

Returns:

non-zero: all IDA windows will be refreshed

update(ctx)

Update an action. This is called when the context of the UI changed, and we need to let the action update some of its properties if needed (label, icon, …) In addition, this lets IDA know whether the action is enabled, and when it should be queried for availability again. Note: This callback is not meant to change anything in the application’s state, except by calling one (or many) of the “update_action_*()” functions on this very action.

colorize_disassembly_on_the_fly.ACTION_NAME = 'example:colorize_disassembly_on_the_fly'
colorize_disassembly_on_the_fly.ACTION_LABEL = 'Pick line color'
colorize_disassembly_on_the_fly.ACTION_SHORTCUT = '!'
colorize_disassembly_on_the_fly.ACTION_HELP = 'Press ! to carousel around available colors (or remove a previously-set color)'
colorize_disassembly_on_the_fly.otf_coloring