anestisb / vdexExtractor

Tool to decompile & extract Android Dex bytecode from Vdex files
Apache License 2.0
1k stars 215 forks source link

Add vdex027 support #72

Open IgorEisberg opened 2 years ago

IgorEisberg commented 2 years ago

Basic support for extracting dex/cdex files from vdex027. Doesn't include support for debugging the new verifier dependencies section, as this is not essential for dex/cdex extraction.

vdex027 introduced many changes, among them: complete removal of QuickeningInfo, BootClassPathChecksumData and ClassLoaderContextData. Structure has been completely changed for extensibility, so all of the methods had to be adapted. As QuickeningInfo is no longer part of the VDEX file, decompilation/unquickening is no longer needed.

Sample files: https://drive.google.com/file/d/1lJ31Rb7_79j_ZItuYEf74Gym59tGmFkH/view?usp=sharing

Official format documentation:

// VDEX files contain extracted DEX files. The VdexFile class maps the file to
// memory and provides tools for accessing its individual sections.
//
// In the description below, D is the number of dex files.
//
// File format:
//   VdexFileHeader    fixed-length header
//   VdexSectionHeader[kNumberOfSections]
//
//   Checksum section
//     VdexChecksum[D]
//
//   Optionally:
//      DexSection
//          DEX[0]                array of the input DEX files
//          DEX[1]
//          ...
//          DEX[D-1]
//
//   VerifierDeps
//      4-byte alignment
//      uint32[D]                  DexFileDeps offsets for each dex file
//      DexFileDeps[D][]           verification dependencies
//        4-byte alignment
//        uint32[class_def_size]     TypeAssignability offsets (kNotVerifiedMarker for a class
//                                        that isn't verified)
//        uint32                     Offset of end of AssignabilityType sets
//        uint8[]                    AssignabilityType sets
//        4-byte alignment
//        uint32                     Number of strings
//        uint32[]                   String data offsets for each string
//        uint8[]                    String data
buihien224 commented 2 years ago

thanks u so much , u save my rom

floydScript commented 9 months ago

u are my god, saved my life

rozhuk-im commented 8 months ago
cc -O2 -pipe -O3 -pipe -funroll-loops -mretpoline -fno-delete-null-pointer-checks  -fstack-protector-strong -fno-strict-aliasing  -fdebug-prefix-map=/tmp/ports/usr/ports/misc/vdexextractor/work/vdexExtractor-78f283b60ab6991fa27eeaff7d7be16409401c08/src=. -c -std=c11 -D_GNU_SOURCE -Wall -Wextra  -DVERSION=\"dev-78f283b60ab6991fa27eeaff7d7be16409401c08\" -c vdex/vdex_decompiler_027.c -o vdex/vdex_decompiler_027.o
vdex/vdex_backend_027.c:30:19: warning: unused function 'POPCOUNT' [-Wunused-function]
static inline int POPCOUNT(uintptr_t x) {
                  ^
1 warning generated.