将DEX反编译成Java源代码

本文翻译自:decompiling DEX into Java sourcecode

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


#1楼

参考:https://stackoom.com/question/5FAr/将DEX反编译成Java源代码


#2楼

Once you downloaded your APK file , You need to do the following steps to get a editable java code/document. 下载APK文件后,您需要执行以下步骤以获取可编辑的Java代码/文档。

  1. Convert your apk file to zip (while start your download don't go with "save" option , just go with "save as" and mention your extension as .zip) by doing like this you may avoid APKTOOL... 将您的apk文件转换为zip(开始下载时不要使用“保存”选项,只需使用“另存为”并将您的扩展名称为.zip),这样做可以避免APKTOOL ...
  2. Extract the zip file , there you can find somefilename.dex. 解压缩zip文件,在那里你可以找到somefilename.dex。 so now we need to convert dex -> .class 所以现在我们需要转换dex - > .class
  3. To do that, you need "dex2jar"(you can download it from http://code.google.com/p/dex2jar/ , after extracted, in command prompt you have to mention like, [D:\\dex2jar-0.09>dex2jar somefilename.dex] (Keep in mind that your somefilename.dex must be inside the same folder where you have keep your dex2jar.) 要做到这一点,你需要“dex2jar”(你可以从http://code.google.com/p/dex2jar/下载,解压后,在命令提示符中你必须提到, [D:\\ dex2jar-0.09> dex2jar somefilename.dex] (请记住,somefilename.dex必须位于保存dex2jar的同一文件夹中。)
  4. Download jad from http://www.viralpatel.net/blogs/download/jad/jad.zip and extract it. http://www.viralpatel.net/blogs/download/jad/jad.zip下载jad并解压缩。 Once extracted you can see two files like "jad.exe" and "Readme.txt" (sometimes "jad.txt" may there instead of "jad.exe", so just rename its extension as.exe to run) 提取后你可以看到两个文件,如“jad.exe”和“Readme.txt”(有时候“jad.txt”可能代替“jad.exe”,所以只需将其扩展名as.exe重命名即可运行)
  5. Finally, in command prompt you have to mention like [D:\\jad>jad -sjava yourfilename.class] it will parse your class file into editable java document. 最后,在命令提示符中你必须提到像[D:\\ jad> jad -sjava yourfilename.class]它会将你的类文件解析为可编辑的java文档。

#3楼

I'd actually recommend going here: https://github.com/JesusFreke/smali 我实际上建议你去这里: https//github.com/JesusFreke/smali

It provides BAKSMALI, which is a most excellent reverse-engineering tool for DEX files. 它提供了BAKSMALI,这是DEX文件最优秀的逆向工程工具。 It's made by JesusFreke, the guy who created the fameous ROMs for Android. 它是由JesusFreke制作的,他为Android创造了成名的ROM。


#4楼

With Dedexer , you can disassemble the .dex file into dalvik bytecode ( .ddx ). 使用Dedexer ,您可以将.dex文件反汇编为dalvik字节码( .ddx )。

Decompiling towards Java isn't possible as far as I know. 据我所知,不可能对Java进行反编译。
You can read about dalvik bytecode here . 你可以在这里阅读dalvik字节码。


#5楼

Sometimes you get broken code, when using dex2jar / apktool , most notably in loops. 当使用dex2jar / apktool ,有时你会破坏代码,最明显的是在循环中。 To avoid this, use jadx , which decompiles dalvik bytecode into java source code, without creating a .jar / .class file first as dex2jar does (apktool uses dex2jar I think). 为了避免这种情况,使用jadx ,它将dalvik字节码反编译成java源代码,而不是像dex2jar那样创建.jar / .class文件(我认为apktool使用dex2jar)。 It is also open-source and in active development. 它也是开源和积极的开发。 It even has a GUI, for GUI-fanatics. 它甚至还有一个GUI,用于GUI狂热分子。 Try it! 试试吧!


#6楼

If you're not looking to download dex2jar, then just use the apk_grabber python script to decompile any apk into jar files. 如果你不想下载dex2jar,那么只需使用apk_grabber python脚本将任何apk反编译成jar文件。 Then you read them with jd-gui. 然后你用jd-gui读它们。

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值