实用脚本
extract-apps-from-device.sh
从连接的Android设备中提取安装包(用户和系统)的ART编译器输出资源(oat、ART、vdex)。还支持提取APK档案的安装包。由于应用了DAC权限,一些系统应用程序数据在没有根访问的情况下可能无法提取。
$ scripts/extract-apps-from-device.sh -h
Usage: extract-apps-from-device.sh [options]
options:
-o|--output : Output directory to save extracted data (default is '.')
-d|--device : Device serial to use instead of default interactive selection
--system-apps : Extract system apps too (default is user apps only)
--apks : Extract apks (default is optimized files only)
-h|--help : This help message
$ scripts/extract-apps-from-device.sh --system-apps -o /tmp/art_data --apks
[INFO]: Enumerating connected Android devices
[INFO]: Trying to extract data from '163' packages
[INFO]: Extracted data stored under '/tmp/art_data'
### update-vdex-location-checksums.sh使用从输入Apk存档文件中提取的CRCs更新Vdex文件位置校验和。有关如何使用该特性欺骗ART和绕过SafetyNet应用程序完整性检查的更多信息,请参阅此处。
$ scripts/update-vdex-location-checksums.sh -h
Usage: update-vdex-location-checksums.sh [options]
options:
-i|--input : Input Vdex file to repair location checksum(s) within
-a|--app : Input Apk file to extract location checksum(s) from
-o|--output : Directory to save updated Vdex file (default is '.')
-h|--help : This help message
### tools/deodex/run.sh帮助工具,以批量方式将(deodex) Vdex资源反编译回标准Dex文件。该工具自动处理CompactDex文件(如Android Pie中介绍的),并使用compact_dex_converter工具(更多信息在这里)转换回StandardDex。由于转换器是作为AOSP源代码的一部分进行编译的,为了方便起见,开发人员维护了一组用于Linux和maacOS的二进制文件。
$ tools/deodex/run.sh -h
Usage: run.sh [options]
options:
-i|--input path> : Directory with Vdex files or single file
-o|--output dir> : Directory to save deodex'ed resources (default is '.')
-k|--keep : Keep intermediate files (default 'false')
-h|--help : This help message
$ tools/deodex/run.sh -i /tmp/vdex_samples -o /tmp/deodexed_samples
[INFO]: Processing 140 input Vdex files
[INFO]: 140 binaries have been successfully deodexed