Obfuscate only members and nothing else ? And in Default Namespace ?

71 views
Skip to first unread message

ManuTOO

unread,
Sep 22, 2012, 7:52:40 AM9/22/12
to obfu...@googlegroups.com
Hello,

I'd like to obfuscate only members and nothing else, ie: not the methods, nor the class names, etc...
Is it possible to do that ?
Moreover, I only have a "Default Namespace" and I'm not sure how to enter it ; is it an empty string, ie: name="" ..?

I tried this but with no result :
<SkipType name="" skipMethods="true" />

Thanks in advance for any help..!

webbie

unread,
Sep 22, 2012, 10:51:14 AM9/22/12
to obfu...@googlegroups.com
Hello ManuTOO,

the following rule should do, what you described:

<SkipType name="*" skipMethods="true" />

Please not the wildcard in the name attribute. All type and method names are skipped, but field and event names are obfuscated. Properties are removed anyway, because they are not used during runtime. But the property getter and setter methods are not obfuscated here because they are normal methods.

The default/global namespace is an empty string. Look at the Mapping.txt, if you are not sure what the exact name of a type or member is. You will have to use a regular expression if you want to apply a rule only to the global namespace, because there is no dot which separates the namespace from the type in case of the default namespace.


ManuTOO

unread,
Sep 23, 2012, 3:17:22 AM9/23/12
to obfu...@googlegroups.com

Thanks for the clarification !

It turns out I was putting the option lines out of the <Module... ></Module> tag ; it works better now they are inside it..! ;-)

So now, I'd just need 1 more thing : I'd like to obfuscate the parameters of the methods, but not the methods' name.
ie: void GoTo(int RoomNumber, int Level) would give => void Goto(int a, int b)
Is it possible ?

So far, I'm using :
    <Module file="$(InPath)\Assembly-CSharp.dll" >
        <SkipType name="^C((?!/).)*$"/>
        <SkipMethod type="^[^.]*$" name="*"/>
        <SkipField type="^.*$" rx="^((?!e_|es_).)*$" attrib="public"/>
    </Module>
It's for a Unity3D game.
<SkipType name="^C((?!/).)*$"/> => All my classes start with 'C' so they are not obfuscated ; all subclasses, substructs & sub enums' names get obfuscated.
<SkipMethod type="^[^.]*$" name="*"/> => All methods are not obfuscated
<SkipField type="^.*$" rx="^((?!e_|es_).)*$" attrib="public"/> => All my enum fields start with e_ or es_ , so they get obfuscated ;

I'm pretty happy with the result as I just don't want a company steals my code & reuses it, so I don't need a lot of obfuscation, just enough to make it painful enough to read it & change it.
Reply all
Reply to author
Forward
0 new messages