Ghidra is a reverse engineering framework. It is similar to IDA pro and it is a open source project. Ghidra also provide java and python api to write plugin. Actually, its “python” is Jython, and its version is python2.7.
And its site-packages location is /opt/ghidra/Ghidra/Features/Python/data/jython-2.7.1/Lib
. It only supports some uses of basic packages. And I want to use other packages(such as protobuf
) in Ghidra python, I did not find a proper way to install the protobuf
in Ghidra Jython’s site-packages location.
And I find another way to solve it. Firstly, I install protobuf
in my system’s default python2.7.
1 | sudo pip2 install protobuf |
The protobuf
is installed into python2.7 site-packages location. To find the site-packges location, you can open python2.7 and type below:
1 | In [1]: import site |
You can find that there are two folders. Add these folders into Ghidra python’s sys.path
.
In Ghidra python file, add belows at the start of the file:
1 | import sys |