您的位置:首页 > 其它

Ubuntu下使用dex2jar

2015-08-13 13:06 369 查看
用户指南 :下载dex2jar最新版http://code.google.com/p/dex2jar/downloads/list
解压dex2jar-version.zip文件到一个目录. 比方说 /home/panxiaobo/, C:\unzip -x dex2jar-version.zip -d /home/panxiaobo
使用 dex2jar 来生成 .jar 文件. dex2jar会在工作目录下生成一个someApk-dex2jar.jar文件.   linux sh /home/panxiaobo/dex2jar-version/d2j-dex2jar.sh /home/panxiaobo/someApk.apk
windows C:\dex2jar-version\d2j-dex2jar.bat someApk.apk

使用反编译工具获取查看源代码jd-gui
JAD

就这么简单
命令行提示:

htt@htt-Lenovo-V470c:~/bootmenu/orignal$ cd /home/htt/dex2jar
htt@htt-Lenovo-V470c:~/dex2jar$ sh d2j-dex2jar.sh
convert dex to jar
usage: d2j-dex2jar [options] <file0> [file1 ... fileN]
options:
 -d,--debug-info              translate debug info
 -e,--exception-file <file>   detail exception file, default is
                              $current_dir/[file-name]-error.zip
 -f,--force                   force overwrite
 -h,--help                    Print this help message
 -n,--not-handle-exception    not handle any exception throwed by dex2jar
 -o,--output <out-jar-file>   output .jar file, default is
                              $current_dir/[file-name]-dex2jar.jar
 -os,--optmize-synchronized   optmize-synchronized
 -p,--print-ir                print ir to Syste.out
 -r,--reuse-reg               reuse regiter while generate java .class
                              file
 -s                           same with --topological-sort/-ts
 -ts,--topological-sort       sort block by topological, that will
                              generate more readable code
version: reader-1.13, translator-0.0.9.12, ir-1.10


反编译classes.dex过程如下:
htt@htt-Lenovo-V470c:~/dex2jar$ d2j-dex2jar /home/htt/bootmenu/orignal/classes.dex
d2j-dex2jar: command not found
htt@htt-Lenovo-V470c:~/dex2jar$ sh d2j-dex2jar.sh /home/htt/bootmenu/orignal/classes.dex
dex2jar /home/htt/bootmenu/orignal/classes.dex -> classes-dex2jar.jar
htt@htt-Lenovo-V470c:~/dex2jar$

使用d2j-dex2jar /home/htt/bootmenu/orignal/classes.dex未果,可能要把相关的shell脚本文件和jar文件加入到path中才行,于是使用sh d2j-dex2jar.sh
/home/htt/bootmenu/orignal/classes.dex命令,在dex2jar文件夹下生成了classes-dex2jar.jar文件。

接着全用JD-GUI工具查看jar文件的java原代码。



源地址:http://bujingyun23.blog.163.com/blog/static/181310243201311105012398/
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: