Last active
January 25, 2020 20:29
-
-
Save tofarley/aace7cc94910b8b5fc4c97920ee55aa2 to your computer and use it in GitHub Desktop.
ghidra install CentOS 8.1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# the list of users we want to create | |
GHIDRA_DEFAULT_USERS="red,tim,jack" | |
# find our public IP for ghidra | |
# if this is not a public-facing deployment, place the static ip here. | |
HOST_IP=$(curl -s http://whatismyip.akamai.com/) | |
# install our prereqs | |
yum install -y -q curl unzip java-11-openjdk-devel | |
# download ghidra and make it available in /opt/ghidra | |
cd /opt/ | |
curl -s https://ghidra-sre.org/ghidra_9.1.1_PUBLIC_20191218.zip -o ghidra_9.1.1_PUBLIC_20191218.zip | |
unzip -q -o ghidra_9.1.1_PUBLIC_20191218.zip | |
ln -s ghidra_9.1.1_PUBLIC ghidra | |
# configure our paths | |
GHIDRA_HOME=/opt/ghidra | |
# configure our classpath | |
GHIDRA_CLASSPATH="$(sed 's/.*\(${GHIDRA_HOME}\)/\1/g' "${GHIDRA_HOME}/Ghidra/Features/GhidraServer/data/classpath.frag" | sed ':a;N;$!ba;s/\n/:/g'| envsubst )" | |
: ${GHIDRA_REPOSITORIES_PATH:=/srv/repositories} | |
cd /opt/ghidra/server | |
./svrInstall | |
# install automatically starts the server, but it does | |
# not seem to process the users properly... so we'll add them next | |
./ghidraSvr stop | |
# create our users | |
if [ ! -e "${GHIDRA_REPOSITORIES_PATH}/users" ] && [ ! -z "${GHIDRA_DEFAULT_USERS}" ]; then | |
mkdir -p "${GHIDRA_REPOSITORIES_PATH}/~admin" | |
for GHIDRA_DEFAULT_USER in ${GHIDRA_DEFAULT_USERS//,/ }; do | |
echo "Creating user ${GHIDRA_DEFAULT_USER} with default password 'changeme'" | |
./svrAdmin -add ${GHIDRA_DEFAULT_USER} | |
done | |
fi | |
# move parameter 2, the ghidra repository directory, to argument 4 | |
sed -i 's/wrapper.app.parameter.2/wrapper.app.parameter.4/g' server.conf | |
# insert our public ip as argument 2 | |
echo "wrapper.app.parameter.2=-ip ${HOST_IP}" >> server.conf | |
# this option tells the ghidra server to allow users to input their own username | |
echo "wrapper.app.parameter.3=-u" >> server.conf | |
# execute ghidra | |
./ghidraSvr start |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment