ghidra: initial capa explorer extension MVP #2839
ghidra: initial capa explorer extension MVP #2839vaishakh787 wants to merge 20 commits intomandiant:masterfrom
Conversation
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
There was a problem hiding this comment.
Please add bug fixes, new features, breaking changes and anything else you think is worthwhile mentioning to the master (unreleased) section of CHANGELOG.md. If no CHANGELOG update is needed add the following to the PR description: [x] No CHANGELOG update needed
Summary of ChangesHello @vaishakh787, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request lays the foundational architecture for integrating the capa analysis tool directly into Ghidra as a native extension. It transitions the existing script-based workflow into a more robust, installable plugin, providing a dedicated UI component and a menu action to initiate capa analysis. This MVP focuses on establishing the core framework and communication between Ghidra's Java environment and capa's Python logic, setting the stage for comprehensive feature development. Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request introduces a solid MVP for a capa explorer Ghidra extension. The architecture with a Java Swing UI and a Python backend for analysis is a good approach. My review includes suggestions to clean up some boilerplate code, improve error handling and configuration, and some minor code style points. Specifically, I've pointed out unused template files in the capaexplorer package that should be removed, and suggested improvements for handling Python executable paths and exception logging.
mike-hunhoff
left a comment
There was a problem hiding this comment.
This seems reasonable so far, but we want to utilize PyGhidra to bridge Java and Python. This implementation creates a separate process to run Python. Additionally, the already analyzed Ghidra database (program object) should be passed to capa for analysis, so the initial binary analysis does not need to be completed twice.
| Process process = | ||
| new ProcessBuilder( | ||
| python, | ||
| scriptFile.getAbsolutePath() | ||
| ) | ||
| .redirectErrorStream(true) | ||
| .start(); |
There was a problem hiding this comment.
PyGhidra should serve as the Python <-> Java bridge. Running Python in a separate process doesn't count 🙂
There was a problem hiding this comment.
Thanks for the clarification @mike-hunhoff that makes sense.
You're right: launching Python as a separate process is not the intended model here.
I’ll rework the bridge to use PyGhidra directly for in-process Java ↔ Python execution.
The updated approach will be:
- Use PyGhidra as the execution bridge
- Pass the already-loaded
Programobject into Python - Avoid reloading or reanalyzing the binary
- Reuse the existing Ghidra analysis database for capa
For this draft PR, my goal was to validate extension packaging and UI wiring.
I’ll update the implementation to follow the PyGhidra-based design next.
Thanks for pointing this out — I’ll push an update shortly.
|
Hi @mike-hunhoff , I’ve pushed an update to the draft PR addressing your feedback. The implementation now uses PyGhidra as the Java <-> Python bridge, removes the external Python subprocess, and passes the already-loaded Program object directly into the Python script so the existing analysis database is reused. Please let me know when you have a chance to take another look, and if anything should be adjusted further. |
8a974a8 to
c93b7db
Compare
CHANGELOG updated or no update needed, thanks! 😄
|
Hey @mike-hunhoff , quick update. I switched execution to GhidraScriptService as suggested and now the full flow works: the script runs in PyGhidra, generates the cache, and the plugin loads it successfully. Next, I’ll integrate real Capa JSON output and expand the results model/UI. Let me know if this direction looks good. |
sounds good @vaishakh787 , I look forward to seeing the UI 🙂 |
|
Also @mike-hunhoff wanted to contact you regarding GSoC 2026. How do i reach out to you? |
Review https://github.com/mandiant/flare-gsoc - this explains everything about the program, including preferred methods for contacting potential mentors. |
|
Hey @mike-hunhoff , here's my plan for the UI. I'll replace the current For this iteration, the scope will be:
Everything is built on stable, non-deprecated Ghidra APIs : Does this direction look good before I start coding? |
|
|
Hey @mike-hunhoff , can you check this out and let me know |
Based on these screenshots it looks like you're headed in the right direction! Ideally, the extension mirrors the functionality of the IDA Plugin (minus the rule writing tab). I can't tell from your screenshots, but in terms of UX, all actions should be completed from the extension UI, e.g. starting analysis, configuring rule location, etc., looking something like:
|
|
@mike-hunhoff , can you please check this out?, and please let me know if anything else to be added. Screen.Recording.2026-03-08.at.03.06.42.mov |
That is looking great @vaishakh787 !! A couple of quick comments from watching your screen share:
|
Screen.Recording.2026-03-12.at.01.52.34.movHey @mike-hunhoff , I’ve been working on aligning the Ghidra plugin UI more closely with the capa IDA plugin based on your feedback. Currently updating the feature rendering so matches are displayed using their str representation (e.g. api(CreateFileA), string("cmd.exe")) and ensuring each matched feature has an associated address in the results tree. One issue I’m debugging at the moment is the double-click navigation. The Address column is populated correctly, but double-clicking it is not yet triggering navigation in the Ghidra listing view. The GoToService logic is in place, so I’m currently investigating how the mouse events propagate through the JTreeTable. |
The address column still appears incorrect? Each list feature should have an associated address for navigation. |
|
Hey there! @mike-hunhoff , can you please check this out. Screen.Recording.2026-03-16.at.01.06.54.mov |
Nice! This looks much closer to the existing capa explorer plugin. I did notice the implementation appears to lack statement nesting? e.g. it appears from your recording that all statements versus |
|
Hi @mike-hunhoff , Screen.Recording.2026-03-21.at.18.55.28.movSince the GSoC proposal deadline is approaching, I’d love to get this merged as an MVP so I can reference it in my final application. Please let me know if there are any other refinements you'd like to see! |
Thanks @vaishakh787 . Reviewing your screen capture, I noticed that all of the API feature matches under a basic block have the same address? The address column should contain the address of the individual feature, so the user can navigate to it. Regarding GSoC, don't worry about merging this PR before submitting your application. You've thoroughly demonstrated your abilities throughout our interactions. Simply link this PR in your application and we'll handle the rest. We don't want to rush this PR before it's ready. Let's keep iterating until we have an MVP that meets capa's quality standards. |
Screen.Recording.2026-04-16.at.02.04.57.movHey @mike-hunhoff , If you have any pointers on the expected way to extract or map feature-level locations in this context, that would be really helpful. |




ghidra: Implement a capa explorer plugin as a Ghidra extension #1980
Summary
Hey @mike-hunhoff , This PR introduces an initial MVP implementation of a capa explorer Ghidra extension.
The purpose of this draft PR is to validate the overall architecture and
integration approach before implementing full capa analysis functionality.
This work aims to replace the current script-based Ghidra workflow with a
proper, installable Ghidra extension that mirrors the IDA Pro capa explorer
plugin experience.
Current functionality
This MVP confirms that the extension:
Non-goals for this PR
This PR intentionally does not implement:
These will be implemented incrementally after architectural review.
Design notes
without breaking backward compatibility
Repository layout
capa/ghidra/
├── helpers.py
├── plugin/
│ ├── capa_explorer.py # existing script integration
│ └── extension/ # new Ghidra extension (this PR)
│ ├── Module.manifest
│ ├── extension.properties
│ ├── build.gradle
│ ├── data/
│ │ └── python/
│ └── src/
│ └── main/java/capa/ghidra/
Related to #1980
