Code to determine if running obfuscated?
eric-914
Posts: 46
Hello, odd question here...
Is there a way, w/in my code itself, to determine if it has been processed by SmartAssembly?
Basically, I want to prevent accidental deployment w/out it being obfuscated first, so I'd like to add some code to indicate if it hasn't been 'processed' yet.
If not directly w/in S/A, I'm thinking since S/A can embed libraries into the .exe itself, maybe determine if a particular library has been embedded or not. If so, then yes, it's been processed. If no, then it hasn't.
Anyway, wonder if anyone has any ideas about this.
Thanks in advance...
Is there a way, w/in my code itself, to determine if it has been processed by SmartAssembly?
Basically, I want to prevent accidental deployment w/out it being obfuscated first, so I'd like to add some code to indicate if it hasn't been 'processed' yet.
If not directly w/in S/A, I'm thinking since S/A can embed libraries into the .exe itself, maybe determine if a particular library has been embedded or not. If so, then yes, it's been processed. If no, then it hasn't.
Anyway, wonder if anyone has any ideas about this.
Thanks in advance...
Comments
http://sdk.red-gate.com/index.php/Check_SA_Version
As for getting a list of embedded assemblies - I don't know how you'd go about that as it is unsupported and for the sake of protecting the IP I'm not sure if it should be externally documented.
I found I could do it by the following:
Using the Assembly object from the .exe, get referenced assemblies via:
Then w/in one of my library .dll's that I know will be merged via S/A, I get it's assembly name:
I have noticed that this name will show up in the reference list when the app has NOT been obfuscated. But this name will disappear AFTER obfuscation (because it's no longer an external library, it's been merged w/ the .exe).
I use this fact to differentiate between the two states.