# Vdex Extractor
Command line tool to decompile and extract Android Dex bytecode from Vdex files that are generated
along with Oat files when optimizing bytecode from dex2oat ART runtime compiler. Vdex file format
has been introduced in the Oreo (API-26) build. More information is available [here][vdex-cr]. It
should be noted that Oat files are no longer storing the matching Dex files inside their `.rodata`
section. Instead they're always paired with a matching Vdex file.
## Compile
* Clone this repository
* Install Android NDK if you want to cross-compile for Android devices
* Invoke `make.sh` bash script with desired build target
* `$ ./make.sh` - if CC not defined from env use gcc by default
* `$ ./make.sh gcc` - compile with gcc
* `$ ./make.sh clang` - compile with clang
* `$ ./make.sh cross-android` - cross-compile (armeabi-v7a, arm64-v8a, x86 &
x86_64) for Android with NDK
* Executables are copied under the `bin` directory
* For debug builds use `$ DEBUG=true ./make.sh`
## Usage
```
$ bin/vdexExtractor -h
vdexExtractor ver. 0.4.1
Anestis Bechtsoudis <anestis@census-labs.com>
Copyright 2017 - 2018 by CENSUS S.A. All Rights Reserved.
-i, --input=<path> : input dir (search recursively) or single file
-o, --output=<path> : output path (default is same as input)
-f, --file-override : allow output file override if already exists (default: false)
--no-unquicken : disable unquicken bytecode decompiler (don't de-odex)
--deps : dump verified dependencies information
--dis : enable bytecode disassembler
--ignore-crc-error : decompiled Dex CRC errors are ignored (see issue #3)
--new-crc=<path> : text file with extracted Apk or Dex file location checksum(s)
-v, --debug=LEVEL : log level (0 - FATAL ... 4 - DEBUG), default: '3' (INFO)
-l, --log-file=<path>: save disassembler and/or verified dependencies output to log file (default is STDOUT)
-h, --help : this help
```
## Bytecode Unquickening Decompiler
The Vdex file includes all quick_info data (old vtable) required to revert the dex-to-dex
transformations applied during bytecode optimization. The idea here is to create a quick standalone
tool capable to revert optimized bytecode, that does not require building the entire libart from
AOSP.
The Vdex fully unquicken functionality has been also implemented as part of the AOSP oatdump libart
tool. The upstream contribution is available [here][aosp-master]. If you want to use oatdump with
Oreo release you can use the corresponding patch [here][oatdump-oreo] or fork and build (inside and
AOSP_SRC_ROOT workspace) the oreo-release branch of the [oatdump++][oatdump-plus] tool.
## Verified Dependencies Iterator
When the Dex bytecode files are compiled (optimized) for the first time, dex2oat executes the
verification dependencies collector as part of the MethodVerifier The verification dependencies
collector class is used to record resolution outcomes and type assignability tests of
classes/methods/fields defined in the classpath. The compilation driver initializes the class and
registers all Dex files which are being compiled. Classes defined in Dex files outside of this set
(or synthesized classes without associated Dex files) are considered being in the classpath. All
recorded dependencies are stored in the generated Vdex file along with the corresponding Oat file
from the OatWriter class.
vdexExtractor tool integrates a Vdex dependencies walker function that is capable to iterate all
dependencies information and dump them in a human readable format. The following snippet
demonstrates a dependencies dump example of a sample Vdex file.
```
$ bin/vdexExtractor -i /tmp/BasicDreams.vdex -o /tmp --deps -f
[INFO] Processing 1 file(s) from /tmp/BasicDreams.vdex
------- Vdex Deps Info -------
dex file #0
extra strings: number_of_strings=2
0000: 'Ljava/lang/Thread;'
0001: 'Ljava/lang/Throwable;'
assignable type sets: number_of_sets=8
0000: 'Landroid/service/dreams/DreamService;' must be assignable to 'Landroid/content/Context;'
0001: 'Landroid/view/TextureView;' must be assignable to 'Landroid/view/View;'
0002: 'Ljava/nio/FloatBuffer;' must be assignable to 'Ljava/nio/Buffer;'
...
unassignable type sets: number_of_sets=0
class dependencies: number_of_classes=34
0000: 'Landroid/graphics/Color;' 'must' be resolved with access flags '1'
0001: 'Landroid/graphics/SurfaceTexture;' 'must' be resolved with access flags '1'
...
0024: 'Ljavax/microedition/khronos/egl/EGL10;' 'must' be resolved with access flags '513'
...
field dependencies: number_of_fields=4
0000: 'Ljavax/microedition/khronos/egl/EGL10;'->'EGL_DEFAULT_DISPLAY':'Ljava/lang/Object;' is expected to be in class 'Ljavax/microedition/khronos/egl/EGL10;' and have the access flags '9'
0001: 'Ljavax/microedition/khronos/egl/EGL10;'->'EGL_NO_CONTEXT':'Ljavax/microedition/khronos/egl/EGLContext;' is expected to be in class 'Ljavax/microedition/khronos/egl/EGL10;' and have the access flags '9'
0002: 'Ljavax/microedition/khronos/egl/EGL10;'->'EGL_NO_DISPLAY':'Ljavax/microedition/khronos/egl/EGLDisplay;' is expected to be in class 'Ljavax/microedition/khronos/egl/EGL10;' and have the access flags '9'
0003: 'Ljavax/microedition/khronos/egl/EGL10;'->'EGL_NO_SURFACE':'Ljavax/microedition/khronos/egl/EGLSurface;' is expected to be in class 'Ljavax/microedition/khronos/egl/EGL10;' and have the access flags '9'
method dependencies: number_of_methods=84
0000: 'Landroid/graphics/Color;'->'HSVToColor':'([F)I' is expected to be in class 'Landroid/graphics/Color;', have the access flags '9
0001: 'Landroid/opengl/GLES20;'->'glAttachShader':'(II)V' is expected to be in class 'Landroid/opengl/GLES20;', have the access flags '9
0002: 'Landroid/opengl/GLES20;'->'glClear':'(I)V' is expected to be in class 'Landroid/opengl/GLES20;', have the access flags '9
...
unverified classes: number_of_classes=0
----- EOF Vdex Deps Info -----
[INFO] 1 out of 1 Vdex files have been processed
[INFO] 1 Dex files have been extracted in total
[INFO] Extracted Dex files are available in '/tmp'
```
## Integrated Disassembler
To debug the decompiler and assist the Dex bytecode investigation tasks, a light disassembler has
been implemented. The disassembler output is very similar to the one provided by the AOSP dexdump2
utility of the `platform/art` project. The disassembler can be used independently of the
unquickening decompiler.
A sample output is illustrated in the following snippet. Lines prefixed with `[new]` illustrate the
output of the decompiled instruction (previous line) located in that offset. Notice that all the
quickened offsets and vtable references have been reverted back to original signatures and
prototypes.
```
$ bin/vdexExtractor -i /tmp/Videos.vdex -o /tmp -f --dis -l /tmp/dis.log
[INFO] Processing 1 file(s) from /tmp/Videos.vdex
[INFO] 1 out of 1 Vdex files have been processed
[INFO] 2 Dex files have been extracted in total
[INFO] Extracted Dex files are available in '/tmp'
$ head -90 /tmp/dis.log
------ Dex Header Info ------
magic : dex-035
checksum : e14de163 (3779977571)
signature : 9a91f8e5f2afe2c6b5c2b4853832d3c5ed01aef8
fileSize : 8ca638 (9217592)
headerSize : 70 (112)
endianTag : 12345678 (305419896)
linkSize : 0 (0)
linkOff : 0 (0)
mapOff : 8ca568 (9217384)
stringIdsSize: ef06 (61190)
stringIdsOff : 70 (112)
typeIdsSize : 29f4 (10740)
typeIdsOff : 3bc88 (244872)
protoIdsSize : 3df9 (15865)
protoIdsOff : 46458 (287832)
fieldIdsSize : a79d (42909)
fieldIdsOff : 74c04 (478212)
methodIdsSize: fed7 (65239)
methodIdsOff : c88ec (821484)
classDefsSize: 2288 (8840)
classDefsOff : 147fa4 (1343396)
dataSize : 73d594 (7591316)
dataOff : 18d0a4 (1626276)
-----------------------------
file #0: classDefsSize=8840
class #0: a.a ('La$a;')
access=0601 (PUBLIC INTERFACE ABSTRACT)
source_file=SourceFile, class_data_off=851907 (8722695)
sta
没有合适的资源?快使用搜索试试~ 我知道了~
vdexExtractor
共53个文件
h:15个
o:13个
c:13个
5星 · 超过95%的资源 需积分: 50 110 下载量 180 浏览量
2018-08-08
11:30:43
上传
评论 4
收藏 246KB ZIP 举报
温馨提示
个人编译好的一个反编译Vdex文件的vdexExtractor ,如果linux库不全有可能运行不了,进入bin目录vdexExtractor 可执行命令 ./vdexExtractor -i input_vdex_file -o output_dex_file 需要该资源的可以去我博客留言,这个资源积分确实有些坑,改了又会默认改成50 https://blog.csdn.net/peachs885090/article/details/81505342
资源推荐
资源详情
资源评论
收起资源包目录
vdexExtractor.zip (53个子文件)
vdexExtractor-master
make.sh 3KB
src
utils.o 15KB
vdexExtractor.o 10KB
utils.c 10KB
dex.h 7KB
out_writer.h 1KB
log.h 2KB
dex_instruction.c 22KB
dex_instruction_list.h 32KB
vdex.c 3KB
vdexExtractor.c 8KB
common.h 3KB
out_writer.c 4KB
vdex
vdex_backend_010.h 1KB
vdex_010.o 25KB
vdex_010.c 7KB
vdex_common.h 930B
vdex_006.o 25KB
vdex_decompiler_010.o 23KB
vdex_006.h 4KB
vdex_backend_010.o 33KB
vdex_decompiler_006.o 24KB
vdex_backend_006.h 1KB
vdex_decompiler_006.c 7KB
vdex_decompiler_010.h 1KB
vdex_backend_010.c 20KB
vdex_backend_006.o 32KB
vdex_decompiler_006.h 1KB
vdex_006.c 7KB
vdex_010.h 4KB
vdex_decompiler_010.c 7KB
vdex_backend_006.c 19KB
dex_instruction.o 63KB
log.o 7KB
dex_instruction.h 9KB
dex.o 50KB
out_writer.o 5KB
vdex.h 1KB
Makefile 1KB
utils.h 1KB
vdex.o 20KB
vdexExtractor 202KB
dex.c 35KB
log.c 4KB
scripts
extract-apps-from-device.sh 10KB
update-vdex-location-checksums.sh 3KB
LICENSE 11KB
README.md 18KB
jni
Application.mk 810B
Android.mk 1KB
.gitignore 38B
bin
vdexExtractor 202KB
.gitignore 71B
共 53 条
- 1
资源评论
- meiqidodo2019-09-03linux下使用,还不错无风之翼2019-11-06多谢支持
- z11965430472019-08-09比相关书籍介绍的详细,顶一个.无风之翼2019-11-06多谢大伙支持
- zhnabcdaaaa2019-06-03linux下使用 111111
无风之翼
- 粉丝: 86
- 资源: 23
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功