-
Notifications
You must be signed in to change notification settings - Fork 9
Set up VM with Ghidra
note: I am not sure if VirtualBox works with the new MacOS cpu (M#) architecture.
- Download and install virtual box from https://www.virtualbox.org/wiki/Downloads. (Note: You may have to allow virtual box some permissions inside of system preferences during installation.)
- Download Ubuntu 20.04.3 LTS 64 bit desktop image (https://releases.ubuntu.com/20.04/).
- Launch Virtual Box
- Click the "New" button in the menu.
- Give it a name like "GhidraUbuntuVM"
- Make sure the type and version are Linux and Ubuntu 64-bit.
- Select the amount of memory to give it. You should select at least 4gb as that is what is required by Ghidra.
- Select "Create a virtual hard drive now" and then choose VDI.
- Select a dynamically allocated drive.
- Select the size of the initial disk. May be able to get by with 10GB; however, (Clay) running VirtualBox on MacOS found this to run out of space quickly and dynamic allocation does did not automatically resize -- see section on Resizing VM Disk, below.
- Your VM should now be created. Select it in the VirtualBox list and click start.
- It should now ask for a virtual optical disk file. Click the folder next to the selection box.
- You should now be in a window with a list of potential ISOs (this list is probably empty). Click the ADD button on the top menu bar.
- Using the folder window, navigate to and select the ubuntu .iso file we downloaded in step 2. Once added, select this from the iso file list and start your VM. At this point, the VM should start and initialize ubuntu.
- When your VM loads and is on the installation window, select install ubuntu.
- Select normal installation and unselect the "download ubuntu updates" option.
- Select erase disk and install ubuntu.
- This should take some time to install and then reboot. Then, you should have a VM with ubuntu on it!
(Clay on MacOS): Found that desktop does not dynamically resize to fit when resizing the window. I first tried:
The above did not resolve the problem, however I suspect completing step 2 (installing the VirtualBox Extension Pack) might have helped in combination with the following:
- Follow the instructions here up to 6:42 -- see if your GParted disk representation looks the same; if not, then check out next video: https://www.youtube.com/watch?v=r_UyKufXR3c
- If by 6:42 in the video above you find your partition information doesn't look the same (e.g., /dev/sda1 is fat32 and there is no "middle" linux swap partition in the partition plot), then try this video (this worked for Clay on MacOS): https://www.youtube.com/watch?v=rC68xA2u7Yw
- Open the Ubuntu terminal
- Install curl via
sudo apt install curl
- In the terminal, run
curl -s "https://get.sdkman.io" | bash - Then run
source "$HOME/.sdkman/bin/sdkman-init.sh" - Finally, install a Java 11 jdk via
sdk install java 11.0.11.j9-adpt
- Make a directory to install ghidra in (I just made it under ~/ghidra) and cd into it
- Download ghidra -- check for latest release. For example, to download 10.0.4 using
curl:
curl -L -o ghidra_10.0.4_PUBLIC_20210928.zip https://github.com/NationalSecurityAgency/ghidra/releases/download/Ghidra_10.0.4_build/ghidra_10.0.4_PUBLIC_20210928.zip
- Inside of the same directory, run
unzip ghidra_9.1.2_PUBLIC_20200212.zip - cd into
ghidra_9.1.2_PUBLIC_20200212and run./ghidraRunto start ghidra.
sudo apt install git
Install the latest Python 3.9
sudo apt update && sudo apt upgrade
sudo apt install python3.9
sudo apt install python3.9-dev # needed to get Python.h in the right place, for, e.g., pygraphviz
Install Python venv
sudo apt install python3.9-venv
NOTE: on kraken, I also had to additionally install the following so that pygraphviz could install:
sudo apt install libgraphviz-dev
If you don't already have a place to store your virtual envs
mkdir ~/.python_venv
Create a Python3.9 virtual environment
python3.9 -m venv ~/.python_venv/<my_env>
Activate venv
source ~/.python_venv/<my_env>/bin/activate
Following instructions here: https://gist.github.com/estorgio/1d679f962e8209f8a9232f7593683265
NOTE: Encountered differences in steps (with VirtualBox 6.1):
- The Guest Additions CD image was already mounted as: /media/claytonm/VBox_GAs_6.1.26
- skipped due to 9
- build-essential already installed (when installing gcc-10.1)
- Continue with this step, but using different path:
sudo /media/claytonm/VBox_GAs_6.1.26/./VBoxLinuxAdditions.run
After this, followed from steps 13 onward
- In step 6 I had named by folder
VirtualBox_shared_folder, so in this step, the command was:sudo mount -t vboxsf VirtualBox_shared_folder ~/shared
Everything beyond 15., including making the mount folder persistent by editing fstab and modules worked!
TODO