aspose-cells-20.5

2023-10-11 16:50
文章标签 cells aspose 20.5

本文主要是介绍aspose-cells-20.5,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

一、分析

由于aspose产品系列是没有做联网校验的,所以pj起来比较容易,只要找到核心逻辑,用javassist重新生成一下类即可.

核心类com.aspose.cells.License

通过以上代码可以分析出,通过setLicense方法,设置许可证,然后经过一顿看不懂的操作,完成许可的验证.但核心逻辑只有几行代码

a = this; //设置对象为this,为了给其他对象调用,改属性是static的,但只有包权限
zbis.a(); //设置flag为false,具体啥用不晓得
private static Date j(String var0) //验证许可的过期时间

于是思路就是,重写掉setLicense方法,在方法体里面保留以下代码

this.a = new com.aspose.cells.License();
com.aspose.cells.zbis.a();

重写private static Date j(String var0)方法,使得返回的date为最大值

return new java.util.Date(java.lang.Long.MAX_VALUE);

最后用javassist进行修改,代码如下:

	<!-- 字节码类库工具 --><dependency><groupId>org.javassist</groupId><artifactId>javassist</artifactId><version>3.27.0-GA</version></dependency>

修改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();}}}

删除签名文件


删除*.RSA和*.SF签名文件

*.MF文件只保存如下:

Manifest-Version: 1.0
Application-Name: Aspose.Cells for java
Implementation-Title: Aspose.Cells for java
Copyright: Copyright 2001-2020 Aspose Pty Ltd
Bundle-SymbolicName: com.aspose.cells
Implementation-Version: 20.5.0
Release-Date: 2020-05-20
Specification-Vendor: Aspose Pty Ltd
Bundle-ManifestVersion: 2
Specification-Title: Aspose.Cells for java
Application-Library-Allowable-Codebase: *
Bundle-Vendor: Aspose Pty Ltd
Import-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 Ltd
Export-Package: com.aspose.cells
Minimum-JDK: 1.6
Bundle-Name: Aspose.Cells for java
Bundle-Version: 20.5.0
Caller-Allowable-Codebase: *
Permissions: all-permissions
Name: Aspose.Cells for java
Specification-Version: 20.5.0
Created-By: 1.8.0_172 (Oracle Corporation)

把jar包重命名为zip加压后,把生成好的class文件覆盖到里面,再压缩成zip后重名为jar

=========================================

aspose-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();}}}

Manifest-Version: 1.0
Application-Name: Aspose.Cells for java
Implementation-Title: Aspose.Cells for java
Copyright: Copyright 2001-2021 Aspose Pty Ltd
Bundle-SymbolicName: com.aspose.cells
Implementation-Version: 21.2.0
Release-Date: 2021-02-04
Specification-Vendor: Aspose Pty Ltd
Bundle-ManifestVersion: 2
Specification-Title: Aspose.Cells for java
Application-Library-Allowable-Codebase: *
Bundle-Vendor: Aspose Pty Ltd
Import-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 Ltd
Export-Package: com.aspose.cells
Minimum-JDK: 1.6
Bundle-Name: Aspose.Cells for java
Bundle-Version: 21.2.0
Caller-Allowable-Codebase: *
Permissions: all-permissions
Name: Aspose.Cells for java
Specification-Version: 21.2.0
Created-By: 1.8.0_172 (Oracle Corporation)

=========================================

aspose-cells-23.6

