ghidra: switch to PyGhidra - #2788
Conversation
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 @mike-hunhoff, 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 significantly refactors the Ghidra integration for capa by switching from the Ghidrathon extension to PyGhidra, Ghidra's official Python 3 binding. This change aims to provide a more robust and streamlined analysis experience, centralizing Ghidra API interactions through a new context management system and simplifying the user workflow by integrating directly into the Highlights
Ignored Files
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 is a significant and well-executed refactoring to switch the Ghidra backend to PyGhidra. This change greatly improves the user experience by allowing capa to be run directly from the command line with Ghidra as a backend, rather than requiring scripts to be executed within the Ghidra environment. The changes are comprehensive, covering application logic, testing, and documentation.
I've identified a few areas for minor improvements related to code style and robustness, such as moving local imports to the module level for better clarity, restoring type hints for maintainability, and using more specific exception handling. Overall, this is an excellent contribution.
CHANGELOG updated or no update needed, thanks! 😄
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
mr-tz
left a comment
There was a problem hiding this comment.
With tests passing (after fixing or xfailing them for now) this looks solid! May want to consult @colton-gabertan as well.
mr-tz
left a comment
There was a problem hiding this comment.
very nice work, I've added a few suggestions and questions for further discussion
* ghidra: init commit switch to PyGhidra * update CHANGELOG and PyGhidra version requirements * Update capa/features/extractors/ghidra/helpers.py Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> * fix black errors * support Ghidra v12 * remove deprecated APIs * refactor outdated code * fix pyinstaller, code refactoring * address PR feedback * add back capa_explorer.py * beef up capa_explorer.py script * refactor README * refactor README * fix mandiant#2747 * add sha256 check for workflows * add sha256 check for workflows * add sha256 check for workflows --------- Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Vibe coding a switch to PyGhidra for the Ghidra backend. PyGhidra is Ghidra's native Python 3 support, so we should use it.