[Android]APK一键反编译
每次反编译就是件很烦的事情,烦了就开始偷懒。直接写成脚本节省操作。
使用apktool,d2j-dex2jar进行反编译
脚本:reseve-complie-apk.py
1 import os 2 import sys 3 import commands 4 5 6 base_dir="" 7 apktool_path="%s" % base_dir 8 dex2jar_path="../dex2jar-2.0" 9 10 def apktool_d(apk): 11 cmd = 'apktool d %s' % apk 12 print cmd 13 os.system(cmd) 14 pass 15 16 def apktool_b(apkdir): 17 cmd = 'apktool b %s' % apkdir 18 print cmd 19 os.system(cmd) 20 pass 21 22 def dex2jar(apk,apkdir): 23 cmd = "./%s/d2j-dex2jar.sh %s" % (dex2jar_path , apk) 24 print cmd 25 os.system(cmd) 26 cmd = "mv %s-dex2jar.jar %s/%s.jar" % (apkdir,apkdir,apkdir) 27 print cmd 28 os.system(cmd) 29 pass 30 31 def main(): 32 apk = sys.argv[1] 33 print apk 34 apkdir = apk[:-4] 35 print apkdir 36 apktool_d(apk) 37 apktool_b(apkdir) 38 dex2jar(apk, apkdir) 39 pass 40 41 main()
我本地目录信息:
我的操作是:进入到APK下
会生成对应的apk目录,在目录中有转化后的jar包,使用jd_gui查看其中源代码
以上工具的下载:
Apktool:http://ibotpeaches.github.io/Apktool/install/ 最新版本2.0.1
dex2jar: https://github.com/pxb1988/dex2jar 最新版本2.0
JD-GUI: http://jd.benow.ca/ 最新版本1.4.0