aspose-cells-20.7.jar 去除水印及次数限制破解方法

aspose-cells-20.7 去除水印及次数限制破解方法

  1. 执行方法
public static void crackAspose(String JarPath, String outPath) throws NotFoundException,CannotCompileException, IOException {
        // 这个是得到反编译的池
        ClassPool pool = ClassPool.getDefault();

        // 取得需要反编译的jar文件,设定路径
        pool.insertClassPath(JarPath);

        CtClass cc_License = pool.get("com.aspose.cells.License");

        CtMethod method_isLicenseSet = cc_License.getDeclaredMethod("isLicenseSet");
        method_isLicenseSet.setBody("return true;");

        CtClass cc_License2 = pool.get("com.aspose.cells.License");
        CtMethod method_setLicense = cc_License2.getDeclaredMethod("setLicense");
        method_setLicense.setBody("{    a = new com.aspose.cells.License();\n" +
                "    com.aspose.cells.zbiw.a();}");

        CtMethod method_k = cc_License.getDeclaredMethod("k");  
        method_k.setBody("return new java.util.Date(Long.MAX_VALUE);");

        cc_License.writeFile(outPath);
    }
  1. 在代码中指定的目录下生成一个 class 文件
    在这里插入图片描述

  2. 复制原有jar包并解压缩

  3. 把刚才生成的 License.class 文件 替换到解压的源代码中
    在这里插入图片描述

  4. 造一个 License xml 文件,这里文件名为 com.aspose.cells.lic_2999.xml, 位置直接放源代码解压的根目录:
    在这里插入图片描述

  5. 文件内容为:

<License>
  <Data>
    <Products>
      <Product>Aspose.Cells for Java</Product>
    </Products>
    <EditionType>Enterprise</EditionType>
    <SubscriptionExpiry>29991231</SubscriptionExpiry>
    <LicenseExpiry>29991231</LicenseExpiry>
    <SerialNumber>evilrule</SerialNumber>
  </Data>
  <Signature>evilrule</Signature>
</License>
  1. 防止文件指纹校验,我们需要删除掉源代码解压包中的 META_INF 文件夹

  2. 最后的根目录:
    在这里插入图片描述

  3. 压缩为zip
    在这里插入图片描述

  4. zip重命名为 .jar 格式

  5. 使用:

 public void toHtml(String excelPath, String htmlPath) throws Exception {
        // 加载license
        ClassPathResource classPathResource = new ClassPathResource("/com.aspose.cells.lic_2999.xml");
        InputStream license = classPathResource.getInputStream();

        License aposeLic = new License();
        aposeLic.setLicense(license);

        Workbook wb = new Workbook(excelPath);
        wb.calculateFormula();

        HtmlSaveOptions options = new HtmlSaveOptions();
        options.setExportBogusRowData(true);
        wb.save(htmlPath, options);
    }
  • 4
    点赞
  • 12
    收藏
    觉得还不错? 一键收藏
  • 21
    评论
评论 21
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值