Comments
8 comments
-
Unfortunately, we don't currently produce a human readable map file (it is in our requests tracker as SA-91).
If you do need to do post processing on the assembly where you need to know the obfuscated name you can use the "[ObfuscateTo( string )]" attribute, although I'll admit it is not the most friendly method. -
Thanks.
I don't see any doc on "[ObfuscateTo( string )]".
Is this how we do it?
[ObfuscateTo(human)]
void anymethod()
{}
Do we need to enclose human with "" -
Yes it is
[ObfuscateTo("human")] void anymethod() {}
The string is a standard .NET System.String so it is enclosed in "", and you can do anything you can do with a string constant (e.g. "\u0001Hello" )
The other attribute which you would probably want to use alongside [ObfuscateTo(..)] is [ObfsucateNamespaceTo( string )] this, unsurprisingly, specifies the name to obfuscate the namespace of the type to. -
If you (or anyone else reading this forum) want it:
There is a full list of all the 15 attributes you can apply in the SmartAssembly.Attributes.cs or SmartAssembly.Attributes.vb which are in the "Attributes" folder where you installed SmartAssembly ("C:\Program Files\Red Gate\SmartAssembly 5\Attributes" by default).- DoNotObfuscateAttribute - Don't rename the element (class, method, field, etc)
- DoNotObfuscateTypeAttribute - Don't rename the type or any element within it (method, field, nested class, etc)
- ObfuscateToAttribute( string ) - Obfuscate the element to the name you specify
- ObfuscateNamespaceToAttribute( string ) - Obfuscate the namespace of the type to the name you specify
- DoNotPruneAttribute - Don't prune the element
- DoNotPruneTypeAttribute - Don't prune the type or any element within it.
- DoNotObfuscateControlFlowAttribute - Don't change the IL code within a method
- ObfuscateControlFlowAttribute - In the project setting page you can specify two different levels of control flow obfuscation. Methods with this attribute will have control flow obfuscation applied at the level you specify for "flagged" methods, other methods will have the standard level applied, unless they have [DoNotObfuscateControlFlow] applied.
- DoNotCaptureVariablesAttribute - Don't capture variable information for the Automatic Error reporting from this method
- DoNotCaptureFieldsAttribute - Don't capture field information for the Automatic Error reporting from this type
- DoNotSealTypeAttribute - Don't seal this class
- ReportExceptionAttribute - Effectively adds a try/catch/ReportException block to the method. This means that you only get the part of the stack trace between the error and this method in the Error Report. Benefit is that the stack is not fully unwound so that you can continue with the control flow in the calling method.
- DoNotEncodeStringsAttribute - Don't encode the strings in the element this is applied to.
- EncodeStringsAttribute - Do encode the strings in the element this is applied to.
- ExcludeFromMemberRefsProxyAttribute - Don't use Member Reference Proxy for this element.
-
[ObfuscateTo("human")]
Doesn't seem to do anything. I use Reflector to reverse engineer the exe, and there is no method with human.
btw,
apply ObfsucateNamespaceTo( string )]
namespace whatever
generate compile error -
Oh that is an interesting bug. If you are using [ObfuscateTo( string )] on a method then you have to use "Unicode encoding with advanced renaming" for it to work. I've logged the bug as (SA-325) as it should be available on all settings.
[ObfuscateNamespaceTo( string )] needs to be applied to a class, struct, enum or interface, otherwise you will get a compiler error. -
Well, I choose
I want to obfuscate using Unicode unprintable characters and advanced renaming alogorithm
and then on filed Name Mangling (I don't think that make any difference), I choose
I want to use advanced renaming, so that fields of a different type can have the same name
However, I still cannot locate my method.
may be you can just show me an example. -
I've sent you a PM.
No the field name managling shouldn't make any different in this case.
Add comment
Please sign in to leave a comment.
I think that will help one to identify the new name of the method that one is interested in, in case one needs to do further processing to that method after obfuscation, or making sure the the method is obfuscated to their satifisfaction using reflector.