Anti-compilation on Mac Android apk---apktool, dex2jar, Jd-jui installation use (with manual signature)

Source: Internet
Author: User

The previous article introduced in the Windows platform to use the powerful apk-multi-tool to decompile the APK, modify the Smali source code and then back to the process of compiling the APK, recently by the people's support, cracked an apk, fortunately, the use of the three software are cross-platform, Mac is also properly completed. Here's a record of the things and processes that are used on your Mac.
A total of three software required, in order to facilitate the search for the latest version, the official website also put back:

    1. Apktool:http://ibotpeaches.github.io/apktool/install/Latest Version 2.0.1
    2. Dex2jar:https://github.com/pxb1988/dex2jar Latest Version 2.0
    3. jd-gui:http://jd.benow.ca/Latest Version 1.4.0
      The installation of the three software Apktool a little trouble, others are OK, basically downloaded down to be able to use the decompression.
Installation of Apktool on Mac

1, found in the website link below:

Basically follow the above 6 steps to OK. The first step is to download a shell script, save the name is "Apktool", do not take the. sh suffix. You can copy it to Sublimetext and save it under.
2, download the latest apktool-2, on the BitBucket:

3. Rename the downloaded jar file to "Apktool.jar"
4, put the shell script "Apktool" and "Apktool.jar" in the "/usr/local/bin" directory
5, add these two files executable permissions, chmod a+x file
6, execute the shell apktool is OK.
After the installation is complete, you can run Apktool-v to view version information:

Apktool v2.0.1-a tool for reengineering Android apk fileswith smali v2.0.6 and Baksmali v2.0.6copyright to Ryszard Wi? Niewski <[email protected]>updated by Connor Tumbleson <[email Protected]>usage:apktool-Advance,--Advanced Prints advance information.-version,--version prints the version  then exitsUsage:apktool if|install-framework [Options] <framework.apk>-p,--frame-path <dir> Stores framework files into <dir>.-T,--tag <tag> tag frameworks using <tag>.Usage:apktool D[ecode] [options] <file_apk>-F,--Force  Force Delete destination directory.-o,--output <dir>  The name of folder that gets written. Default is apk.out-p,--frame-path <dir> Uses Framework files located  in <dir>.-r,--no-res   do not decode resources.-s,--no-src   do not decode sources.-T,--frame-tag <tag> Uses framework files tagged by <tag>.Usage:apktool b[uild] [options] <app_path>-F,--force-all Skip changes detection  and build all files.-o,--output <dir>  The name of the apk that gets written. Default is dist/name.apk-p,--frame-path <dir> Uses Framework files located  in <dir>.For additional info, see:http://ibotpeaches.github.io/apktool/for Smali/baksmali info, see:http://code.google.com/p/ smali/
Installation of Dex2jar and Jd-gui

These two are downloaded directly and then decompressed on OK:

Installation of the software is said, the following is the process of cracking. In order to detect whether it can be cracked, we first use Apktool anti-compilation, lest we last empty. (Only Apktool can decompile/compile, our hack is meaningful).
1, create a new apk folder, put the apk you want to decipher, and then go to this directory to run the command: Apktool d hongbao.apk

yanzidemacbook-pro:apk yanzi$ apktool D hongbao.apk I : using  apktool 2.0  .1  on Hongbao.apki : Loading resource table...< Span class= "Hljs-keyword" >i : Decoding androidmanifest.xml with resources ... i : Loading Resource table from file:/users/yanzi/library/apktool/framework/1.  Apki : Regular manifest Package ... i : Decoding file-resources ... i : Decoding values */* xmls ... i : baksmaling classes.dex ... i : Copying assets and Libs ... i : Copying Unknown files ... i : Copying original files ... 

The directory is as follows:

Then run the command back to compile the APK:
Apktool b Hongbao (Hongbao is the anti-compiled folder)

yanzideMacBook-Pro:apk yanzi$ apktool b hongbaoIUsing2.0.1I: Checking whether sources has changed...I: Smaling smali folder into classes.dex...I: Checking whether resources has changed...I: Building resources...I: Building apk file...


The above build and dist is what is generated during the APK process, the compiled apk in the Dist directory, open build/apk folder will find less original folder under the Meta-inf folder:

It means that the apk file in the dist is unsigned and will be discussed later.
2, we want to use Dex2jar to turn the apk into a jar file, in essence, the APK classes.dex into a jar. Add d2j_invoke.sh/d2j-dex2jar.sh in Dex2jar to execute permissions. Then go to dex2jar this folder to run:
./d2j-dex2jar.sh/users/yanzi/apk/hongbao.apk
Get the Hongbao-dex2jar.jar file.
3, open the Jd-gui, will hongbao-dex2jar.jar drag into the source of the see.
By looking at the Java source code comparison Smali file, modified back to compile on OK!

How do I manually add a signature to an APK?

The post-compilation apk is not successfully installed and always prompts
Failure [Install_parse_failed_unexpected_exception]
The substance is not signed.
1, Generate Signature:

-genkey-keystore hongbao.-keyalg-validity10000-alias hongbao

Note: The above-keystore followed by the name of the signature file, and-alias is the alias, generally-keystore behind-alias is the same, but in fact there is no relationship between the two, which is why I deliberately made a different reason.
2. Add signature to APK:

-digestalg-sigalg-tsa-verbose-keystore hongbao.-signedjar hongbao-signed.apk hongbao.apk hongbao

Attention:
1, the last "Hongbao" is-alias back belt, must be consistent.
2, if not with-digestalg Sha1-sigalg Md5withrsa signed APK installation is also unsuccessful, said Install_parse_failed_no_certificates error, If you do not bring-tsa, you will be warned of a time.

The download of the attachments mentioned in the article:

    1. Apktool
    2. Dex2jar
    3. Jd-gui

Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

Anti-compilation on Mac Android apk---apktool, dex2jar, Jd-jui installation use (with manual signature)

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.