aspose-cells-20.7.jar 去除水印及次数限制破解方法
·
aspose-cells-20.7 去除水印及次数限制破解方法
- 执行方法
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);
}
-
在代码中指定的目录下生成一个 class 文件

-
复制原有jar包并解压缩
-
把刚才生成的 License.class 文件 替换到解压的源代码中

-
造一个 License xml 文件,这里文件名为 com.aspose.cells.lic_2999.xml, 位置直接放源代码解压的根目录:

-
文件内容为:
<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>
-
防止文件指纹校验,我们需要删除掉源代码解压包中的 META_INF 文件夹
-
最后的根目录:

-
压缩为zip

-
zip重命名为 .jar 格式
-
使用:
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);
}
更多推荐

所有评论(0)