This is a work in progress, possibly worse than Ghidra's built in emulator and certainly full of issues.
In the future, I'd like to get Unicorn and Capstone installed within Ghidra's jython environment, but for now this script will export a pickle file from Ghidra and then a seperate python3 script will import the data and run unicorn
Copy export_unicorn.py
into your ghidra scripts directory. You should then see UnicornExport
under the tools menu.
Then install dependencies with pip3 install -r requirements.txt
- Open an ARM program in Ghidra
- Run autoanalysis
Export the binary withOpen the script editor and runTools->UnicornExport
export_unicorn.py
- Select a location to the output pickle file to
- Configure your START and END variables in
import_unicorn.py
to control what code you'll run - From an environment with a real Python3 shell, run
import_unicorn.py [path_to_your_generated_pickle_file]
- Modify
import_unicorn.py
'shook_code
function to do useful things