Red Gate forums :: View topic - cmdlet pscmdlet dll obfuscation not possible with SA?
Return to www.red-gate.com RSS Feed Available

Search  | Usergroups |  Profile |  Messages |  Log in  Register 
Go to product documentation
SmartAssembly 6
SmartAssembly 6 forum

cmdlet pscmdlet dll obfuscation not possible with SA?

Search in SmartAssembly 6 forum
Post new topic   Reply to topic
Jump to:  
Author Message
LiveForTechnology



Joined: 07 Feb 2014
Posts: 3

PostPosted: Fri Feb 07, 2014 4:38 am    Post subject: cmdlet pscmdlet dll obfuscation not possible with SA? Reply with quote

Hello,

I'm trying to determine whether SA can properly and fully obfuscate a csharp cmdlet dll including all strings methods etc. I've read conflicting info about dll's and public and whether or not SA can be forced to operate properly with examples of "ExcludePublicMembers" or "KeepPublicMembersAccessible". Are there parameters like these that are required for cmdlet dll's?

As popular as this product is I'm hoping someone can help answer whether a csharp dll implemented as a cmdlet or pscmdlet can be obfuscated with SA, or whether it requires a different obfuscator product?

Thank you for any help you can provide me!

Jaiden
Back to top
View user's profile Send private message
jessica.ramos



Joined: 23 Apr 2012
Posts: 214

PostPosted: Sat Feb 08, 2014 1:41 am    Post subject: Reply with quote

Hi Jaiden!

So long as the cmdlet DLL is purely managed, it can be processed and obfuscated by SmartAssembly.

However, SmartAssembly may not obfuscate *everything* in the DLL. It will automatically exclude anything from obfuscation that it thinks may break calls to the DLL--this means that it won't obfuscate any public members of the DLL (that is, assuming it is being obfuscated individually, rather than as a merged dependency of an EXE or other DLL).

There is no way to force the DLLs' public members to be obfuscated, I'm sorry to say. :/

Regarding the two attributes...
If you apply obfuscation to a DLL that has been merged to an EXE or other DLL, then its public members will become internal and SmartAssembly will obfuscate them by default. The KeepPublicMembersAccessible attribute allows for an easy way to turn this behavior off if you do want to keep the public members unobfuscated and accessible. (this attribute used to be 'ExcludePublicMembers' in older versions of SmartAssembly.)

I hope this helps and sorry for any confusion on this topic!
_________________
Jessica Ramos
Technical Support
Red Gate Software Ltd.
Back to top
View user's profile Send private message
LiveForTechnology



Joined: 07 Feb 2014
Posts: 3

PostPosted: Sun Feb 09, 2014 9:50 pm    Post subject: Reply with quote

So only when the option to do ANY level of "Control Flow Obfuscation" does the build of this cmdlet dll fail every time. If set to none but other settings left enabled, the build succeeds.

Here's the end of the log. Does this tell you anything as to what's causing this failure? Should SA be able to properly do control flow obfuscation on a net3.5 csharp cmdlet dll?


2014-02-09 14:35:39,892 INFO SmartAssembly.ProcessingAssembly: Obfuscating assembly code...
2014-02-09 14:35:40,001 ERROR SmartAssembly.ProcessingProject: Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index
System.ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index
at System.ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument argument, ExceptionResource resource)
at System.ThrowHelper.ThrowArgumentOutOfRangeException()
at System.Collections.Generic.List`1.get_Item(Int32 index)
at System.Collections.ObjectModel.Collection`1.get_Item(Int32 index)
at ?.?.(IList`1 , Int32 )
at ?.?.( , IList`1 )
at ?.?.( )
at ..()
at ?.?.( )
at ?.?.( )
at ?..()
Back to top
View user's profile Send private message
jessica.ramos



Joined: 23 Apr 2012
Posts: 214

PostPosted: Mon Feb 10, 2014 7:58 pm    Post subject: Reply with quote

There aren't any known issues with cmdlet DLLs and SmartAssembly, but from the error you provided, it actually looks like you may be running into something else that we have seen before.. This particular bug is triggered by certain applications that have both Control Flow Obfuscation and the 'I want to reduce unused allocated memory' enabled.

Could you kindly try disabling the "unused allocated memory" option to see if that helps?

Please let us know how you get on!
_________________
Jessica Ramos
Technical Support
Red Gate Software Ltd.
Back to top
View user's profile Send private message
LiveForTechnology



Joined: 07 Feb 2014
Posts: 3

PostPosted: Tue Feb 11, 2014 2:42 am    Post subject: Reply with quote

Hi Jessica, that worked! That is really weird that it failed with the reduce memory allocation enabled but thank you! Is that going to be fixed in the next release?
Back to top
View user's profile Send private message
jessica.ramos



Joined: 23 Apr 2012
Posts: 214

PostPosted: Tue Feb 11, 2014 5:37 pm    Post subject: Reply with quote

So glad to hear that helped! : )

There's no timeline set for it yet, but sorry to say it might not be fixed in the near future as the devs are currently focusing on other tools.

Just a bit more information on reducing unused allocated memory: The memory optimization option works by releasing unused pages of memory back to the operating system when the application is idle. It doesn't really have a massive impact- you may find the application uses less memory but at a (slight) performance expense; so if memory usage is a ticking point for your particular application then it's worth trying, but for most applications it won't make too big of a difference
_________________
Jessica Ramos
Technical Support
Red Gate Software Ltd.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic All times are GMT + 1 Hour
Page 1 of 1

 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group