Plugin

.NET obfuscator and automated error reporting

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

Plugin

Postby Ben1628 » Thu Jul 01, 2010 3:44 pm

Are we able to obsfuscate plugins that are called by the main exe?

What do we need to do to make sure the interface is visible to the main exe?

While we're on this subject, is there anyway we can embed or merge the plugin using smartassembly. Currently, the main exe is loading the dll from a directory, we would like to change it so it is loading it from the embed assembly instead.
Ben1628
 
Posts: 9
Joined: Thu Jul 01, 2010 3:37 pm

Postby Paul.Martin » Thu Jul 01, 2010 5:03 pm

You can obfuscate any pure .NET assembly, you just need to create a new SmartAssembly project for the plugin assembly and build it with the protection you want to apply.

If your plugin is a library (.dll) then SmartAssembly will leave all public interfaces, types and methods visible.
If your plugin is an executable (.exe) then SmartAssembly will obfuscate (effectively hiding) everything by default.
You can override the default behavior by using the <ExcludePublicMembers> attribute in the SmartAssembly project file (*.saproj). This enables you to treat EXE files in a similar way to DLL files.

To exclude public members from obfuscation, specify a value of '1' for the project file:
Code: Select all
<Obfuscation ExcludePublicMembers="1" Obfuscate="1">...
</Obfuscation>



As long as your main exe references the plugin you can embed or merge the plugin.

If you don't have a reference to the plugin in the executable and can't add one (for instance if you want dynamically choose which plugins to load at runtime) then it is not currently possible to embed or merge the the plugin using SmartAssembly.
If you can't embed the plugin you can manually do it, see http://www.codeproject.com/KB/DLL/EmbedAssemblyAsResource.aspx, although this is more of a pain to do and doesn't do any encryption or compression on the embedded plugin assembly.
Last edited by Paul.Martin on Thu Jul 01, 2010 5:10 pm, edited 1 time in total.
Paul.Martin
 
Posts: 83
Joined: Wed Feb 03, 2010 11:20 am
Location: Cambridgeshire

Postby Paul.Martin » Thu Jul 01, 2010 5:04 pm

You can obfuscate any pure .NET assembly, you just need to create a new SmartAssembly project for the plugin assembly and build it with the protection you want to apply.

If your plugin is a library (.dll) then SmartAssembly will leave all public interfaces, types and methods visible.
If your plugin is an executable (.exe) then SmartAssembly will obfuscate (effectively hiding) everything by default.
The section "Excluding public members from obfuscation" on our support page [url]http://www.red-gate.com/supportcenter/Content.aspx?c=SmartAssembly\\help\\5.0\\SA_ObfuscatingCode.htm&p=SmartAssembly#o11193[/url] describes how to change the default behaviour.


As long as your main exe references the plugin you can embed or merge the plugin.

If you don't have a reference to the plugin in the executable and can't add one (for instance if you want dynamically choose which plugins to load at runtime) then it is not currently possible to embed or merge the the plugin using SmartAssembly.
If you can't embed the plugin you can manually do it, see http://www.codeproject.com/KB/DLL/EmbedAssemblyAsResource.aspx, although this is more of a pain to do and doesn't do any encryption or compression on the embedded plugin assembly.
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