Preemptive mapn.xml

.NET obfuscator and automated error reporting

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

Preemptive mapn.xml

Postby Ben1628 » Sun Jul 04, 2010 5:37 am

Is there something in smartassembly that is similiar to preemptive mapn.xml.

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.
Ben1628
 
Posts: 9
Joined: Thu Jul 01, 2010 3:37 pm

Postby Paul.Martin » Mon Jul 05, 2010 2:00 pm

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.
Paul.Martin
 
Posts: 83
Joined: Wed Feb 03, 2010 11:20 am
Location: Cambridgeshire

Postby Ben1628 » Mon Jul 05, 2010 2:50 pm

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 ""
Ben1628
 
Posts: 9
Joined: Thu Jul 01, 2010 3:37 pm

Postby Paul.Martin » Mon Jul 05, 2010 4:11 pm

Yes it is
Code: Select all
[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.
Paul.Martin
 
Posts: 83
Joined: Wed Feb 03, 2010 11:20 am
Location: Cambridgeshire

Postby Paul.Martin » Mon Jul 05, 2010 4:12 pm

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.
Paul.Martin
 
Posts: 83
Joined: Wed Feb 03, 2010 11:20 am
Location: Cambridgeshire

Postby Ben1628 » Tue Jul 06, 2010 7:17 pm

[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
Ben1628
 
Posts: 9
Joined: Thu Jul 01, 2010 3:37 pm

Postby Paul.Martin » Tue Jul 06, 2010 7:56 pm

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.
Paul.Martin
 
Posts: 83
Joined: Wed Feb 03, 2010 11:20 am
Location: Cambridgeshire

Postby Ben1628 » Fri Jul 09, 2010 4:14 am

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.
Ben1628
 
Posts: 9
Joined: Thu Jul 01, 2010 3:37 pm

Postby Paul.Martin » Fri Jul 09, 2010 6:50 pm

I've sent you a PM.

No the field name managling shouldn't make any different in this case.
Paul.Martin
 
Posts: 83
Joined: Wed Feb 03, 2010 11:20 am
Location: Cambridgeshire


Return to SmartAssembly 5

Who is online

Users browsing this forum: No registered users and 0 guests

cron