ConfuserEx icon indicating copy to clipboard operation
ConfuserEx copied to clipboard

[Feature] Strip a type

Open MulleDK19 opened this issue 5 years ago • 4 comments

It'd be nice with a feature to strip specific types after obfuscating. For example, I like to use constants for the obfuscation instead of having the options directly in the Feature property.

[assembly: System.Reflection.Obfuscation(Exclude = false, Feature = ObfuscationConstants.MaximumProtection)]

internal static class ObfuscationConstants
{
    internal const string Preset = "preset(minimum)";
    internal const string ControlFlow = "+ctrl flow";
    internal const string RefProxy = "+ref proxy";
    internal const string Constants = "+constants";
    internal const string Renaming = "+rename(mode=sequential,flatten=false)";
    internal const string MaximumProtection = Preset + ";"
                                              + ControlFlow + ";"
                                              + RefProxy + ";"
                                              + Constants + ";"
                                              + Renaming;
}

The obfuscation attribute is of course stripped, but the ObfuscationConstants class remains, allowing anyone to see exactly which options I used for obfuscation.

It'd be nice if you could mark certain types like this with an attribute to have that type stripped after obfuscation. This would have no implications with consts, since they're inlined by the compiler and the type isn't actually used for anything.

Or perhaps just have it strip any non-public classes that consist purely of consts.

MulleDK19 avatar May 30 '19 00:05 MulleDK19