同样根据 setLicense 方法设置许可证入手,反编译阅读源码。

 根据关键代码进入 v_9 类中的 a 方法。

 

 

 生成 License.class 文件

    public static void main(String[] args) {try {ClassPool pool = ClassPool.getDefault();// jar文件路径pool.insertClassPath("D:/aspose-cells-23.6.jar");// 类名CtClass ctClass = pool.get("com.aspose.cells.License");// 方法名和参数CtMethod ctMethod = ctClass.getMethod("setLicense", "(Ljava/io/InputStream;)V");ctMethod.setBody("{ org.w3c.dom.Document document = null;com.aspose.cells.v_9 v_9 = new com.aspose.cells.v_9();v_9.a(document); }");// 方法名和参数ctMethod = ctClass.getMethod("setLicense", "(Ljava/lang/String;)V");ctMethod.setBody("{ org.w3c.dom.Document document = null;com.aspose.cells.v_9 v_9 = new com.aspose.cells.v_9();v_9.a(document); }");//这里会将这个创建的类对象编译为.class文件ctClass.writeFile("D:/");} catch (Exception e) {e.printStackTrace();}}

 生成 v_9.class 文件

    public static void main(String[] args) {try {ClassPool pool = ClassPool.getDefault();// jar文件路径pool.insertClassPath("D:/aspose-cells-23.6.jar");// 类名CtClass ctClass = pool.get("com.aspose.cells.v_9");// 方法名和参数CtMethod ctMethod = ctClass.getMethod("a", "(Ljava/lang/String;)I");ctMethod.setBody("{ return 1; }");// 方法名和参数ctMethod = ctClass.getMethod("a", "(Lorg/w3c/dom/Document;)V");ctMethod.setBody("{ com.aspose.cells.License.a = \"123\";a = this;com.aspose.cells.r98.a(); }");//这里会将这个创建的类对象编译为.class文件ctClass.writeFile("D:/");} catch (Exception e) {e.printStackTrace();}}

我这里使用的是,360压缩打开 aspose-cells-23.6.jar 文件,将  License.class 和 v_9.class 拖到对应的包路径下。

删除 META-INF 目录下的  *.RSA *.SF 签名文件

修改 *.MF 文件只保存如下:

Manifest-Version: 1.0
Application-Name: Aspose.Cells for java
Implementation-Title: Aspose.Cells for java
Copyright: Copyright 2001-2023 Aspose Pty Ltd
Bundle-SymbolicName: com.aspose.cells
Implementation-Version: 23.6.0
Release-Date: 2023-06-08
Specification-Vendor: Aspose Pty Ltd
Bundle-ManifestVersion: 2
Specification-Title: Aspose.Cells for java
Application-Library-Allowable-Codebase: *
Bundle-Vendor: Aspose Pty Ltd
Import-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 Ltd
Export-Package: com.aspose.cells
Minimum-JDK: 1.6
Bundle-Name: Aspose.Cells for java
Bundle-Version: 23.6.0
Caller-Allowable-Codebase: *
Permissions: all-permissions
Name: Aspose.Cells for java
Specification-Version: 23.6.0
Created-By: 1.8.0_172 (Oracle Corporation)

这篇关于aspose-cells-20.5的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/189476

相关文章

vivado error:Combinatorial Loop Alert:1 LUT cells form a combinatorial loop

VIVADO ERROR :Combinatorial Loop Alert:1 LUT cells form a combinatorial loop vivao生成bit流时发生报错,如下图所示定位原因解决 vivao生成bit流时发生报错,如下图所示 定位原因 在三段式状态机中,组合逻辑代码if else 语句未写全只写了if…elsif…,没有写else,导致错误

Aspose.Cells、Aspose.Words常用功能

一般使用 Excel求和Word插入内容新建插入图片插入表格 Excel求和 冒号 为 范围 B2~B11 逗号 为 B1+B11 worksheet.Cells["A4"].Formula = "=SUM(A1:A3)";worksheet.Cells["A4"].Formula = "=SUM(A1,A3)"; 单元格设置公式后,保存 Excel 文件后打开即可得到

CF #364 (Div. 2) (B. Cells Not Under Attack 标记)

题目连接 在一个n*n的网格上,若果某个位置上放了一个棋子,那么棋子所在的行和列就算被覆盖了,每次放一个棋子问剩余的没有覆盖的点有几个 使用,两个数组分别标记行和列,在用两个变量保存X集合的可用数,Y集合的可用数,那么放入一个棋子,检查下X,Y集合就好了 #include<cstdio>#include<algorithm>#include<iostream>#include<vect

获得tableview中可见的cells

UITableView控件,是最常用的控件,但是,控件里面每个属性,如果,没用过,不一定到用的时候,能够很快的找到。       获得tableview中可见的cells,是系统的方法:    @property (nonatomic, readonly) NSArray<__kindof UITableViewCell *> *visibleCells;//获得所有可见的c

aspose.pdf实现图片转pdf

/*** 图片转pdf*/public static void ImagesToPdf(){String folderPath = "D:\\Desktop\\xuanku";File folder = new File(folderPath);List<String> images = new ArrayList<>();// 检查文件夹是否存在if (folder.exists() && f

【Aspose-words】导出html到word

1、由于Mavenzh中央仓库中对于com.aspose.words jar包的缺乏,小编本地maven集成下载的 aspose-words-16.4.0-jdk16.jar 2、 package com.xw.ssm.util.word;import com.alibaba.fastjson.JSONObject;import com.aspose.words.*;import com.

Aspose将doc,ppt转成pdf

1.需要引入的jar包 链接: https://pan.baidu.com/s/1t3wqq7KrHi50K9KX3-Eb9A?pwd=u4se 提取码: u4se  <dependency><groupId>com.aspose</groupId><artifactId>aspose-words-jdk16</artifactId><version>15.8.0</version><scop

C#用Aspose.Cells导出xls

导出代码: using System;using System.Collections;using System.Collections.Generic;using System.IO;using System.Linq;using System.Text;using System.Threading.Tasks;using Aspose.Cells;using WuZiFen

Aspose.Cells转换excel为pdf时,表格撕裂为第二页问题

/// <summary>/// 将excel转换为PDF/// </summary>/// <param name="excelFile">".xls", ".xlsx"类型的文件路径</param>/// <param name="pdfFilePath">生成的PDF文件</param>/// <returns></returns>public static async Task

java word aspose获取doc、或者docx总页数

import com.aspose.words.Document; Document doc = new Document(file.getInputStream());int num = doc.getPageCount();