如何根据mapping.txt还原混淆的代码

来源:互联网 发布:php 字符串添加空格 编辑:程序博客网 时间:2024/05/16 02:04

BEFORE
Here’s the stack trace as obfuscated by ProGuard:

Caused by: java.lang.NullPointerExceptionat 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.NullPointerExceptionat 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.

0 0
原创粉丝点击