This is a project I'm writing purely for educational purposes.
- Parse DEX file (I'm aware of
dexparseranddexcrates, but I want to do it myself to better understand DEX file structure) - Be able to interpret simple DEX file (
hello.dexintests/vm/hello.dex, compiled fromtests/interpreter/hello.smali) - Add more tests for DEX file parser.
- Fix endianness support in DEX file parser. (currently it's only partial).
- Memory allocations?
- Garbage collection?
- JIT?
- AOT?
- JNI?
- Debugging?
- Something else I'm currently not aware of 😀
- MacOS / Linux
- Proguard (
brew install proguardon MacOS) - Android SDK (required for
d8) ANDROID_HOMEorANDROID_SDK_ROOTenvironment variable pointing to Android SDK directory
src/dex/raw_dex_file.rs- raw DEX file parser. It parses DEX file to a struct which is almost a 1:1 representation of DEX file structure.src/dex/dex_file.rs- DEX file parser. It uses raw dex file parser result to construct full in-memory representation of all parts of DEX file.
As a first step I wanted to write a smali interpreter before writing an actual DEX interpreter. However, my current Rust skills are not enough to make it work (lifetimes are evil 😰), so now this pars of VM is abandoned. Maybe in the future I will add support for direct smali interpretation. It should not be that hard, I will just need to parse Smali code to some intermediate representation shared with DEX file parser and then interpret it.
src/gen/smali- smali parser generated byantlr4rustofficial Smali grammar. I'm not going to use it for now.src/smali/ast- smali AST parser which I wanted to use for better Smali code representation (antlr4rustone is quite inconvenient).