BasePlugin Class
TheBasePlugin class is the base class for all angr Management plugins. Subclass it and override methods to customize behavior.
Class Attributes
Human-readable name for your plugin. If not set, the class name is used.
Whether this plugin requires a workspace (UI mode). Set to
False for headless plugins.List of toolbar buttons to add. Each tuple contains an icon and tooltip.
List of menu items to add to the Plugins menu.
List of column names to add to the functions table.
List of URL action names this plugin handles.
Custom configuration entries for this plugin.
Decompiler optimization passes to register.
Lifecycle Methods
__init__(workspace)
Initialize the plugin. This is where you should:
- Set up instance variables
- Subscribe to object containers
- Register custom containers
- Perform lightweight initialization
The workspace instance. Will be
None if REQUIRE_WORKSPACE = False.teardown()
Clean up when the plugin is deactivated. Unsubscribe from containers and remove UI elements.
Generic Callbacks
status_bar_permanent_widgets()
Yield widgets to add to the right side of the status bar.
Returns: Generator or None
on_workspace_initialized(workspace)
Called right after a workspace is initialized.
The newly initialized workspace.
angrdb_store_entries()
Yield key-value pairs to persist in angrDb when saving the project.
Returns: Generator or None
angrdb_load_entry(key, value)
Called for each entry loaded from angrDb.
The entry key.
The entry value.
UI Callbacks
color_insn(addr, selected, disasm_view)
Return a color for an instruction at the given address.
Instruction address.
Whether the instruction is selected.
The disassembly view instance.
QColor | None
color_block(addr)
Return a color for a basic block at the given address.
Block address.
QColor | None
color_func(func)
Return a color for a function.
The angr Function object.
QColor | None
draw_insn(qinsn, painter)
Custom drawing on an instruction.
The instruction widget.
Qt painter object.
draw_block(qblock, painter)
Custom drawing on a basic block.
The block widget.
Qt painter object.
instrument_disassembly_view(dview)
Add custom widgets or modify the disassembly view.
The disassembly view instance.
instrument_code_view(cview)
Add custom widgets or modify the code (decompiler) view.
The code view instance.
handle_click_insn(qinsn, event)
Handle clicks on instructions.
The clicked instruction widget.
The mouse event.
bool - True if handled, False otherwise
handle_click_block(qblock, event)
Handle clicks on basic blocks.
The clicked block widget.
The mouse event.
bool - True if handled, False otherwise
handle_raise_view(view)
Called when a view is raised (brought to front).
The view that was raised.
handle_click_toolbar(idx)
Handle toolbar button clicks.
Index of the clicked button in
TOOLBAR_BUTTONS.handle_click_menu(idx)
Handle menu button clicks.
Index of the clicked item in
MENU_BUTTONS.extract_func_column(func, idx)
Extract data for custom function table columns.
The function object.
Column index in
FUNC_COLUMNS.tuple[Any, str] - (sortable_data, display_string)
build_context_menu_insn(item)
Build context menu entries for instructions.
The instruction item.
Iterable[None | tuple[str, Callable]] - None for separators, tuples of (text, callback)
build_context_menu_block(item)
Build context menu entries for blocks.
The block item.
Iterable[None | tuple[str, Callable]]
build_context_menu_node(node)
Build context menu entries for graph nodes.
The graph node.
Iterable[None | tuple[str, Callable]]
build_context_menu_functions(funcs)
Build context menu entries for the functions list.
Selected function(s).
Iterable[None | tuple[str, Callable] | tuple[str, list[tuple[str, Callable]]]]
The third form creates a submenu.
build_context_menu_label(addr)
Build context menu entries for labels.
Label address.
Iterable[None | tuple[str, Callable]]
build_qblock_annotations(qblock)
Build custom annotations for blocks.
The block widget.
Iterable[QInstructionAnnotation]
handle_url_action(action, kwargs)
Handle URL actions for this plugin.
The action name from
URL_ACTIONS.Action parameters.
step_callback(simgr)
Called after each step in symbolic execution.
The simulation manager.
Decompiler Callbacks
handle_stack_var_renamed(func, offset, old_name, new_name)
Handle stack variable renaming.
Returns: bool - True if handled
handle_stack_var_retyped(func, offset, old_type, new_type)
Handle stack variable type changes.
Returns: bool - True if handled
handle_func_arg_renamed(func, offset, old_name, new_name)
Handle function argument renaming.
Returns: bool - True if handled
handle_func_arg_retyped(func, offset, old_type, new_type)
Handle function argument type changes.
Returns: bool - True if handled
handle_global_var_renamed(address, old_name, new_name)
Handle global variable renaming.
Returns: bool - True if handled
handle_global_var_retyped(address, old_type, new_type)
Handle global variable type changes.
Returns: bool - True if handled
handle_other_var_renamed(var, old_name, new_name)
Handle other variable renaming.
Returns: bool - True if handled
handle_other_var_retyped(var, old_type, new_type)
Handle other variable type changes.
Returns: bool - True if handled
handle_function_renamed(func, old_name, new_name)
Handle function renaming.
Returns: bool - True if handled
handle_function_retyped(func, old_type, new_type)
Handle function type changes.
Returns: bool - True if handled
handle_comment_changed(address, old_cmt, new_cmt, created, decomp)
Handle comment changes.
Comment address.
Previous comment.
New comment.
Whether this is a new comment.
Whether this is a decompiler comment.
bool - True if handled
handle_struct_changed(old_struct, new_struct)
Handle struct definition changes.
Returns: bool - True if handled
decompile_callback(func)
Called right after a function is decompiled.
The decompiled function.
Project Callbacks
handle_project_save(file_name)
Called when the project is saved.
The save file path.