asolfre / dex2jar

Automatically exported from code.google.com/p/dex2jar
1 stars 0 forks source link

指令顺序重排项目进展 #198

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
基本思路,通过改造d2j-jarjasmin,按新的顺序生成.j文件,然后�
��d2j-jasmin2jar编译,新生成的.jar文件能让jd-gui正确反编译。
把代码划分为顺序代码C,判断代码P,分支代码S,goto代码G,标�
��代码L等,然后组装到有向图中,然后通过找环,识别各类��
�环,判断,形成新的代码执行顺序,生成.j文件。
目前进展,复合的循环基本解决,但try比较难。
如代码修改前反编译为
  public static void checkPath(String paramString1, String paramString2, String paramString3)
  {
    if (paramString2 == null);
    String[] arrayOfString;
    do
    {
      return;
      arrayOfString = paramString2.split(paramString3);
    }
    while (arrayOfString == null);
    Object localObject = null;
    for (int i = 0; ; ++i)
    {
      if (i < arrayOfString.length);
      label40: if (!arrayOfString[i].equals(""))
        break;
    }
    if (localObject != null);
    for (localObject = localObject + FILE + arrayOfString[i]; ; localObject = FILE + arrayOfString[i])
    {
      File localFile = new File(paramString1 + (String)localObject);
      if (!localFile.exists());
      localFile.mkdir();
      break label40:
    }
  }
修改后可以为:
  public static void checkPath(String paramString1, String paramString2, String paramString3)
  {
    if (paramString2 == null)
      return;
    String[] arrayOfString = paramString2.split(paramString3);
    if (arrayOfString == null)
      return;
    Object localObject = null;
    for (int i = 0; i < arrayOfString.length; ++i)
    {
      if ((!arrayOfString[i].equals("")) || (localObject != null))
        localObject = localObject + FILE + arrayOfString[i];
      else
        localObject = FILE + arrayOfString[i];
      File localFile = new File(paramString1 + (String)localObject);
      if (localFile.exists())
        continue;
      localFile.mkdir();
    }
  }
错误明显减少。

Original issue reported on code.google.com by wz...@sina.com on 28 Oct 2013 at 3:57

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
try-catch 比较难,会被分割,特别是 try-finally 识别有困难

Original comment by iro...@gmail.com on 5 Nov 2013 at 9:00