如何根据mapping.txt还原混淆的代码
答案:2 悬赏:40 手机版
解决时间 2021-02-24 17:28
- 提问者网友:眉目添风霜
- 2021-02-23 22:16
如何根据mapping.txt还原混淆的代码
最佳答案
- 五星知识达人网友:渡鹤影
- 2021-02-23 23:51
1.把附件中的retrace_crash.sh、mapping.txt放在SDK\tool\proguard\bin目录下,修改retrace_crash.sh里面的路径,先就这么用,后面优化
retrace_crash.sh 修改此文件中的输出路径
mapping.txt 需要混淆打包过程中去获取
2.把需要分析的文件夹在SDK\tool\proguard\bin下面的crash文件夹下
3.在SDK\tool\proguard\bin目录下运行shell。输入:./retrace_crash.sh
4.如果命令无法运行
先试试chmod +x retrace_crash.sh命令
如果出现 /bin/sh^M: bad interpreter: No such file or directory错误,解决方法如下:
运行 vi retrace_crash.sh 使用命令 :set ff? 如果是dos格式的,那么你可以用set ff=unix把它强制为unix格式的, 然后存盘退
5.retrace_crash.sh 文件内容如下
#!/bin/bash
function ergodic(){
for file in ` ls $1 `
do
if [ -d $1"/"$file ]
then
ergodic $1"/"$file
else
#echo $1"/"$file >> b
./retrace.sh mapping.txt $1"/"$file >> $1"/_"$file
rm $1"/"$file
echo $1"/"$file
fi
done
}
INIT_PATH="/X_DISK/android-sdk-mac/tools/proguard/bin/crash"
ergodic $INIT_PATH
#echo 'hello'
#txt=$(ls crash/*.txt)
#for var in ${txt}
#do
#./retrace.sh mapping.txt ${var} >> parse${var}
#done
retrace_crash.sh 修改此文件中的输出路径
mapping.txt 需要混淆打包过程中去获取
2.把需要分析的文件夹在SDK\tool\proguard\bin下面的crash文件夹下
3.在SDK\tool\proguard\bin目录下运行shell。输入:./retrace_crash.sh
4.如果命令无法运行
先试试chmod +x retrace_crash.sh命令
如果出现 /bin/sh^M: bad interpreter: No such file or directory错误,解决方法如下:
运行 vi retrace_crash.sh 使用命令 :set ff? 如果是dos格式的,那么你可以用set ff=unix把它强制为unix格式的, 然后存盘退
5.retrace_crash.sh 文件内容如下
#!/bin/bash
function ergodic(){
for file in ` ls $1 `
do
if [ -d $1"/"$file ]
then
ergodic $1"/"$file
else
#echo $1"/"$file >> b
./retrace.sh mapping.txt $1"/"$file >> $1"/_"$file
rm $1"/"$file
echo $1"/"$file
fi
done
}
INIT_PATH="/X_DISK/android-sdk-mac/tools/proguard/bin/crash"
ergodic $INIT_PATH
#echo 'hello'
#txt=$(ls crash/*.txt)
#for var in ${txt}
#do
#./retrace.sh mapping.txt ${var} >> parse${var}
#done
全部回答
- 1楼网友:洒脱疯子
- 2021-02-24 01:27
根据mapping.txt还原混淆的代码 before here’s the stack trace as obfuscated by proguard: caused by: java.lang.nullpointerexception at net.simplyadvanced.ltediscovery.be.u(unknown source) at net.simplyadvanced.ltediscovery.at.v(unknown source) at net.simplyadvanced.ltediscovery.at.d(unknown source) at net.simplyadvanced.ltediscovery.av.onreceive(unknown source) after all you need to do is write one line in the command prompt, and the obfuscation will be removed, as you can see here: caused by: java.lang.nullpointerexception at net.simplyadvanced.ltediscovery.utiltelephony.boolean is800mhznetwork()(unknown source) at net.simplyadvanced.ltediscovery.servicedetectlte.void checkandalertuserif800mhzconnected()(unknown source) at net.simplyadvanced.ltediscovery.servicedetectlte.void startlocalbroadcastreceiver()(unknown source) at net.simplyadvanced.ltediscovery.servicedetectlte$2.void onreceive(android.content.context,android.content.intent)(unknown source) how to decode stack trace you can choose either the command line method or gui (graphical user interface) method. how to decode stack trace via gui 1) open <android-sdk>/tools/proguard/bin/proguardgui.bat 2) select the “retrace” option on the left column. 3) add your mapping file and obfuscated stack trace. 4) click “retrace!” thanks to david bilik for mentioning this gui method. how to decode stack trace via command line 1) you will need your proguard’s mapping.txt file and the stack trace (ex: stacktrace.txt) that you want to de-obfuscate. 2) the easiest way to do the next step is copy both these files into your<android_sdk_root>/tools/proguard/bin. 3) if you are on windows, run the following command in the same directory as the files (make sure you change to your own file names): retrace.bat -verbose mapping.txt stacktrace.txt > out.txt 4) out.txt will have the stack trace de-obfuscated. now you can debug much easier and faster than before.
我要举报
如以上回答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
点此我要举报以上问答信息
大家都在看
推荐资讯