Beware: CThru sees through your private members!
TypeMock originally a framework to create mock objects, recently published the core API as TypeMock Open-API and on the same foundation, a project name CThru which gives you the “mocking” ability in the wild! This means now you can intercept calls to any API (except for some core .NET API and TypeMock API itself) and mock-out any of the existing functionality. This is really huge! But this is a sword with two blades! Let”s see how a mischief cracker with bad intentions and high imagination can crack open your commercial component without even touching any IL code or modifying .NET assembly in anyway!
This is only for educational purpose. I”m only demonstrating this for you to be more cautious when publishing you commercial product, designed to be used by developers.
Let’s say we have a commercial component which uses a sophisticated algorithm to check if it is running in trial mode and if it does, it will then throw an exception, because trial period has expired.
public class CommercialComponent
First step is to create an aspect. CThru aspects are like any other AOP framework, you can tap into object creation or any method call.
public class LicenseHackAspect : Aspect
Now on application start, you tell CThru engine to start and register all aspects. It is still no brainer. Let”s create a unit test to show this:
And the test now passes!
So, is it just me that feels this is a very simple (attractive?) way for crackers? Fortunately, to use CThru you need to have Typemock Isolator installed on your machine which is not a free product.
Other than the point shown here, CThru is a powerful AOP framework with which you can achieve a lot with just a few lines of code. The only problem, is according to the license page, the end-user buying your product still needs to buy another license from TypeMock.