Home - Forums-.NET - Spices.Net - Discover at runtime if the application has been obfuscated

Spices.Net

NET code security, tools to protect, obfuscate, tamper defense, code and data safety, recover, convert, optimize, explore, browse and analyze .Net software.

This forum related to following products: Spices.Net Suite, Spices.Net Obfuscator, Spices.Net Decompiler

Discover at runtime if the application has been obfuscated
Link Posted: 01-Aug-2006 05:10
Hi,

Purely for informational purposes, I'd like the 'About' dialog of my application to mention whether or not the build has been obfuscated.

Is there a compile flag I can test in code to see if the assembly's obfuscated?  For example, at the moment, I do this:


#If DEBUG then
    lblReleaseType.Text = \"Debug Build\"
#Else
    lblReleaseType.Text = \"Release Build\"
#End If


I'm wondering if there's a way I can test for obfuscation too.  Of course, I can set a constant and toggle it manually, but this would be neater ;)
Link Posted: 01-Aug-2006 05:14
Ah, never mind!

Sorry, I was being a bit daft...  I can just define a custom constant for the Release build configuration
Link Posted: 01-Aug-2006 21:25
You can use SoftwareWatermarking feature of Spices.Obfuscator to mark your assemblies as obfuscated:

At runtime your application can inspect attributes attached to the assembly to find NineRays.Obfuscator.SoftwareWatermarkAttribute it's properties.
Link Posted: 01-Aug-2006 23:31
Thanks for the tip!

The way I was thinking about doing it was:

- Creating a Build Configuration (named 'Release (Obfuscated)')
- Adding a custom build flag to that configuration - OBFUSCATED=TRUE

... but then I realised I'd still have to toggle the 'Spices_ObfuscateSolutionAfterBuild' property manually.  

Or, is there a way to set it up so that Spices will only obfuscate when the build configuration is set to a particular profile? So, for example, I could quickly change between Debug, Release and Release (Obfuscated) build configs?
Link Posted: 02-Aug-2006 08:51
Thanks for the idea, we'll try to implement this feature to the nearest update.
Currently you can use MSBuild integration to use obfuscation with configuration dependant tasks.