Skip to content

Instantly share code, notes, and snippets.

@asutoshpalai
Created March 4, 2018 04:18
Show Gist options
  • Save asutoshpalai/5d933b219e965f13cfebccacc8edfdcc to your computer and use it in GitHub Desktop.
Save asutoshpalai/5d933b219e965f13cfebccacc8edfdcc to your computer and use it in GitHub Desktop.
Making retdec-idaplugin work with local decompiler on wine

RetDec IDA Pro plugin is not able to work with local RetDec installation as it is not able to first find sh command and after that, the paths provided by the pluigin are Windows system path (Z:*) which can't be understood by the decompiler. These two files fix that.

The first file sh.bat should be located in the PATH (I installed it at C:\windows). The second one (decompiler.sh) should be in /usr/bin on the host system.

#!/bin/sh
# Translate the windows paths to local path
# Not robust but works for the purpose
array=()
for arg in "$@"; do
if [[ "$arg" =~ ^Z:\\* ]]; then
arg=${arg:2} # remove Z:
arg=${arg//\\/\/}
elif [[ "$arg" =~ ^--config=Z:\\* ]]; then
arg="--config=${arg:11}" # remove Z:
arg=${arg//\\/\/}
fi
array+=("$arg")
done
retdec-decompiler.sh "${array[@]}"
REM provides sh command for wine programs (at least works here)
setlocal
SET PATH=%PATH%;/usr/bin
start /unix /bin/sh -c "%* >&2"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment