/Ghidra-ChatGPT

Primary LanguagePythonGNU General Public License v3.0GPL-3.0

Ghidra-ChatGPT

Description

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.

Installation

  1. Install Ghidra
  2. Install Python3
  3. Install Ghidrathon
  4. Install pyChatGPT
    1. pip3 install pyChatGPT
  5. Put this script in your ghidra_scripts folder
  6. Replace the session_token variable with your own __Secure-next-auth.session-token from ChatGPT or replace the api variable with a different auth mechanism for pyChatGPT

Usage

  1. Open a program in Ghidra
  2. Highlight some code
  3. Run the script
  4. Wait for the model to generate a response
  5. Read the response from the console
  6. Repeat (sometimes the model will generate a response that is not helpful or very short)

Notes

  • 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.

Disclaimer

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.

Credits