Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Export From Ghidra #21

Open
spatti33 opened this issue Sep 10, 2024 · 4 comments
Open

Export From Ghidra #21

spatti33 opened this issue Sep 10, 2024 · 4 comments

Comments

@spatti33
Copy link

Currently, I am manually analyzing and exporting every program as a .BinExport to then use in my python script. Is there a way to automatically generate these .BinExport files without doing it manually?

@patacca
Copy link
Collaborator

patacca commented Sep 12, 2024

Unfortunately as of right now the python-binexport CLI supports only IDA. In future we might add support for ghidra as well.

Your best solution right now would be to write your own script that does the exporting and launch it with ghidra headless mode.

for example:
/path/to/ghidra/support/analyzeHeadless /path/to/project/ project-name -import /path/to/file.exe -scriptPath /path/to/script/ -postscript your_script.py

and in your_script.py you do the exporting:

from com.google.security.binexport import BinExportExporter
from java.io import File

exporter = BinExportExporter() #Binary BinExport (v2) for BinDiff
exporter.export(File(currentProgram.getName() + ".BinExport"), currentProgram, currentProgram.getMemory(), monitor)

@RobinDavid
Copy link
Collaborator

To complete @patacca anwser. We plan to add it to python-binexport but never had the time to do so.

@spatti33
Copy link
Author

Thank you for the help!

Unfortunately, I am not familiar with the com.google.security package and cant seem to use it. Could you briefly explain how to get that please?

@patacca
Copy link
Collaborator

patacca commented Sep 18, 2024

I guess the problem is that you didn't install the BinExport ghidra plugin. You can download it here https://github.com/google/binexport/releases

Then just run the script in the headless mode like shown above and it should work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants