This is a simple python3 script that uses the Ghidra API to explain highlighted code segments. It is designed to work with the ChatGPT model, but can be used with any model that uses the same format.
- Install Ghidra
- Install Python3
- Install Ghidrathon
- Install pyChatGPT
pip3 install pyChatGPT
- Put this script in your ghidra_scripts folder
- Replace the session_token variable with your own
__Secure-next-auth.session-token
from ChatGPT or replace theapi
variable with a different auth mechanism for pyChatGPT
- Open a program in Ghidra
- Highlight some code
- Run the script
- Wait for the model to generate a response
- Read the response from the console
- Repeat (sometimes the model will generate a response that is not helpful or very short)
- The model will generate a response based on the highlighted code, so it is best to highlight a function or a block of code that is related to the function you are trying to understand.
- Sometimes the script will seem to be stuck. I have no clue why but by hitting "Cancel" once, the script will output the response within seconds.
- Due to Jython shenanigans, I had to do some very ugly hacks to get this to work. I am not proud of this code.
This project is not affiliated with OpenAI in any way. Use at your own risk. I am not responsible for any damage caused by this project. Please read the OpenAI Terms of Service before using this project.