android apk 逆向中常用工具一览

关于apk 逆向中的一些工具的使用,看了不少文章,也使用过有很长一段时间了,今天对此做一总结:

几种文件之间的转换命令:

1. odex -> smali

  java -jar  baksmali.jar  -a <api_level>  -x <odex_file>  -d <framework_dir>

2.smali ->dex

  java -Xmax512M -jar samli-2.0.jar  <smali_dir>   -o classes.dex

3.dex ->odex

  在android平台下使用命令dexopt-wrapper实现:

  dexopt-wrapper 123.apk 123.odex

4.  odex的签名,用于对修改后的odex文件,使用源文件的一部分文件头:

    busybox dd if=android.policy.odex.bak of=android.policy.odex bs=1 count=20 skip=52 seek=52 conv=notrunc

5. apk的签名 使用专门的签名工具:

  java -jar signapk.jar platform.x509.pem platform.pk8 input.apk output.apk

6. Apktools的使用

Apktool 是apk的逆向分析工具,可用于对apk的打包 解包。

APKtool 软件包有 2 个程序组成:apktool.jar 和 aapt  运行 apktools.jar 需要 java 环境(1.6.0 版本以上)。

 apktool.jar 用于解包,apktool.jar 和 aapt.exe 联合用于打包。

frank@ubuntu-troxy:~$ java   -jar  /data/dtgy.package/bin/apktool.jar 

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

Copyright 2010 Ryszard Wi?niewski <brut.alll@gmail.com>

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.

        -f, --force

            Force delete destination directory.

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

            Try to use framework files tagged by <tag>.

        --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.

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

        Install framework file to your system.

java -jar /data/dtgy.package/bin/apktool.jar d -f -s --keep-broken-res $APK_FILE $APK_DIR

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

Apktool工具下载链接:https://code.google.com/p/android-apktool/

相关的工具有:

java -jar AXMLPrinter2.jar AndroidManifest.xml 解开在apk 中的 AndroidManifest.xml

smali 工具  https://code.google.com/p/smali/downloads/list

dexopt-wrapper 源码 https://android.googlesource.com/platform/build/+/donut-release/tools/dexpreopt/dexopt-wrapper/

 

工具下载链接:http://www.kanxue.com/android/decompilers.htm

 

 

     

posted @ 2014-03-01 13:14  夏大王  阅读(2855)  评论(0编辑  收藏  举报