aapt命令的使用

一.背景
1.最初使用aapt是为了做安卓应用的安全性测试。对于普通用户权限的应用我们通常使用的方法是在shell下run-as ,如返回值为run-as: Package ‘’ is not debuggable,我们就认为测试通过。在我们的安卓平台从7.x升为9.x以后,以后我们测试的应用改为系统权限,对于系统权限的app,run-as不再检查是否是debuggable,会显示“package not debuggable”。对此开发建议使用aapt的命令检查应用的安全性。
2.先将安卓应用pull到windows PC端然后使用aapt做安全性测试,具体的命令:
aapt l -a |findstr debuggle

二.aapt使用详解:

aapt是android自动打包工具之一。

环境配置:
aapt一般在android sdk的build-tools中对应文件夹里面,将其路径添加到环境变量中,即可在命令行中直接使用aapt命令;

aapt参数详解
aapt 命令后可直接查看参数详解

aapt l[ist] [-v] [-a] file.{zip,jar,apk}

1.aapt l xxx.apk :查看apk目录

2.aapt l -a xxx.apk:详细列出apk内容;
若内容较多,可保存到本地文件中,如 aapt l -a xxx.apk > xxx.txt

3.aapt l -v xxx.apk : 以table的形式输出目录

1>table的表目有:Length、Method、Size、Ratio、Date、Time、CRC-32、Name。
2>其中Method表示压缩形式,有:Deflate及Stored两种,即该Zip目录采用的算法是压缩模式 or 存储模式。
3>可以看出resources.arsc、*.png采用压缩模式,而其它采用压缩模式。
4>Ratio表示压缩率。CRC-32未明其意,Sodino盼指教。

在这里插入图片描述
4.aapt dump 命令

aapt d[ump] [—values] WHAT file.{apk} [asset[asset …]]

badging-----------Print the label and icon for the app declared in APK
permissions------Print the permissions from the APK
resources---------Print the resource table from the APK
configurations----Print the configurations in the APK
xmltree-------------Print the compiled xmls in the given assets
xmlstrings---------Print the strings of the given compiled xml assets

1.aapt d badging xxx.apk :显示标签、图标和应用程序的相关描述
2.aapt d permissions xxx.apk :显示apk所具有的系统权限
3.aapt d resources xxx.apk :查看apk资源
4.aapt d configurations xxx.apk :查看apk配置
5.aapt d xmltree facebook_googleplay_V1.0.0.apk res/anim-v21/design_bottom_sheet_slide_out.xml :查看xml的树形结构
6.aapt d xmlstrings facebook_googleplay_V1.0.0.apk res/anim-v21/design_bottom_sheet_slide_out.xml :查看xml中所有的string
在这里插入图片描述
dump命令的应用场景举例之查询包名和版本号
在这里插入图片描述

参考文章:https://blog.csdn.net/qq_33912215/article/details/88965571

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值