Created
January 12, 2024 04:07
-
-
Save psifertex/33a0236f70867423b9b5c658269b0144 to your computer and use it in GitHub Desktop.
Open Ghidra with default analysis options
This file contains 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
#!/bin/bash | |
GHIDRAPATH=~/Downloads/ghidra | |
# https://stackoverflow.com/posts/23002317/revisions | |
function abspath() { | |
# generate absolute path from relative path | |
# $1 : relative filename | |
# return : absolute path | |
if [ -d "$1" ]; then | |
# dir | |
(cd "$1"; pwd) | |
elif [ -f "$1" ]; then | |
# file | |
if [[ $1 = /* ]]; then | |
echo "$1" | |
elif [[ $1 == */* ]]; then | |
echo $(cd "${1%/*}"; pwd)/${1##*/} | |
else | |
echo "$(pwd)/$1" | |
fi | |
fi | |
} | |
FILE=$(abspath $1) | |
FILENAME="${FILE##*/}" | |
pushd $GHIDRAPATH | |
./support/analyzeHeadless /tmp tmp -import "$FILE" && ./support/GhidraGo/ghidraGo "ghidra:///tmp//tmp?/$FILENAME" | |
popd |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment