Created
October 21, 2019 15:38
-
-
Save kaedea/595e570f4b51c80df580d86a12eaabb3 to your computer and use it in GitHub Desktop.
Retrace proguard stacktrace by copy-paste
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
# ENV | |
retraceJar=~/retrace/retrace-*.jar | |
# get input | |
mapping=$1 | |
if [ ! "$mapping" ];then | |
read -p "Input mapping file path: " mapping | |
fi | |
if [ ! -f "$mapping" ];then | |
echo "mapping is not file" | |
exit 1 | |
fi | |
input=$2 | |
if [ ! "$input" ];then | |
read -rp 'please input the origin text to retrce. (press CTRL + D to commit): ' -d $'\04' data | |
declare -p data | |
input=$data | |
tempDir=$(mktemp -d) | |
tempFile="$tempDir/temp.txt" | |
echo "write input text to file, path = $tempFile" | |
echo "$input" >> "$tempFile" | |
input=$tempFile | |
fi | |
if [ ! -f "$input" ];then | |
echo "input is not file" | |
exit 1 | |
fi | |
# dump input | |
echo "" | |
echo "args:" | |
echo "mapping: $mapping" | |
echo "retrace text:" | |
echo $input | |
# run retrace | |
function call { | |
cmd=$1 | |
if [ ! "$cmd" ];then | |
echo "cmd is not given" | |
exit 1 | |
fi | |
echo "execute: $cmd" | |
eval $cmd | |
} | |
echo "" | |
call "java -jar $retraceJar $mapping $input" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment