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
ExtendsPlugin - minimal functionality:
Program Plugin
ExtendsProgramPlugin - automatically handles program events:
Plugin Metadata
Use@PluginInfo annotation to describe your plugin:
Status Values
PluginStatus.RELEASED- Production readyPluginStatus.STABLE- Well tested, minor issues possiblePluginStatus.UNSTABLE- Under development, may have bugsPluginStatus.HIDDEN- Not shown in plugin manager
Categories
Defined inPluginCategoryNames:
ANALYSIS- Analysis toolsCODE_VIEWER- Code browser featuresGRAPH- Graph and visualizationBYTE_VIEWER- Binary view componentsDEBUGGER- Debugging toolsEXAMPLES- Example/sample plugins
Creating Actions
Actions add menu items, toolbar buttons, and keybindings:Component Providers
Create dockable windows withComponentProvider:
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
- Right-click project → Debug As → Ghidra
- In Ghidra: File → Configure → Miscellaneous → My Plugin
- Enable plugin and click OK
Export as Extension
- Right-click project → GhidraDev → Export → Ghidra Module Extension
- Configure Gradle path
- Click Finish
- Find extension in
<project>/dist/directory
Install Extension
- In Ghidra: File → Install Extensions…
- Click + (Add Extension)
- Select
.zipfile - 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
- 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
