Un-nest nested types
Transforms nested types into non-nested types. Nested types are often generated by the compiler when you use a lambda expression, anonymous method, an iterator block (yield return
), or an async
method. Unnesting them removes the ability for decompilers to reconstruct these structures.
Before | After |
---|---|
|
|
As with many other algorithms, the decompiled code looks longer, but the actual IL representation is almost exactly the same length as before obfuscation.
The nesting structure of types reveals information about the interconnection between different parts of the code and their relationship to each other. Rummage turns nested types into top-level types wherever possible, thus removing this information and obfuscating the connection between different methods.
Rummage automatically takes care of difficult cases. For example, private or protected methods that become inaccessible after unnesting are called via extra redirect methods, further blurring the code structure:
Before | After |
---|---|
class MyControl : Control { public void Method() { new Inner().Click(this); } |
class MyControl : Control { public void Method() { new Inner().Click(this); } |