如何将Android DEX(虚拟机字节码)文件反编译成相应的Java源代码?


当前回答

最近Debian有Python包androguard:

Description-en: full Python tool to play with Android files
 Androguard is a full Python tool to play with Android files.
  * DEX, ODEX
  * APK
  * Android's binary xml
  * Android resources
  * Disassemble DEX/ODEX bytecodes
  * Decompiler for DEX/ODEX files

安装相应的软件包:

sudo apt-get install androguard python-networkx

反编译DEX文件:

$ androdd -i classes.dex -o ./dir-for-output

从Apk +反编译中提取classes.dex:

$ androdd -i app.apk -o ./dir-for-output

Apk文件就是Java的JAR文件,你可以通过以下方法从JAR文件中提取文件:

$ unzip app.apk -d ./dir-for-output

其他回答

这可以通过以下五个步骤来完成:

这个gem自动为您完成这些工作,甚至安装所需的工具

将apk文件转换为zip 解压缩文件 从中提取classes.dex 使用dex to jar将classes.dex转换为jar文件 使用jadx GUI打开jar文件作为Java源代码

在使用dex2jar/apktool时,有时会出现坏代码,最明显的是在循环中。为了避免这种情况,可以使用jadx,它可以将dalvik字节码反编译成java源代码,而不需要像dex2jar那样先创建.jar/.class文件(我认为apktool使用dex2jar)。它也是开源的,正在积极开发中。它甚至有一个GUI,专为GUI爱好者设计。试一试!

我建议大家去这里看看: https://github.com/JesusFreke/smali

它提供了BAKSMALI,这是用于DEX文件的最优秀的逆向工程工具。 它是由JesusFreke制作的,他为Android创造了著名的rom。

您可以尝试JADX (https://bitbucket.org/mstrobel/procyon/wiki/Java%20Decompiler),这是一个完美的DEX反编译工具。

是的,它也可以在线(my:0))新网站:http://www.javadecompilers.com/apk/

自从这些答案被发布以来,很多事情都发生了变化。现在有很多简单的GUI工具,比如:

APK Easy Tool for Windows (GUI tool, friendly)
Bytecode Viewer - APK/Java Reverse Engineering Suite
URET Android Reverser Toolkit

找到他们最好的地方是在XDA开发者论坛上。