APK cracking practices

Source: Internet
Author: User

Recently, I used an online music listening software, which has many good stories for children. However, online music often experiences intermittent disconnection, and the software requires more than 1500 credits to download the entire page. To meet the credit conditions, you need to manually install dozens of recommended applications. Therefore, the attack is decided.


If the name of apkis mytest.apk, perform the following steps:


Step 1: Obtain the resource and smali files. 1) Get the apktool

Download the following packages at http://code.google.com/p/android-apktool/: apktool-1.0.0.tar.bz2and apktool-install-windows-2.20.r01-1.zip. Decompress the two downloaded files. The package named aapt.exe is obtained after apktool-install-windows-2.20.r01-1.zip.
And apktool.bat.((to copy A. jar file decompressed by apktool-1.0.0.tar.bz2)

2) In the doscommand window, enter the folder where apktool. bat is located.

D: \ Android \ tool \ apktool d c: \ mytest.apk c: \ out

Command Line explanation: the file output folder to be decompiled by apktool d

Note: files to be decompiled must be placed in the root directory of drive C,

3) Open the c: \ out folder to get various resources.

Step 2: Obtain the Java file method:

1. Unzip the APK file to .zip and extract the class. Dex file.

2) install the tool dex2jar that decompile the DEX file into a jar file. Http://code.google.com/p/dex2jar/downloads/list

3) Copy class. Dex to the directory where dex2jar. bat is located.
4) generate the JAR file classes. Dex. dex2jar. Jar

dex2jar.bat classes.dex

5) install the tool that decompile jar into Java. (JD-GUI) http://java.decompiler.free.fr /? Q = jdgui

6) run the JD-GUI tool, open the jar file above

7), file-> Save all sources will generate the Java source code file to C: \ out

Method B (TBV ):

1). Get dexdump from the out directory.

2). ADB shell dexdump-D-f-h/data/Dalvik-Cache/data@app@mytest.apk @ classes. Dex> Twitpic. Text

Step 3: crack source code 1). Find the location

Because this software requires more than 1500 credits before downloading, open the Java file, search for 1500 and found that three files are defined, playactivity $12. java, CFG. java, scoredialog $5. java.

Playactivity $12. Java

Final class playactivity $12 implements runnable {public void run () {... int I = 1500; Int J; cfg. is_withad = J; If (J! = 0) {If (this. val $ arg1> = I) // It seems to be the display ad threshold control value break label91; Boolean bool2 = cfg. hidden_guanggao; label35: Boolean bool3 ;//??? Cfg. hidden_guanggao = bool3; cfg. savebool ("hiddenguanggao", bool3 );}

Scoredialog $5. Java

Final class scoredialog $5 implements runnable {public void run () {object localobject1 = NULL; int I = 17301659; Int J = 1500; // score... If (localprogressdialog! = NULL) if (this. Val $ arg1 <j) // you can guess one of the defined scores. If not, a dialog box {scoredialog localscoredialog1 = This. This $0 is displayed;

Cfg. Java

Public class CFG {... public static final int hidden_guanggao_need_score = 1500; // It seems to be the threshold value for displaying ads or not

Playactivity $12. Java

Final class playactivity $12 implements runnable {public void run () {Boolean bool1 = true; dialoginterface. onclicklistener localonclicklistener1 = NULL; int I = 1500; but hidden_guanggao_need_score is not applied to any other files, but this value is always changed for the sake of security.

2) Change the smali File
The smali file only changes the suffix of the Java file to. smali, so you can find the smali file corresponding to the above three files.
Cfg. smali

. Field public static final hidden_guanggao_need_score: I = 0x5dc // change it to 0x0.

Playactivity $12. smali

. Method public run () v. locals 6. prologue const/4 V2, 0x1 const/4 V4, 0x0 const/16 V3, 0x5dc // change here to 0x0

Scoredialog $5. smali

. Method public run () v. locals 10. prologue const/4 V7, 0x0 const V5, 0x108009b // corresponding to 17301659 const/16 V6, 0x5dc // change here to 0x0
Step 4 re-package the decompiled file into an APK file out.apk
apktool b c:\out out_raw.apk

Step 5: sign the generated APK:

1) Prepare tools

If JDK is not installed, download jdkhttp: // JDK from the official website of sun.

2) Prepare the signature file

"C:\Program Files\Java\jdk1.6.0_24\bin\keytool" -genkey -alias wendy.keystore -keyalg RSA -validity 20000 -keystore wendy.keystore

Note that the password is 6-digit, for example, 123456.

3) Signature

"C:\Program Files\Java\jdk1.6.0_24\bin\jarsigner" -verbose -keystore wendy.keystore -signedjar out.apk out_raw.apk wendy.keystore

In this case, you need to enter the 2nd step of the password 123456. after the execution is complete, you can generate the APK file out.apk.

After the installation, it was found that the original restriction was cracked and everything was successful.

Ref:

1. apktool1, an APK decompilation Tool

2. decompile APK

3. decompile the android APK File

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.