Obfuscation problem

.NET obfuscator and automated error reporting

Moderators: Luke Jefferson, Alex.Davies, melvyn.harbour

Obfuscation problem

Postby sergey » Thu Dec 02, 2010 12:46 pm

Hi guys,

I am using SmartAssembly 5.5 to obfuscate my assembly and it seems an unexpected problem occurred: A few internal classes and enums is partially obfuscated - namespace and class name aren't changed after obfuscation, although their members in classes are obfuscated and the ones aren't obfuscated in enums. Nevertheless, other internal classes in my code were obfuscated normally. I cannot found any differences for these classes in source code. Could you explain me what is the reason of this problem?

Code: Select all
namespace Html.Model
{
    internal enum TextVAlignType
    {
        Baseline,
        Bottom,
        Middle,
        Top,
        Sub,
        Super,
        TextBottom,
        TextTop
    }
}

or
Code: Select all
internal class SupportClass {
...
}


Here is my sa project
Code: Select all
SmartAssemblyProject ProjectId=\"{ae26c659-45c9-4856-9773-bda43a46f02d}\" Version=\"2.0\">
    <MainAssemblyFileName>..\\..\\build-out\\NET20\\MyAssembly.dll</MainAssemblyFileName>
    <FriendlyName>MyAssembly</FriendlyName>
    <CompanyName>MyAssembly</CompanyName>
    <Configuration Name=\"Release\">
        <ApplicationName>MyAssembly</ApplicationName>
        <Destination DestinationFileName=\"..\\..\\build-out\\Obfuscated\\NET20\\MyAssembly.dll\" />
        <Assemblies>
            <Assembly AssemblyName=\"MyAssembly, Culture=neutral, PublicKeyToken=716fcc553a201e56\">
                <Merging>
                    <ResourcesCompression Compress=\"1\" />
                    <MemberRefsProxy Proxy=\"0\" />
                    <Pruning Prune=\"1\">
                        <Exclusion />
                    </Pruning>
                    <Obfuscation Obfuscate=\"1\">
                        <Exclusion />
                    </Obfuscation>
                    <ControlFlow Obfuscate=\"1\" ObfuscationLevel=\"2\" />
                    <ResourcesPruning />
                </Merging>
            </Assembly>
            <Assembly AssemblyName=\"{smartassembly}.ResourceResolver, Culture=neutral, PublicKeyToken=7f465a1c156d4d57\">
                <Merging>
                    <Obfuscation>
                        <Exclusion />
                    </Obfuscation>
                </Merging>
            </Assembly>
            <Assembly AssemblyName=\"SmartAssembly.AssemblyResolver, Culture=neutral, PublicKeyToken=7f465a1c156d4d57\">
                <Merging>
                    <Obfuscation>
                        <Exclusion />
                    </Obfuscation>
                </Merging>
            </Assembly>
            <Assembly AssemblyName=\"SmartAssembly.StringsEncoding, Culture=neutral, PublicKeyToken=7f465a1c156d4d57\">
                <Merging>
                    <Obfuscation>
                        <Exclusion />
                    </Obfuscation>
                </Merging>
            </Assembly>
            <Assembly AssemblyName=\"SmartAssembly.Zip, Culture=neutral, PublicKeyToken=7f465a1c156d4d57\">
                <Merging>
                    <Obfuscation>
                        <Exclusion />
                    </Obfuscation>
                </Merging>
            </Assembly>
        </Assemblies>
        <Options>
            <Obfuscation FieldsNameMangling=\"2\" NameMangling=\"2\" />
            <ExceptionReporting ReportExceptions=\"0\" Template=\"res:{SmartExceptions}.1033.dll\" />
            <StrongNameSigning KeyFileName=\"..\\..\\src\\MyKey.snk\" Sign=\"1\" />
            <OtherProtections SuppressIldasm=\"1\" />
            <StringsEncoding Compress=\"1\" Encode=\"1\" />
            <OtherOptimizations SealClasses=\"0\" />
            <Debugging />
        </Options>
    </Configuration>
</SmartAssemblyProject>


Thanks,
Sergey
sergey
 
Posts: 1
Joined: Thu Dec 02, 2010 9:51 am

Postby CodeGuru » Thu Dec 02, 2010 8:10 pm

If you .ToString() an enum, the enum and its class won't get obfuscated.

I've made a post about it here, and also submitted the working example to SA.
CodeGuru
 
Posts: 9
Joined: Mon Nov 22, 2010 5:29 pm

Postby nick.maidment » Fri Dec 03, 2010 10:56 am

Yes, it would seem that if at any point you have a call to Format, GetName, GetNames, Parse, or ToString on an Enum, SA decides to not obfuscate it :(
nick.maidment
 
Posts: 74
Joined: Fri Jan 29, 2010 1:55 pm


Return to SmartAssembly 5

Who is online

Users browsing this forum: No registered users and 0 guests