Search code examples
obfuscationsmartassembly

SmartAssembly skipping obfuscation


I was experimenting with SmartAssembly obfuscation tool on a compiled website. It works on most of the code but any class in App_Code is not being obfuscated. e.g. I have following class in App_Code

public class Helper
{
    public Helper()
    {
    }

    public static String GetData()
    {
        String text = DateTime.Now.ToString();
        return text;
    }

    ---Other methods----
}

This Helper class is skipped. It does not do name mangling on Helper class and its methods. Can anybody using SmartAssembly help in this regard? Are there some other cost effective tools (free or paid) better than SmartAssembly.


Solution

    • Disclaimer: I work for RedGate on SmartAssembly *

    SA (SmartAssembly) automatically excludes public members in DLLs from obfuscation and pruning, because it assumes they will be used externally. You can override this behaviour by editing the saproj file to make the obfuscation line look like:

    <Obfuscation ExcludePublicMembers="0" Obfuscate="1">
    

    This will obfuscate all members, regardless of their public status.

    This may cause problems because IIS may use reflection to look for specific public members with specific names. In this case, you will need to exclude those items from pruning/obfuscation.

    As for obfuscation tools, SmartAssembly is quite a powerful obfuscator (hackers agree!), and has a lot of extras in it (error-reporting, feature-usage reporting etc). But, of course, there are a number out there beyond SmartAssembly, e.g. Dotfuscator or Deep Sea Obfuscator. Some are rather good, some are very bad.

    If you've got any more problems, come ask us at: http://www.red-gate.com/products/dotnet-development/smartassembly/support