一、分析

一、分析
由于产品系列是没有做联网校验的,所以pj起来比较容易,只要找到核心逻辑,用重新生成一下类即可.
核心类com..cells.
通过以上代码可以分析出,通过方法,设置许可证,然后经过一顿看不懂的操作,完成许可的验证.但核心逻辑只有几行代码
a = this; //设置对象为this,为了给其他对象调用,改属性是static的,但只有包权限zbis.a(); //设置flag为false,具体啥用不晓得private static Date j(String var0) //验证许可的过期时间
于是思路就是,重写掉方法,在方法体里面保留以下代码
this.a = new com.aspose.cells.License();com.aspose.cells.zbis.a();
重写Date j( var0)方法,使得返回的date为最大值
return new java.util.Date(java.lang.Long.MAX_VALUE);
最后用进行修改,代码如下:
org.javassistjavassist3.27.0-GA
修改class中的方法:
package com.poi.javassist;import javassist.ClassPool;import javassist.CtClass;import javassist.CtMethod;/*** 破解aspose* @author* @date 2020年5月22日 下午5:19:53*/public class Demo {public static void main(String[] args) {try {ClassPool aDefault = ClassPool.getDefault();//取得需要反编译的jar文件,设定路径aDefault.insertClassPath("C:/in/aspose-cells-20.5.jar");CtClass ctClass = aDefault.get("com.aspose.cells.License");CtMethod ctMethod = ctClass.getMethod("setLicense", "(Ljava/io/InputStream;)V");ctMethod.setBody("{ this.a = new com.aspose.cells.License();com.aspose.cells.zbis.a();}");CtMethod kMethod = ctClass.getDeclaredMethod("k");kMethod.setBody("{return new java.util.Date(4070880000000L);}");//// 获取String类型参数集合/*CtMethod[] declaredMethods = ctClass.getDeclaredMethods();for(CtMethod m:declaredMethods) {System.out.println(m.getMethodInfo());}*///CtMethod atMethod = ctClass.getMethod("a", "(Ljava/lang/String;Ljava/lang/String;ZZ)Z");//atMethod.setBody("{ return true;}");//这里会将这个创建的类对象编译为.class文件ctClass.writeFile("C:/out/");//不能为根目录} catch (Exception e) {e.printStackTrace();}}}
a22ee78a9c9f7e55333d750724f268f9
删除签名文件
删除*.RSA和*.SF签名文件
*.MF文件只保存如下:
Manifest-Version: 1.0Application-Name: Aspose.Cells for javaImplementation-Title: Aspose.Cells for javaCopyright: Copyright 2001-2020 Aspose Pty LtdBundle-SymbolicName: com.aspose.cellsImplementation-Version: 20.5.0Release-Date: 2020-05-20Specification-Vendor: Aspose Pty LtdBundle-ManifestVersion: 2Specification-Title: Aspose.Cells for javaApplication-Library-Allowable-Codebase: *Bundle-Vendor: Aspose Pty LtdImport-Package: javax.xml.parsers,org.w3c.dom,org.xml.sax,javax.crypto;resolution:="optional",javax.crypto.spec;resolution:="optional",javax.security.cert;resolution:="optional",com.sun.image.codec.jpeg;resolution:="optional",javax.imageio;resolution:="optional",javax.imageio.metadata;resolution:="optional",javax.imageio.stream;resolution:="optional",com.sun.media.imageio.plugins.tiff;resolution:="optional",javax.media.jai;resolution:="optional",javax.print;resolution:="optional",javax.print.attribute;resolution:="optional",javax.print.attribute.standard;resolution:="optional",org.apache.tools.zip;resolution:="optional",org.bouncycastle.jce.provider;resolution:="optional"Implementation-Vendor: Aspose Pty LtdExport-Package: com.aspose.cellsMinimum-JDK: 1.6Bundle-Name: Aspose.Cells for javaBundle-Version: 20.5.0Caller-Allowable-Codebase: *Permissions: all-permissionsName: Aspose.Cells for javaSpecification-Version: 20.5.0Created-By: 1.8.0_172 (Oracle Corporation)
把jar包重命名为zip加压后,把生成好的class文件覆盖到里面,再压缩成zip后重名为jar
=========================================
-cells-21.2
package com.poi.javassist;import javassist.ClassPool;import javassist.CtClass;import javassist.CtMethod;/*** 破解aspose* @author* @date 2020年5月22日 下午5:19:53*/public class Demo5 {public static void main(String[] args) {try {ClassPool pool = ClassPool.getDefault();//取得需要反编译的jar文件,设定路径pool.insertClassPath("D:/aspose-cells-21.2.jar");CtClass ctClass = pool.get("com.aspose.cells.License");CtMethod ctMethod = ctClass.getMethod("setLicense", "(Ljava/io/InputStream;)V");ctMethod.setBody("{ this.a = new com.aspose.cells.License();com.aspose.cells.zbje.a();}");ctMethod = ctClass.getMethod("setLicense", "(Ljava/lang/String;)V");ctMethod.setBody("{ this.a = new com.aspose.cells.License();com.aspose.cells.zbje.a();}");CtMethod kMethod = ctClass.getDeclaredMethod("l");kMethod.setBody("{return new java.util.Date(4070880000000L);}");//// 获取String类型参数集合/*CtMethod[] declaredMethods = ctClass.getDeclaredMethods();for(CtMethod m:declaredMethods) {System.out.println(m.getMethodInfo());}*///CtMethod atMethod = ctClass.getMethod("a", "(Ljava/lang/String;Ljava/lang/String;ZZ)Z");//atMethod.setBody("{ return true;}");//这里会将这个创建的类对象编译为.class文件ctClass.writeFile("D:/");} catch (Exception e) {e.printStackTrace();}}}