How would you handle this situation:
I have a series of classes which are to be later loaded using reflection:
but the class to be used can vary depending on strings from a text file. So
this text file will have some of these class names in it to govern which
class gets used.
Now, I want to obfuscate as much of my program as I can, though if I
obfuscate everything it won't work anymore because those class names in the
text file no longer match anything in my assembly. These classes in
particular have no sensitive information, so it would be fine to leave them
un-obfuscated.
But what's the easiaest way to accomplish this? Put them in their own
namespace and tell the obfuscator to ignore them? Or put them in their own
assembly like a dll that gets referenced by my app? What would you do? 6 3318
MrNobody,
Instead of using reflection, why not define an interface, and then have
your classes implement the interface? That should prevent the obfuscator
from messing with anything you need to access. It also will make your
coding much easier (and it will perform better as well).
Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com
"MrNobody" <Mr******@discussions.microsoft.com> wrote in message
news:A3**********************************@microsof t.com... How would you handle this situation:
I have a series of classes which are to be later loaded using reflection: but the class to be used can vary depending on strings from a text file. So this text file will have some of these class names in it to govern which class gets used.
Now, I want to obfuscate as much of my program as I can, though if I obfuscate everything it won't work anymore because those class names in the text file no longer match anything in my assembly. These classes in particular have no sensitive information, so it would be fine to leave them un-obfuscated.
But what's the easiaest way to accomplish this? Put them in their own namespace and tell the obfuscator to ignore them? Or put them in their own assembly like a dll that gets referenced by my app? What would you do?
Hi,
It does depend of the obfuscator you are using, if you are using the
Dotfuscator community I think that you can select which classes no to
encrypt. In the rename tab (4th tab) you can select which classes no to
encrypt.
cheers,
--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation
"MrNobody" <Mr******@discussions.microsoft.com> wrote in message
news:A3**********************************@microsof t.com... How would you handle this situation:
I have a series of classes which are to be later loaded using reflection: but the class to be used can vary depending on strings from a text file. So this text file will have some of these class names in it to govern which class gets used.
Now, I want to obfuscate as much of my program as I can, though if I obfuscate everything it won't work anymore because those class names in the text file no longer match anything in my assembly. These classes in particular have no sensitive information, so it would be fine to leave them un-obfuscated.
But what's the easiaest way to accomplish this? Put them in their own namespace and tell the obfuscator to ignore them? Or put them in their own assembly like a dll that gets referenced by my app? What would you do?
Nicholas, I cannot use interfaces and I'll explain why:
The classes in question contain multiple fields which get loaded by
reflection with the data in the textfile. So this text file may say something
like "Name = Foo" where my loader will look for the field "Name" in a class
and set it's value to "Foo". There are also section names which change the
current class based on class name.
"Nicholas Paldino [.NET/C# MVP]" wrote: MrNobody,
Instead of using reflection, why not define an interface, and then have your classes implement the interface? That should prevent the obfuscator from messing with anything you need to access. It also will make your coding much easier (and it will perform better as well).
Hope this helps.
-- - Nicholas Paldino [.NET/C# MVP] - mv*@spam.guard.caspershouse.com
I'm using XenoCode, and it does have both a regular expression filter and a
nice tree with checkboxes so you can check off any class you don't want
obfuscated. Looks like it works good, just kinda annoying everytime I deploy
need to find and uncheck ~30 classes
Nobody,
You may want to use serialization to persist your instances rather than
a text file that you parse.
Also, you can define public stubs that call internal implementation
methods where the public stub names are still exposed but internal
implementation members are called within the same assembly by their
internal obfuscated name. The obfuscation feature in our Decompiler.NET
product will demonstrate this technique for you by automatically
factoring public method bodies into internal implementation methods
while still exposing the public interfaces to external assemblies. You
can download a free trial version and see how it works from our web
site at http://www.junglecreatures.com/
Jonathan Pierce
President
Jungle Creatures, Inc. http://www.junglecreatures.com/
If you register using the Community Edition or the Professional
Edition, there is a knowledge base article you can access that gives an
example of how to use regular expressions for excluding types, methods,
or fields from obfuscation.
Jonathan Henderson
Dotfuscator Support http://www.preemptive.com
CSharped wrote: MrNobody wrote: How would you handle this situation:
I have a series of classes which are to be later loaded using reflection: but the class to be used can vary depending on strings from a text file. So this text file will have some of these class names in it to govern which class gets used.
Now, I want to obfuscate as much of my program as I can, though if
I obfuscate everything it won't work anymore because those class
names in the text file no longer match anything in my assembly. These classes in particular have no sensitive information, so it would be fine to leave them un-obfuscated.
But what's the easiaest way to accomplish this? Put them in their
own namespace and tell the obfuscator to ignore them? Or put them in their own assembly like a dll that gets referenced by my app? What would you do?
I don't know what obfuscator are you using or planning to use, but if the code you have just finished is complete, you shouldn't change the code for the sake of the obfuscator. It should be the other way
around. For Dotfuscator, you can single out the classes you want excluded
from renaming by using regular expressions or by certain characteristics such as access modifiers.
Any other documentation on Dotfuscator can be found here: http://www.preemptive.com/downloads/Documentation.html This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: phoenix |
last post by:
Hello,
I'm using the webbrowser control to display a webpage on my form. The first
problem is the gets fired for every image which is completed as well.
http://support.microsoft.com/?id=180366...
|
by: petantik |
last post by:
Are there any commercial, or otherwise obfuscators for python source
code or byte code and what are their relative advantages or
disadvantages. I wonder because there are some byte code protection...
|
by: Mike Malter |
last post by:
I am just starting to work with reflection and I want to create a log that saves relevant information if a method call fails so I
can call that method again later using reflection.
I am...
|
by: James Cohen |
last post by:
Hi,
I hope somebody can help me out, Im looking for a way to retreive the
original filename & line number of a Reflection.MemberInfo instance. Ill
provide some background on what it is that im...
|
by: bob |
last post by:
Hi,
I've got some forms with loads of controls for entering numbers. Each
text box should behave in a similare way but i hated writing all the
text processing code for every text box. So I made...
|
by: Vikram |
last post by:
Hi,
I need some advice on making the choice for a good code obfuscator. I have
looked at Dotfuscator from Preemptive.
Some of the disadvantages they list with their dotfuscator product are:
...
|
by: Peter |
last post by:
Using CDO 1.21 how do I get First Name and Last Name from Global Address
Book?
I have the following code where I retrieve LastName and FirstName in one
field, but how do I get LastName and...
|
by: Bit byte |
last post by:
I have an ongoing argument with a fellow programmer. I am of the opinion
that Reflection fails to work when the code is obfuscated. The other guy
is of the opinion that .Net reflection is invariant...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
| |