首页 网络安全 安全学院 查看内容

java验证license破解手记

2005-12-30 01:36 1551 0

摘要: java 验证license 破解手记: Parasoft C++ Test Pro v6.5.8.1 C++Test  ...
关键词: nbsp license cpptest LicenseUtils java isFeatureConfigu dfeaturesStatus Parasoft INFO 机器码

java 验证license 破解手记: Parasoft C++ Test Pro v6.5.8.1 C++Test    64.5 MB    (last update 2005-Oct-27)  http://www.parasoft.com/jsp/downloads/cpptest/cpptest_win32_6.5.8.1_pro.exe Parasoft.C.Plus.Plus.Test.Pro.v6.5.8.1-SHOCK 这个是有问题的,他只是破解了Toolkit.dll,可以运行C++TestW.exe进行GUI测试的。 可是强大的comandline没有破解到。这样你要套用makefile对整个工程进行test就不可能了。 G:\editg\CPPTest65\bin>cpptest t.c There is no license to run command line. Please launch C++Test GUI to enter license details. 用c32asm反编译可以得看到他导入alex.dll的几个函数验证license: ALEX.DLL:??0RegistryKey@@QAE@W4PredefinedKey@0@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@W4Mode@0@W4Access@0@@Z ALEX.DLL:?isValid@RegistryKey@@QBE_NXZ ...... 反编译ALEX.DLL,分析这些函数,太多,太复杂,找不到关键点。 从error message 入手,用winhex搜索ALEX.DLL,包括ansi/unicode,并未发现“There is no license to run command line”字符串。 用uedit对整个bin目录下所有文件搜索,也未发现。那么,这一句license error message从那里冒出来得? G:\editg\CPPTest65\bin>cpptest t.c之后, 在系统temp目录下发现一个文件Toolkit16970.log,主要内容如下。 [INFO] Checking main feature... [INFO] Version: Application: C++Test 6.5 [INFO] License configured [INFO] Final status: 0 [INFO] checkConfiguration(t):finish [INFO] cancelOtherThreads:begin [INFO] cancelOtherThreads:finish [INFO] checkConfiguration:finish [INFO] isFeatureConfigurated returned ErrorCode:  -3 [toolkit.modules.common.license.LicenseConfigurationException: isFeatureConfigurated returned ErrorCode:  -3 [  at toolkit.modules.common.license.LicenseUtils.isFeatureConfigurated(LicenseUtils.java:177) [  at toolkit.modules.common.license.LicenseModule.getFeatureStatus(LicenseModule.java:392) [  at com.parasoft.cpptest.app.LicenseManager.printErrorMessage(LicenseManager.java:814) [  at com.parasoft.cpptest.app.LicenseManager.checkLicense(LicenseManager.java:424) [  at com.parasoft.cpptest.app.ModuleTest.mainSlave(ModuleTest.java:1539) [  at com.parasoft.cpptest.app.ModuleTest.main(ModuleTest.java:1376) 这时想到这个东西有很大一部分是java写的。发现bin\jars有一堆.jar文件。 其中有一个license.jar.因为.jar文件就是zip压缩的一堆.class文件, 于是用winrar解压了这个.jar。 可见,LicenseUtils.java的isFeatureConfigurated返回-3,(引起一系列后续处理),表示没有license。 去下了个Jad - the fast JAva Decompiler,和它的GUI前端FrontEnd Plus v1.04: http://www.kpdus.com/jad.html#download 顺便分析了FrontEnd的注册码: --------------cut-------------------- REGEDIT4 [HKEY_CURRENT_USER\Software\FrontEnd Plus] "First Name"="readyu" "Last Name"="#newsmth" "Serial No"="22249790-678B4188-06D766F0" --------------end--------------------- 反编译LicenseUtils.class,看函数,我考,是boolean,太爽了,从这里看,直接return true应该表示成功:  public static synchronized boolean isFeatureConfigurated(LicenseFeature testedLicensefeature, Hashtable featuresStates)         throws LicenseConfigurationException     {         int dfeaturesStatus = getFeatureFailReasonInt(testedLicensefeature, featuresStates);         if(dfeaturesStatus == 0)             return true;         if(dfeaturesStatus == 7 || dfeaturesStatus == 9)             return false;         else             throw new LicenseConfigurationException("isFeatureConfigurated returned ErrorCode: ", dfeaturesStatus);     }      修改思路:             if(dfeaturesStatus == 0)             return true; 直接改为:        return true;                       LicenseUtils.class就是JVM的机器码了,没法直接改。反编译出来的LicenseUtils.java也只有阅读价值, 根本编译不过。 去下了一个jclasslib,开源的jvm bytecode反汇编工具,看class的JVM汇编指令。 http://puzzle.dl.sourceforge.net/sourceforge/jclasslib/jclasslib_windows_3_0.zip 用jclasslib打开LicenseUtils.class, isFeatureConfigurated的JVM汇编代码如下:  0 aload_0  1 aload_1  2 invokestatic #15 <toolkit/modules/common/license/LicenseUtils.getFeatureFailReasonInt>  5 istore_2  6 iload_2  7 ifne 12 (+5) 10 iconst_1 11 ireturn 12 iload_2 13 bipush 7 15 if_icmpeq 24 (+9) 18 iload_2 19 bipush 9 21 if_icmpne 26 (+5) 24 iconst_0 25 ireturn 26 new #16 <toolkit/modules/common/license/LicenseConfigurationException> 29 dup 30 ldc #17 <isFeatureConfigurated returned ErrorCode: > 32 iload_2 33 invokespecial #18 <toolkit/modules/common/license/LicenseConfigurationException.<init>> 36 athrow 思路:只要把条件语句 7 ifne 12 (+5) NOP调即可,不让它判断非0跳转,乖乖的return 1. 可是我不认识java的机器码,怎么改呢?不急,去sun公司的网站下一本手册JVM Specification。 The JavaTM Virtual Machine Specification, Second Edition.  http://java.sun.com/docs/books/vmspec/  http://java.sun.com/docs/books/vmspec/download/vmspec.2nded.html.zip 找到CHAPTER 9 Opcode Mnemonics by Opcode,我们要用到的机器码如下: 00 (0x00) nop 03 (0x03) iconst_0 04 (0x04) iconst_1 28 (0x1c) iload_2 61 (0x3d) istore_2 172 (0xac) ireturn 154 (0x9a) ifne 按照我在前面的分析,只要把  ifne 12 这一句的三个字节nop掉即可。 用uedit打开LicenseUtils.class,搜索 3d1c9a0005,即以下3句。改为3d1c000000,后面的用3个NOP.只要改动2个字节就够了。  5 istore_2  6 iload_2  7 ifne 12 (+5) 把改好的LicenseUtils.class加到license.jar(zip压缩文件),替换原来的。 测试: G:\editg\CPPTest65\bin>cpptest t.c Creating project configuration based on: builtin://VC++6.0 Using project configuration: project://VC++6.0 Test started: Dec 26, 2005 8:37:48 PM ------------------------ ...省去几十页.... ------------------------ Test finished: Dec 26, 2005 8:38:02 PM OK了。收工。 爆破,比较简单,在此抛砖引玉。 希望能给初学者一点启发。
声明:文章版权归原作者所有 部分文章转自互联网 如有侵权请联系 [邮箱地址] 删除

路过

雷人

握手

鲜花

鸡蛋

最新评论

返回顶部