android 反编译和代码解读

二 错误代码还原规则

if…else 语句:

反编译代码

if (paramBoolean)
        paramTextView.setTextColor(-16727809);
       while (true)
       {
         return;
         paramTextView.setTextColor(-1315861);
       }
 还原后
      if (paramBoolean)
         {
           paramTextView.setTextColor(-16727809);
         }
         else
         {
            paramTextView.setTextColor(-1315861);
         }  
会把if ..esle 反编译成 if …while(true)结构.
反编译代码
 if (paramInt1 != 1)
        break label185;
      if (this.countChild_1 == null)
      {
        this.countChild_1 = new PokerCountChild(this.mContext);
        this.countChild_1 = new PokerCountChild(this.mContext);
        this.countChild_1.setPosition((int)(0.83D * BaseGameActivity.screenWidth
 - this.countChild_1.getWidth()), (int)(0.2D * BaseGameActivity.screenHeight));
        this.countChild_1.setCount(paramInt2);
        addOneChild(this.countChild_1);
        if (paramInt2 == 0)
          this.countChild_1.setAlpha(0);
      }
      this.countChild_1.setCount(paramInt2);
    }
    label185:
    do
      return;
    while (paramInt1 != 2);
    if (this.countChild_2 == null)
    {
      this.countChild_2 = new PokerCountChild(this.mContext);
      this.countChild_2 = new PokerCountChild(this.mContext);
      this.countChild_2.setPosition((int)(0.17D * BaseGameActivity.screenWidth),
 (int)(0.2D * BaseGameActivity.screenHeight));
      this.countChild_2.setCount(paramInt2);
      addOneChild(this.countChild_2);
      if (paramInt2 == 0)
        this.countChild_2.setAlpha(0);
    }
    this.countChild_2.setCount(paramInt2);
还原
 if(i == 1)
            {
                if(countChild_1 == null)
                {
                    countChild_1 = new PokerCountChild(mContext);
                    countChild_1 = new PokerCountChild(mContext);
                    countChild_1.setPosition((int)(0.83D * 
(double)BaseGameActivity.screenWidth - (double)countChild_1.getWidth()), 
(int)(0.2D * (double)BaseGameActivity.screenHeight));
                    countChild_1.setCount(j);
                    addOneChild(countChild_1);
                    if(j == 0)
                        countChild_1.setAlpha(0);
                }
                countChild_1.setCount(j);
            } else
            if(i == 2)
            {
                if(countChild_2 == null)
                {
                    countChild_2 = new PokerCountChild(mContext);
                    countChild_2 = new PokerCountChild(mContext);
                    countChild_2.setPosition((int)(0.17D * 
(double)BaseGameActivity.screenWidth), (int)(0.2D *
 (double)BaseGameActivity.screenHeight));
                    countChild_2.setCount(j);
                    addOneChild(countChild_2);
                    if(j == 0)
                        countChild_2.setAlpha(0);
                }
                countChild_2.setCount(j);
                return;
            }
会将语句倒序,出现break label结构
 

反编译代码
 
jd-gui有时会将whilei语句翻译成if,此处要将if改成while

switch语句

反编译代码

   switch (this.mBand)
    {
     default:
     case 0:
     case 1:
     case 2:
    }
    while (true)
    {
      return;
      this.mBand.setText("FM1");
      continue;
      this.mBand.setText("FM2");
      continue;
      this.mBand.setText("AM");
    }
还原
switch (mBand)
    {
     case 0:
      mBand.setText("FM1");
      break;
     case 1:
       mBand.setText("FM2");
       break;
     case 2:
       mBand.setText("AM");
       break;
     default:
    }

switch规则就是一个continue对应一个case.要注意是是要外层的continue才算数,在if里的continue不算

enum枚举
 
还原

jd-gui
http://www.qiaodiqiu.com/how-to-read-java-confusion-after-the-anti-compiled-code.html
http://blog.csdn.net/xyz_fly/article/details/8014455
http://blog.csdn.net/hp_2008/article/details/8626010

jad
http://blog.csdn.net/z3h/article/details/2515287
http://blog.csdn.net/z3h/article/details/2640522

时间: 2024-08-21 08:55:03

android 反编译和代码解读的相关文章

android反编译odex文件

关于android的反编译工具,相信大家并不陌生 如APK-TOOL,dex2jar APK-TOOL 用于反编译出布局文件 下载地址http://code.google.com/p/android-apktool/downloads/list dex2jar 用于将dex反编译成.jar包 下载地址:http://code.google.com/p/dex2jar/downloads/list 生成的jar包可用jd-gui来查看(前提是代码未被混淆) 但是如果我们从rom里面提取出的apk是

