Add a PyGhidraCustomLoadAnalyzer#677
Merged
Merged
Conversation
added 6 commits
December 10, 2025 13:49
2 tasks
rbs-jacob
requested changes
Dec 16, 2025
Member
rbs-jacob
left a comment
There was a problem hiding this comment.
These changes look good so far! (I know it's still marked "draft.")
Would love to see a test or two to validate that it didn't work before, but does with these changes.
Co-authored-by: Jacob Strieb <99368685+rbs-jacob@users.noreply.github.com>
…nsecurity/ofrak into feature/pyghidra_custom_loader
…onUnpacker to have it run the right PyGhidra analyzer based on the program tag
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
One sentence summary of this PR (This should go in the CHANGELOG!)
Add a PyGhidraCustomLoadAnalyzer to allow loading of custom binary formats in PyGhidra, from MemoryRegions.
Link to Related Issue(s)
None.
Please describe the changes in your request.
With the Ghidra backend we had the
GhidraCustomLoadAnalyzer, so this is a port to the PyGhidra backend:PyGhidraAutoLoadProjectwhich corresponds to the formerPyGhidraProject. IntroducePyGhidraCustomLoadProjectfor binaries that are not in the_GHIDRA_AUTO_LOADABLE_FORMATSlist.PyGhidraAnalysisIdentifiernow checks the_GHIDRA_AUTO_LOADABLE_FORMATSlist to add thePyGhidraAutoLoadProjectorPyGhidraCustomLoadProjecttag depending on the resource.PyGhidraCustomLoadAnalyzerwhich gets the list of MemoryRegions in a program (created by a custom unpacker for example) and passes that to the PyGhidra backend.unpackmethod inpyghidra_analysis.py: when provided with a list ofmemory_regions, it deletes all data in the program, then creates regions according to the list that was passed.Another minor thing I fixed is in
CachedCodeRegionUnpacker, with some binaries, I found that the PyGhidra backend tried to create a few ComplexBlocks outside of the CodeRegion. Instead of raising an alert I turned that into a warning to allow users to continue working with the PyGhidra backend.[edit] I reverted my changes in the
CachedCodeRegionUnpacker. It turned out I had a bug in the PyGhidra components: when running thePyGhidraCodeRegionUnpackerbefore any PyGhidra analysis, it was always running thePyGhidraAutoAnalyzereven if theProgramresource did not have thePyGhidraAutoLoadProjecttag. That resulted in loading the full file in Ghidra (not using thePyGhidraCustomLoadAnalyzer) so the region in PyGhidra was larger than the code region in OFRAK, producingComplexBlocksoutside of theCodeRegion. Now that I fixed thePyGhidraCodeRegionUnpacker, it's all good!Also added a troubleshooting section to the PyGhidra documentation.
Anyone you think should look at this, specifically?
No.