APK反编译之一

初步接触APK反编译。刚刚使用android-apktool软件反编译了一下QQ.apk,目的只是想看看QQ这个应用软件是内部是如何设计的,希望可以在某些方面借鉴一下。下面就如何反编译做一个简单的记录(前提是你电脑上的Java环境已经搭建好了,如果没有搭建好请先搭建好后再来看本教程):

1:需要下载的工具有:

apktool-install-windows-r05-ibot.tar.bz2

apktool1.5.2.tar.bz2

这两个工具可以到其官方网站下载,下面是链接地址:

https://code.google.com/p/android-apktool/downloads/list

2:下载完后,进行解压,将解压后的文件全部放在一个文件夹里面,比如我新建一个APK_Tool文件夹用于存放解压后的文件。解压后共有三个文件,如下图所示:

apkDecode

3:Win+R打开DOS,转到APK_Tool文件夹路径,以我的为例,在DOS中输入:

D:\Program Files>cd APK_Tool

D:\Program Files\APK_Tool>apktool.bat

此时将会DOS出现下面的代码时便说明该Bat执行成功。

Microsoft Windows [版本 6.1.7601]

版权所有 (c) 2009 Microsoft Corporation。保留所有权利。



D:\Program Files>cd APK_Tool



D:\Program Files\APK_Tool>apktool.bat



Apktool v1.5.2 - a tool for reengineering Android apk files

Copyright 2010 Ryszard Wi?niewski <[email protected]>

with smali v1.4.1, and baksmali v1.4.1

Updated by @iBotPeaches <[email protected]>

Apache License 2.0 (http://www.apache.org/licenses/LICENSE-2.0)



Usage: apktool [-q|--quiet OR -v|--verbose] COMMAND [...]



COMMANDs are:



    d[ecode] [OPTS] <file.apk> [<dir>]

        Decode <file.apk> to <dir>.



        OPTS:



        -s, --no-src

            Do not decode sources.

        -r, --no-res

            Do not decode resources.

        -d, --debug

            Decode in debug mode. Check project page for more info.

        -b, --no-debug-info

            Baksmali -- don't write out debug info (.local, .param, .line, etc.)



        -f, --force

            Force delete destination directory.

        -t <tag>, --frame-tag <tag>

            Try to use framework files tagged by <tag>.

        --frame-path <dir>

            Use the specified directory for framework files

        --keep-broken-res

            Use if there was an error and some resources were dropped, e.g.:

            "Invalid config flags detected. Dropping resources", but you

            want to decode them anyway, even with errors. You will have to

            fix them manually before building.



    b[uild] [OPTS] [<app_path>] [<out_file>]

        Build an apk from already decoded application located in <app_path>.



        It will automatically detect, whether files was changed and perform

        needed steps only.



        If you omit <app_path> then current directory will be used.

        If you omit <out_file> then <app_path>/dist/<name_of_original.apk>

        will be used.



        OPTS:



        -f, --force-all

            Skip changes detection and build all files.

        -d, --debug

            Build in debug mode. Check project page for more info.

        -a, --aapt

            Loads aapt from specified location.



    if|install-framework <framework.apk> [<tag>] --frame-path [<location>]

        Install framework file to your system.



For additional info, see: http://code.google.com/p/android-apktool/

For smali/baksmali info, see: http://code.google.com/p/smali/







在执行成功后就可以进行APK的反编译了。

具体是这样的:

在DOS中转到APK_Tool的位置,然后输入apktool d 需要反编译的apk的绝对路径

以我的为例,代码如下:

D:\Program Files\APK_Tool>apktool d D:\Downloads\快播\QQ.apk

I: Baksmaling...

I: Loading resource table...

I: Loaded.

I: Decoding AndroidManifest.xml with resources...

I: Loading resource table from file: E:\360data\重要数据\apktool\framework\1.apk



I: Loaded.

I: Regular manifest package...

I: Decoding file-resources...

I: Decoding values */* XMLs...

I: Done.

I: Copying assets and libs...



D:\Program Files\APK_Tool>

转到APK_Tool文件夹,然后输入要反编译的QQ.apk的绝对路径:

D:\Downloads\快播\QQ.apk

完整的格式如下:

D:\Program Files\APK_Tool>apktool d D:\Downloads\快播\QQ.apk

按【Enter】后就静静地等待吧,反编译完成后会自动跳到原始目录,即APK_Tool目录:

D:\Program Files\APK_Tool>

4:大功告成,现在你打开APK_Tool目录,看看,是不是多了一个QQ文件夹,里面就是反编译出来的资源。

 

更多东西,后续加入……

你可能感兴趣的:(apk)