- Joined
- May 15, 2017
- Messages
- 982
- Likes
- 760
- Points
- 1,045
![simplify_4.png](https://1.bp.blogspot.com/-xchau4aGWXc/XQq-b3Lzg6I/AAAAAAAAPYo/JgAtreTqh2IaEK0Vtkmwa3KSP5d0mivlwCLcBGAs/s640/simplify_4.png)
Simplify virtually executes an app to understand its behavior and then tries to optimize the code so that it behaves identically but is easier for a human to understand. Each optimization type is simple and generic, so it doesn't matter what the specific type of obfuscation is used.
Before and After
The code on the left is a decompilation of an obfuscated app, and the code on the right has been deobfuscated.
![simplify_5.png](https://1.bp.blogspot.com/-KKhArYRmgCg/XQq-gBwGxaI/AAAAAAAAPYs/Hr5IggHsu9o0GtGbfBGyhJ7scBBLAbFrACLcBGAs/s640/simplify_5.png)
![simplify_4.png](https://1.bp.blogspot.com/-xchau4aGWXc/XQq-b3Lzg6I/AAAAAAAAPYo/L71uf-2Fh18NbefDrVoIdO-sd9ZEl6GcwCEwYBhgL/s640/simplify_4.png)
Overview
There are three parts to the project: smalivm, simplify, and the demo app.
- smalivm: Provides a virtual machine sandbox for executing Dalvik methods. After executing a method, it returns a graph containing all possible register and class values for every execution path. It works even if some values are unknown, such as file and network I/O. For example, any if or switch conditional with an unknown value results in both branches being taken.
- simplify: Analyzes the execution graphs from smalivm and applies optimizations such as constant propagation, dead code removal, unreflection, and some peephole optimizations. These are fairly simple, but when applied together repeatedly, they'll decrypt strings, remove reflection, and greatly simplify code. It does not rename methods and classes.
- demoapp: Contains simple, heavily commented examples for using smalivm in your own project. If you're building something that needs to execute Dalvik code, check it out.