当前位置:   article > 正文

直接修改dex破解_classes.dex

classes.dex

直接修改dex破解

一.编写一个简单的验证程序

(1)MainActivity:

      protected void onCreate(BundlesavedInstanceState) {

               super.onCreate(savedInstanceState);

               setContentView(R.layout.activity_main);

               Buttonbutton ;

               finalEditText text1,text2;

               button=(Button)findViewById(R.id.button1);

 //获取两个输入框的数据

                    text1= (EditText)findViewById(R.id.editText1);

               text2=(EditText)findViewById(R.id.editText2);

        button.setOnClickListener(newOnClickListener() {

        @Override

        publicvoid onClick(View v) {

               //TODO Auto-generated method stub

 //对输入框的书进行判断

                 if(text1.getText().toString().equals("CHINA")    &&    text2.getText().toString().equals("302")){

                StringcontentToShow = "Hi,"+text1.getText().toString();

       Toast.makeText(MainActivity.this,contentToShow,Toast.LENGTH_LONG).show();

              }else{

                      StringcontentToShow = "NO."+text1.getText().toString()+"it isincorrect";      
 Toast.makeText(MainActivity.this,contentToShow,Toast.LENGTH_LONG).show();

              }

       }

 });

 }
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46

(2)activity_main.xml

<RelativeLayoutxmlns:android="http://schemas.android.com/apk/res/android"

   xmlns:tools="http://schemas.android.com/tools"

   android:layout_width="match_parent"

   android:layout_height="match_parent"

   android:paddingBottom="@dimen/activity_vertical_margin"

   android:paddingLeft="@dimen/activity_horizontal_margin"

   android:paddingRight="@dimen/activity_horizontal_margin"

   android:paddingTop="@dimen/activity_vertical_margin"

   tools:context="com.example.toast.MainActivity" >



   <Button

        android:id="@+id/button1"

       android:layout_width="wrap_content"

       android:layout_height="wrap_content"

       android:layout_alignLeft="@+id/editText1"

       android:layout_alignParentTop="true"

        android:layout_marginLeft="63dp"

       android:layout_marginTop="204dp"

        android:text="点击" />



   <TextView

        android:id="@+id/textView2"

       android:layout_width="wrap_content"

       android:layout_height="wrap_content"

        android:layout_alignParentTop="true"

       android:layout_marginRight="22dp"

       android:layout_marginTop="44dp"

       android:layout_toLeftOf="@+id/editText1"

        android:text="请输入:" />

   <EditText

        android:id="@+id/editText1"

        android:layout_width="wrap_content"

       android:layout_height="wrap_content"

       android:layout_alignParentRight="true"

       android:layout_alignTop="@+id/textView2"

       android:layout_marginRight="61dp"

        android:ems="10" />

   <TextView

        android:id="@+id/textView1"

       android:layout_width="wrap_content"

       android:layout_height="wrap_content"

       android:layout_alignParentLeft="true"

       android:layout_below="@+id/editText1"

       android:layout_marginTop="65dp"

        android:text="数字密码:" />



   <EditText

        android:id="@+id/editText2"

       android:layout_width="wrap_content"

       android:layout_height="wrap_content"

       android:layout_alignLeft="@+id/editText1"

       android:layout_alignTop="@+id/textView1"

        android:ems="10"

       android:inputType="numberPassword" >

        <requestFocus />

   </EditText>

</RelativeLayout>
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • 60
  • 61
  • 62
  • 63
  • 64
  • 65
  • 66
  • 67
  • 68
  • 69
  • 70
  • 71
  • 72
  • 73
  • 74
  • 75
  • 76
  • 77
  • 78
  • 79
  • 80
  • 81
  • 82
  • 83
  • 84
  • 85
  • 86
  • 87
  • 88
  • 89
  • 90
  • 91
  • 92
  • 93
  • 94
  • 95
  • 96
  • 97
  • 98
  • 99
  • 100
  • 101
  • 102
  • 103
  • 104
  • 105
  • 106
  • 107
  • 108
  • 109
  • 110
  • 111
  • 112
  • 113

二.利用IDAPro及Winhex进行破解

1.解压得到classesdex文件

(1)打开IDAPro,将classes.dex拖放到IDAPro的主窗口,会弹出加载新文件的对话框,IDAPro解析出了该文件属于“Android DEX File”,保持默认的选项

这里写图片描述

(2)跳转到区段

通过第三种方法来判断方法的功能,我们知道low.apk的主类为MainActivity,于是在Export选项卡输入Main,代码会自动重新定位到以Main头所在行。
这里写图片描述
这里写图片描述

(3)找到变量

这里写图片描述

这里写图片描述

这里写图片描述

三、修改变量。

使用Winhe打开classes.dex文件

(1) 将CHINA变量改为DIJOB

这里写图片描述

这里写图片描述

(2) 将密码302改为524

这里写图片描述

四.修复classes.dex文件

用Dexfixer将classes.dex文件checksum值修复
这里写图片描述

五、重新打包为cracked.apk,删除META-INT,并重新签名apk

这里写图片描述
签名成功后得到一个singed.apk的文件
这里写图片描述

六、adb 进行安装测试

安装命令:

Adb installalow_signed.apk
这里写图片描述

七、测试

输入用户名:DIJOB

输入密码:524

成功弹出
这里写图片描述


声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/我家自动化/article/detail/789814
推荐阅读
相关标签
  

闽ICP备14008679号