每次反编译就是件很烦的事情,烦了就开始偷懒。直接写成脚本节省操作。
使用apktool,d2j-dex2jar进行反编译
脚本:reseve-complie-apk.py
import os
import sys
import commands base_dir=""
apktool_path="%s" % base_dir
dex2jar_path="../dex2jar-2.0" def apktool_d(apk):
cmd = 'apktool d %s' % apk
print cmd
os.system(cmd)
pass def apktool_b(apkdir):
cmd = 'apktool b %s' % apkdir
print cmd
os.system(cmd)
pass def dex2jar(apk,apkdir):
cmd = "./%s/d2j-dex2jar.sh %s" % (dex2jar_path , apk)
print cmd
os.system(cmd)
cmd = "mv %s-dex2jar.jar %s/%s.jar" % (apkdir,apkdir,apkdir)
print cmd
os.system(cmd)
pass def main():
apk = sys.argv[1]
print apk
apkdir = apk[:-4]
print apkdir
apktool_d(apk)
apktool_b(apkdir)
dex2jar(apk, apkdir)
pass 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