将VMProtect集成到应用程序教程之实模式(四):将代码锁定到序列号上

在实模式下,VMPROTECT 许可系统向受保护的应用程序放置一个特殊的许可模块。该模块执行与SDK中的测试功能相同的功能,但是使用序列号的内容而不是配置ini文件。本系列教程的五个步骤说明了使用基于VMProtect和许可系统的全功能保护来保护简单应用程序的过程。

破解程序最常见的方法之一是找到要检查序列号的位置,以及其后的附近条件跳转。如果序列号正确,则程序以一种方式执行,否则就以另一种方式执行。黑客找到了该跳转并将其替换为“正确”方式的跳转。

本文,我们将使用这种技术直接在源代码中“破解”测试程序。首先,“关掉”条件跳转:

char *serial = read_serial("serial.txt");
int res = VMProtectSetSerialNumber(serial);
delete [] serial;
if (false && res)
{

现在,程序可以接受任何序列号,并且可以正常工作。当然,如果文件受到VMProtect的保护,即使是经验丰富的黑客也会花费数月的时间来定位和修改条件跳转。考虑到程序在不同条件下多次检查序列号,即使是这样一个简单的检查也是相当安全的。

步骤五  将代码锁定到序列号上

VMProtect的演示版对已处理函数的数量有所限制:仅处理一个函数。因此,如果使用demo-version,应该只将foo()函数包括到项目中,否则VMProtect的demo-version可以选择main()函数,并且对序列号的锁定将不起作用。

VMProtect的授权系统允许您将一个或多个功能的代码锁定到一个序列号,这样,如果没有提供正确的序列号,它们将无法工作。该函数的主体将被虚拟化,然后进行加密,并且只能使用正确的序列号进行解密。这意味着,即使黑客在序列号检查中找到并修复了有条件的跳转,锁定到序列号的功能仍然无法使用。

下面让我们尝试一下。在“Functions”部分中,选择foo()函数,然后在右侧面板中将“Lock to Serial Number”选项更改为“Yes”。 

 然后,保护应用程序。由于我们已经“破解”了它,所以可以将任意文本放入serial.txt文件中并运行该应用程序。以下文本将出现在控制台中:

C:\test>dummy_app.vmp.exe
serial number is correct, calling foo()

这意味着,黑客“修复”了条件跳转,程序以“正确”方式运行。但是当调用foo()时,程序将显示一条消息:  

由于我们将foo()函数锁定在序列号上,而黑客没有此序列号,因此尝试解密该函数的代码会导致故障和无法继续执行程序。当按下“OK”时,程序关闭,并且“done”消息永远不会不显示在控制台中。

什么应该被锁定到序列号?

将只在程序的注册版本中运行的功能锁定到序列号是有必要的。由于锁定需要虚拟化,所以应该考虑一些性能损失。例如,如果文本编辑器不允许在演示版中保存结果,则可以将保存文档功能锁定到序列号。如果该函数在其操作期间调用其他函数,则也不必锁定它们,因为没有主函数,它们将不会有任何用处。

注意,在没有序列号的情况下调用锁定的函数会导致程序关闭,并且没有机会保存工作结果。这就是为什么应该彻底测试应用程序,以确保它在试用模式下不会调用此类功能。在上面的示例中,文本编辑器必须在演示模式下禁用“Save”命令,不能对Ctrl + S快捷键作出反应,也不应该要求在退出时保存文档。如果您不注意这一点,用户可能会对“错误”的演示版本感到失望。

锁定序列号和无效序列号

当调用VMProtectSetSerialNumber()函数时,授权许可模块检查传递给该函数的序列号。只有当序列号在检查时绝对正确时才执行代码的加密片段——未列入黑名单,具有正确的硬件标识符、未过期等等。在这种情况下,所有加密的过程都将执行,直到应用程序关闭,或再次调用VMProtectSetSerialNumber()。

在程序执行期间,某些限制可能会“触发”:例如,程序的运行时间可能到期或序列号过期日期到来。在这种情况下,许可模块仍会加密并执行锁定在序列号上的功能。这是因为受保护的应用程序很难检测到这些限制触发的时刻并相应地更改行为(阻止相应的菜单项等)。如果许可模块突然停止执行锁定到序列号的代码片段,很可能导致应用程序故障。这就是为什么要在设置序列号时做出决策,并选择相应的执行模式等原因。

What is VMProtect? VMProtect protects code by executing it on a virtual machine with non-standard architecture that makes it extremely difficult to analyze and crack the software. Besides that, VMProtect generates and verifies serial numbers, limits free upgrades and much more. VMProtect Features Here you can find the description of the most important features of VMProtect, some screenshots and other useful information. For the full list of supported features, see the comparison chart. Supported Files And Formats VMProtect supports both 32 and 64-bits executable files, dynamically loaded libraries and drivers. This includes screensavers, Active-X components, BPL libraries and other files in PE-format. Protected files are run on almost any version of Windows, even old Windows 95! However, licensing feature requires at least Windows 2000. VMProtect doesn’t support .NET executables. Serial Numbers The Ultimate edition of VMProtect allows to add serial numbers to the protected application with minimal efforts. The feature is supported by PayPro Global e-commerce provider, so you even don’t need to setup your own serial number generator (of course, you can do that if you really need). Licensing feature allows to limit the period of free updates, set the time of life of serial number, prevent the code execution without serial numbers and much more. Any serial number can be blocked and newly protected files will not accept it. User Interface VMProtect features two modes of the user interface: simple and expert. Simple mode allows to easily pick functions for protection, adjust options and get the protected file with just a few mouse clicks. Expert mode is for advanced users, it shows assembly code, allows to write scripts, bundle DLLs and much more. It also features more settings on the “Options” tab. Console Version The Professional and Ultimate editions of VMProtect have a console version that supports command line parameters and can be used in automatic building process. It fully supports scripts, watermarks, serial numbers and all the other features of VMProtect.
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值