CalebFenton / simplify

Android virtual machine and deobfuscator
Other
4.44k stars 438 forks source link

Load classes referenced from other dex or apk file #107

Open axnsan12 opened 6 years ago

axnsan12 commented 6 years ago

Hello and first of all thanks for the great tool!

I would like to know if it's possible to provide a "classpath" of dex/apk/jar files to source classes from.

My use case is:

Looking through the README I couldn't figure out how to handle this.

CalebFenton commented 6 years ago

This would be a good feature, and it's come up a few times before, especially for multi-dex apps.

This could probably best be solved in ClassManager since that abstracts away (almost?) all of the class loading. Instead of holding only one dexfile (via dexlib2), hold multiple and keep some map between class names. There will be some weird edge cases like "what if an app has a hidden dex which is dynamically loaded and tries to redefine a class in the original classes.dex? which class is loaded?" This would require a little research to figure out how dalvikvm handles it. In a pinch, a little warning to the user that smalivm isn't sure which class to use might suffice.

One kinda-crappy work around is to try and manually combine all the code yourself into one dex. Most dex files are usually bloated by libraries which can easily be removed.