2016年4月8日 星期五

如何得知proguard是否成功混淆原始碼

Android由於其代碼是放在dalvik虛擬機上的代碼,所以能夠很容易的將其反編譯為我們可以識別的代碼。所以可以利用dex2jar, JD-GUI工具來查看代碼, 看proguard是否成功混淆原始碼.

方法如下:
首先先找到反組譯的apk檔,請將apk解壓, 產生一個classes.dex的檔案

下載dex2jar
https://sourceforge.net/projects/dex2jar/

執行 d2j-dex2jar.bat "classes.dex", 然後產生了classes_dex2jar.jar

下載JD-GUI
http://jd.benow.ca/

打開classes_dex2jar.jar就可觀看原始碼

如果像以下, 很多內容都變成a b c d....就是proguard成功混淆代碼了

  public static com.docsearcher.index.h a;
  public static File b;
  public static Integer c;
  public static Integer d;
  public static TextApp r = (TextApp)TextApp.a();
  public static int u = -1;
  public static boolean v;
  public static boolean w;
  private com.google.android.gms.ads.h A;
  private TextView B;
  private com.docsearcher.index.f[] C;
  private ImageButton D;
  private ImageButton E;
  private ImageButton F;
  private ImageButton G;
    this.M = paramInt;
    this.f.f = 0.0F;
    System.gc();
    this.k = this.i.a(localObject, this.l);
    this.q = (Integer.toString(this.k.curHit + 1) + "/" + Integer.toString(this.k.maxHit));
    this.o.setText(this.p + ":" + this.q);
    this.f.v = this.k;
    this.g.b = this.k;
    this.f.c = this.k.contentString;
    this.f.d = ((File)localObject).toString();
    this.I.b.getCurrentItem();

proguard的用法請參考

Android Studio 如何使用 Proguard 進行代碼混淆

  © Blogger templates Psi by Ourblogtemplates.com 2008

Back to TOP