前往Shuct.Net首页

Shudepb PB反编译专家长时间以来,为业内同类软件事实上的唯一选择.细节,彰显专业.态度,决定品质.

关于反编译的搜索

Apktool在MAC上的使用 - lee0oo0 - 博客园 lee0oo0 博客园 首页 博问 闪存 新随笔 联系 订阅 管理 随笔-317 评论-71 文章-51 trackbacks-0 Apktool在MAC上的使用 http://blog.csdn.net/wirelessqa/article/details/8997168 Android apktool是一个用来处理APK文件的工具,可以对APK进行反编译生成程序的源代码和图片、XML配置、语言资源等文件,也可以添加新的功能到APK文件中。用该工具来汉化Android软件然后重新打包发布是相当简单的。 下载地址:http://code.google.com/p/android-apktool/downloads/list 一.安装操作: 1.下载apktool.jar &mdash; 解压 2.下载Mac上的辅助工具apktool-install-macosx.. &ndash; 解压 3. 将apktool.jar放到apktool-install-macosx..目录下,也就是跟apktool命令放到一起 4.运行sh apktool 运行结果: 01 bixiaopeng@bixiaopengtekiMacBook-Pro ~$ /Users/bixiaopeng/Downloads/apktool-install-macosx-r05-ibot/apktool ; exit; 02 Apktool v1.5.2 - a tool for reengineering Android apk files 03 Copyright 2010 Ryszard Wi?niewski <brut.alll@gmail.com> 04 with smali v1.4.1, and baksmali v1.4.1 05 Updated by @iBotPeaches <connor.tumbleson@gmail.com> 06 Apache License 2.0 (http://www.apache.org/licenses/LICENSE-2.0) 07 08 09 Usage: apktool [-q|--quiet OR -v|--verbose] COMMAND [&hellip;] 10 11 12 COMMANDs are: 13 14 15 d[ecode] [OPTS] <file.apk> [<dir>] 16 Decode <file.apk> to <dir>. 17 18 19 OPTS: 20 21 22 -s, --no-src 23 Do not decode sources. 24 -r, --no-res 25 Do not decode resources. 26 -d, --debug 27 Decode in debug mode. Check project page for more info. 28 -b, --no-debug-info 29 Baksmali -- don't write out debug info (.local, .param, .line, etc.) 30 -f, --force 31 Force delete destination directory. 32 -t <tag>, --frame-tag <tag> 33 Try to use framework files tagged by <tag>. 34 --frame-path <dir> 35 Use the specified directory for framework files 36 --keep-broken-res 37 Use if there was an error and some resources were dropped, e.g.: 38 "Invalid config flags detected. Dropping resources", but you 39 want to decode them anyway, even with errors. You will have to 40 fix them manually before building. 41 42 43 b[uild] [OPTS] [<app_path>] [<out_file>] ----从你给出的本地路径构建一个apk 44 Build an apk from already decoded application located in <app_path>. 45 46 47 It will automatically detect, whether files was changed and perform 48 needed steps only. 49 50 51 If you omit <app_path> then current directory will be used. 52 If you omit <out_file> then <app_path>/dist/<name_of_original.apk> 53 will be used. 54 55 56 OPTS: 57 58 59 -f, --force-all 60 Skip changes detection and build all files. 61 -d, --debug 62 Build in debug mode. Check project page for more info. 63 -a, --aapt 64 Loads aapt from specified location. 65 66 67 if|install-framework <framework.apk> [<tag>] --frame-path [<location>] 68 Install framework file to your system. 69 70 71 For additional info, see: http://code.google.com/p/android-apktool/ 72 For smali/baksmali info, see: http://code.google.com/p/smali/ 二.配置环境变量 (1)先查看$PATH的配置 (2)将上述三个文件复制到/usr/local/bin 下面 (3) 接下来你就可以直接使用apktool了 三.APKTOOL的命令解释 1.反编译APK命令 decode:该命令用于进行反编译apk文件,一般用法为 : apktool d <file.apk> <dir> <file.apk>代表了要反编译的apk文件的路径,最好写绝对路径,比如C:\MusicPlayer.apk <dir>代表了反编译后的文件的存储位置,比如C:\MusicPlayer 如果你给定的<dir>已经存在,那么输入完该命令后会提示你,并且无法执行,需要你重新修改命令加入-f指令 apktool d &ndash;f <file.apk> <dir> 这样就会强行覆盖已经存在的文件 2.编译修改好的文件 build:该命令用于编译修改好的文件,一般用法为: apktool b <dir> 这里的<dir>就是刚才你反编译时输入的<dir>(如C:\MusicPlayer),输入这行命令后,如果一切正常,你会发现C:\MusicPlayer内多了2个文件夹build和dist,其中分别存储着编译过程中逐个编译的文件以及最终打包的apk文件。 3.install-framework 该命令用于为APKTool安装特定的framework-res.apk文件,以方便进行反编译一些与ROM相互依赖的APK文件。具体情况请看常见问题 四.APKTOOL使用实例 4.1 反编译新浪微博的APK 01 bixiaopeng@bixiaopengtekiMacBook-Pro ~$ apktool d /Users/bixiaopeng/Downloads/com.sina.weibo.apk /Users/bixiaopeng/work-folder/OWL-APKTOOL 02 I: Baksmaling&hellip; 03 I: Loading resource table&hellip; 04 I: Loaded. 05 I: Decoding AndroidManifest.xml with resources&hellip; 06 I: Loading resource table from file: /Users/bixiaopeng/Library/apktool/framework/1.apk 07 I: Loaded. 08 I: Regular manifest package&hellip; 09 I: Decoding file-resources&hellip; 10 I: Decoding values */* XMLs&hellip; 11 I: Done. 12 I: Copying assets and libs&hellip; 作者:毕小朋 出处: http://www.wirelessqa.com 欢迎转载或分享,但请务必声明文章出处。如果文章对您有帮助,希望您能推荐或关注。 反编译后的结果: 4.2 重新打包修改后的资源文件 1 bixiaopeng@bixiaopengtekiMacBook-Pro ~$ apktool b /Users/bixiaopeng/work-folder/OWL-APKTOOL 2 I: Checking whether sources has changed&hellip; 3 I: Checking whether resources has changed&hellip; 4 I: Building resources&hellip; 5 I: Building apk file&hellip; 重新打包成功后,在原文件夹下面会多出一个dist文件夹,重新打包的APK就存在下面 4.3 自动签名 将你准备签名的keystore放到当前目录下,运行命令: 1 bixiaopeng@bixiaopengtekiMacBook-Pro dist$ jarsigner -verbose -keystore bxp.keystore -signedjar new.apk com.sina.weibo.apk bxp.keystore 小解其意: 【keystore】:bxp.keystore 【签名后的apk名字】:new.apk 【签名前的apk名字】:com.sina.weibo.apk 【如果您没有keystore或者是不知道keystore密钥库的口令,那么您需要自己做一个,怎么做?跟我来吧!!】 4.4 用命令行创建keystore 1 keytool -genkey -keystore bxp.keystore -keyalg RSA -validity 10000 -alias bxp.keystore 命令参数说明: -genkey 产生证书文件 -keystore 指定密钥库的.keystore文件中 -keyalg 指定密钥的算法 -validity 为证书有效天数,这里我们写的是10000天。 -alias 产生别名 在输入密码时没有回显,只管输入就可以了,一般位数建议使用20位,切忌需要记下来后面还要用, 注意: 1. CN(Common Name &ndash; 名字与姓氏):其实这个&ldquo;名字与姓氏&rdquo;应该是域名,比如说localhost或是blog.devep.net之类的。输成了姓名,和真正运行的时候域名不符,会出问题。浏览器访问时,弹出一个对话框,提示&ldquo;安全证书上的名称无效,或者与站点名称不匹配&rdquo;,用户选择继续还是可以浏览网页。但是用http client写程序访问的时候,会抛出类似于&ldquo;javax.servlet.ServletException: HTTPS hostname wrong: should be &rdquo;的异常。 2. 在用keytool生成数字证书时必须保证:-keystore androidapp.keystore -alias androidapp.keystore 两者名称必须相同。否则下一步签名时会出现错误:jarsigner: 找不到 androidapp.keystore 的证书链。androidapp.keystore 必须引用包含专用密钥和相应的公共密钥证书链的有效密钥库密钥条目。 posted on 2013-08-27 15:46 lee0oo0 阅读(...) 评论(...) 编辑 收藏 刷新评论刷新页面返回顶部 博客园首页博问新闻闪存程序员招聘知识库 Powered by: 博客园 模板提供:沪江博客 Copyright &copy;2014 lee0oo0