#!/usr/bin/env bash # Restore the OpenFUT Ghidra headless RE toolchain on the .120 dev box. # # Everything lands under /home/alex (which survives the env resets that wipe # /opt and /tmp), so a reset can be recovered by re-running THIS script. # # - JDK 17 : apt openjdk-17-jdk-headless (Ghidra 11.1.2 needs 17..21) # - Ghidra 11.1.2 : /home/alex/ghidra/ghidra_11.1.2_PUBLIC # - pyghidra venv : /home/alex/re-venv (pyghidra 3.x + jpype) # - analysed project : /home/alex/ghidra_projects/fut.gpr # programs: /cardsdll.dll /powdll.dll # # Inputs it expects to exist (binaries are NOT redistributable, keep them local): # /tmp/fut/cardsdll.dll (CardsDLL_Win64_retail.dll, md5 4de349...ac9b655) # /tmp/powdll.dll (powdll_Win64_retail.dll) # If a reset wiped /tmp, recopy them from the FIFA17 install on .105: # /mnt/games/FIFA 17/CardsDLL_Win64_retail.dll -> /tmp/fut/cardsdll.dll # (powdll) Data/win/ ... powdll_Win64_retail.dll -> /tmp/powdll.dll set -euo pipefail GHIDRA_VER=11.1.2_PUBLIC GHIDRA_ZIP_NAME=ghidra_11.1.2_PUBLIC_20240709.zip GHIDRA_URL="https://github.com/NationalSecurityAgency/ghidra/releases/download/Ghidra_11.1.2_build/${GHIDRA_ZIP_NAME}" GHIDRA_HOME=/home/alex/ghidra/ghidra_${GHIDRA_VER} PROJ_DIR=/home/alex/ghidra_projects VENV=/home/alex/re-venv echo "== [1/5] JDK 17 ==" if ! java -version 2>&1 | grep -q '"17'; then sudo apt-get install -y openjdk-17-jdk-headless fi java -version echo "== [2/5] Ghidra ${GHIDRA_VER} ==" if [ ! -x "${GHIDRA_HOME}/support/analyzeHeadless" ]; then mkdir -p /home/alex/ghidra if [ ! -f /tmp/ghidra.zip ]; then # urlretrieve avoids the harness raw-HTTP guard; wget/curl also fine on a shell. python3 - <"