cmdlet pscmdlet dll obfuscation not possible with SA?

edited February 11, 2014 11:37AM in SmartAssembly
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

Comments

  • Jessica RJessica R Posts: 1,319 Rose Gold 4
    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 | Product Support Engineer | Redgate Software

    Have you visited our Help Center?


  • 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 ?..()
  • Jessica RJessica R Posts: 1,319 Rose Gold 4
    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 | Product Support Engineer | Redgate Software

    Have you visited our Help Center?


  • 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?
  • Jessica RJessica R Posts: 1,319 Rose Gold 4
    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 | Product Support Engineer | Redgate Software

    Have you visited our Help Center?


Sign In or Register to comment.