Android反编译(三)之重签名

Android反编译(三) 之重签名 [目录] 1.原理 2.工具与准备工作 3.操作步骤 4.装X技巧 5.问题 1.原理 1).APK签名的要点 a.所有的应用程序都必须有数字证书 ,Android系统不会安装一个没有数字证书的应用程序: b.Android程序包使用的数字证书可以是自签名的,不需要一个权威的数字证书机构签名认证: c.数字证书都是存在有效期的,Android只是在应用程序安装的时候才会检查证书的有效期.如果程序已经安装在系统中,即使证书过期也不会影响程序的正常功能. d.A

Android反编译工具介绍与简单实用方法

Android反编译工具介绍与简单实用方法 Android反编译的目的无非就是为了看到APK的xml.资源和代码: 得到代码的方式:直接解压APK文件 --> 得到classes.dex文件 --> 使用 dex2jar classes.dex classes.jar生成jar文件 --> [可选的解压jar文件] -->使用XJad或者JDCompiler查看源代码 得到XML的方式: 方式1:直接解压APK文件 --> 通过axmlprinter工具查看XML文件(这种方

Android反编译和二次打包实战

作为Android开发者,工作中少不了要反编译别人的apk,当然主要目的还是为了学习到更多,取彼之长,补己之短.今天就来总结一下Android反编译和二次打包的一些知识.首先声明本文的目的是为了通过例子讲解反编译和二次打包的原理和方法,继而作为后续讲解防止二次打包和App安全的依据,并不是鼓励大家去重新打包别人的App,盗取他人劳动成果. 本文首先介绍几种Android反编译工具的使用,然后实现在不需要知道源代码的情况下,仅通过修改反编译得到的smali文件实现修改apk逻辑功能的目的. And

apk应用的反编译和源代码的生成

对于反编译一直持有无所谓有或无的态度.经过昨天一下午的尝试,也有了点心得和体会: 先给大家看看编译的过程和我们反编译的过程概图吧: 例如以下是反编译工具的根文件夹结构: 三个目录也实际上是下面三个步骤的体现: (不知道大家发现没,我把三个文件夹名字都改了一下,apktool即为处理apk的工具:dex2jar即就是将dex文件处理为jar包的工具.jar2gui即就是我们将jar包内的class转换为源代码的gui界面以供大家參考的工具) setp 1: 在apktool里: 打开dos框(cm

Android反编译

在学习Android开发的过程你,你往往会去借鉴别人的应用是怎么开发的,那些漂亮的动画和精致的布局可能会让你爱不释手,作为一个开发者,你可能会很想知道这些效果界面是怎么去实现的,这时,你便可以对改应用的APK进行反编译查看.下面是我参考了一些文章后简单的教程详解. (注:反编译不是让各位开发者去对一个应用破解搞重装什么的,主要目的是为了促进开发者学习,借鉴好的代码,提升自我开发水平.) 测试环境: win 7 使用工具: CSDN上下载地址: apktool (资源文件获取)  下载      

Android反编译-逆天的反编译

Jar包的反编译: Java的世界是透明的,当编译java程序的时候,是将java源文件转成.class文件,java虚拟机去执行这些字节码从而得到执行java程序的目的.那么从.class文件能不能得到java源文件呢?答案是肯定的!如今就为大家推荐一款神器jd-gui.exe,界面例如以下图: 它能将.class文件转成java文件,就能看到源代码了!想copy代码的.想汉化的.想盗版的.想学习人家源代码的统统没问题!我们经常见到java中的jar包,通过这个工具能看到jar包中的详细实现,

谈谈android反编译和防止反编译的方法(转)

谈谈android反编译和防止反编译的方法(转) android基于java的,而java反编译工具很强悍,所以对正常apk应用程序基本上可以做到100%反编译还原. 因此开发人员如果不准备开源自己的项目就需要知道怎样防止反编译和反编译他人的项目来学习. 2.3版本以上在eclipse自动生成的default.properties文件中加上一句“proguard.config=proguard.cfg”可以对代码进行混淆,反编译后是很难看懂的. 2.3之前的SDK版本也没关系,把上面的progu

转 谈谈android反编译和防止反编译的方法

谈谈android反编译和防止反编译的方法 android基于java的,而java反编译工具很强悍,所以对正常apk应用程序基本上可以做到100%反编译还原. 因此开发人员如果不准备开源自己的项目就需要知道怎样防止反编译和反编译他人的项目来学习. 2.3版本以上在eclipse自动生成的default.properties文件中加上一句“proguard.config=proguard.cfg”可以对代码进行混淆,反编译后是很难看懂的. 2.3之前的SDK版本也没关系,把上面的proguard