Skip to main content

Plugin Architecture

Plugins are the primary mechanism for extending Ghidra’s user interface. They can:
  • Add menu items, toolbar buttons, and keyboard shortcuts
  • Create dockable windows (ComponentProviders)
  • Provide services to other plugins
  • Respond to program events (location, selection, highlight)
  • Manage program state and transactions

Plugin Types

Basic Plugin

Extends Plugin - minimal functionality:

Program Plugin

Extends ProgramPlugin - automatically handles program events:

Plugin Metadata

Use @PluginInfo annotation to describe your plugin:

Status Values

  • PluginStatus.RELEASED - Production ready
  • PluginStatus.STABLE - Well tested, minor issues possible
  • PluginStatus.UNSTABLE - Under development, may have bugs
  • PluginStatus.HIDDEN - Not shown in plugin manager

Categories

Defined in PluginCategoryNames:
  • ANALYSIS - Analysis tools
  • CODE_VIEWER - Code browser features
  • GRAPH - Graph and visualization
  • BYTE_VIEWER - Binary view components
  • DEBUGGER - Debugging tools
  • EXAMPLES - Example/sample plugins

Creating Actions

Actions add menu items, toolbar buttons, and keybindings:

Component Providers

Create dockable windows with ComponentProvider:
Integrate provider in plugin:

Using Services

Access functionality from other plugins:

Providing Services

Offer functionality to other plugins:

Program Transactions

Modify programs within transactions:

Event Handling

Domain Object Events

Plugin Events

Options Management

Provide user-configurable options:

Complete Example

Testing Plugins

Run from Eclipse

  1. Right-click project → Debug As → Ghidra
  2. In Ghidra: File → Configure → Miscellaneous → My Plugin
  3. Enable plugin and click OK

Export as Extension

  1. Right-click project → GhidraDev → Export → Ghidra Module Extension
  2. Configure Gradle path
  3. Click Finish
  4. Find extension in <project>/dist/ directory

Install Extension

  1. In Ghidra: File → Install Extensions…
  2. Click + (Add Extension)
  3. Select .zip file
  4. Restart Ghidra

Best Practices

Do:
  • Use transactions for all program modifications
  • Clean up resources in dispose() method
  • Provide meaningful help locations
  • Follow Ghidra naming conventions
  • Make actions context-aware
  • Handle null programs gracefully
Don’t:
  • Modify programs outside transactions
  • Block the UI thread with long operations
  • Forget to remove event listeners
  • Hardcode file paths or system-specific settings

Resources

  • Sample plugins: Ghidra/Extensions/sample/src/main/java/ghidra/examples/
  • Plugin templates: GhidraBuild/Skeleton/src/main/java/skeleton/
  • API docs: Plugin
  • Examples: HelloWorldPlugin.java

Next Steps

Analyzer Development

Build automatic analysis components

Loader Development

Add support for new binary formats