1.使用 jd-gui.exe 反編譯查看,直接搜索 License
1.修改
public static boolean isLicenseSet() {
return (a != null);
}
改成
public static boolean isLicenseSet() {
return true;
}
2.修改
public void setLicense(InputStream stream) {
Document document = null;
if (stream != null)
try {
DocumentBuilder documentBuilder = zad.b();
document = documentBuilder.parse(stream);
} catch (Exception exception) {
throw new CellsException(9, zf.a(new byte[] {
-20, 93, -23, 54, -20, -49, -59, 86, -9, -86,
49, 44, -59, 71, -52, -86, -90, 6, -90, -25,
-86, 1, -1, -92, -91, -126, 7, 113, -66, -95,
-121, 16, -122, -126, 7, 104, -40, -70, -10, -37,
126, 7, -111, -121, -121 }) + exception.getMessage());
}
a(document);
}
改成
public void setLicense(InputStream paramInputStream){
a = new License();
zbiw.a();
}
3.修改
private static Date k(String paramString) {
if (paramString == null || paramString.length() < 8)
return null;
SimpleDateFormat simpleDateFormat = new SimpleDateFormat(zf.a(new byte[] {
79, 89, 33, -52, 79, -121, -125, 33, 71, -126,
105, -121 }));
try {
return simpleDateFormat.parse(paramString);
} catch (ParseException parseException) {
throw new IllegalArgumentException(zf.a(new byte[] {
-21, -113, -77, 13, -115, 27, Byte.MIN_VALUE, 35, 103, -52,
-20, -106, 71, 95, 31, -73, -76, -38, 13, 31,
-91, -97, -102, 85, -68, -33, -19, -87, -127, -14,
78, -23, 6, -25, -94, 1, -97, -95, -57, -121 }));
}
}
改成
private static Date k(String paramString){
return new Date(Long.MAX_VALUE);
}
2.生成 aspose-cells-20.7-crack.jar
修改 class 這里使用 javassist:
新建一個(gè) Spring boot 項(xiàng)目:
pom 文件中引用 javassist
<dependency><!--aspose的jar破解工具-->
<groupId>org.javassist</groupId>
<artifactId>javassist</artifactId>
<version>3.20.0-GA</version>
</dependency>
啟動(dòng)類中創(chuàng)建一個(gè)靜態(tài)方法 crackAspose
public static void crackAspose(String JarPath) throws Exception {
// 這個(gè)是得到反編譯的池
ClassPool pool = ClassPool.getDefault();
// 取得需要反編譯的jar文件,設(shè)定路徑
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("F:\\441\\1");
}
在 main 方法中執(zhí)行 crackAspose
try{
crackAspose("F:\\441\\aspose-cells-20.7.jar");
System.out.println("Success!");
}catch (Exception e){
e.printStackTrace();
}
復(fù)制一個(gè) aspose-cells-20.7.jar 改名為 aspose-cells-20.7-crack.zip 然后解壓
把剛才生成的 License.class 文件 替換到解壓的源代碼中。
造一個(gè) License xml 文件,這里文件名為 com.aspose.cells.lic_2999.xml, 位置直接放源代碼解壓的根目錄:
文件內(nèi)容為:
<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>
防止文件指紋校驗(yàn),我們需要?jiǎng)h除掉源代碼解壓包中的 META_INF 文件夾。
最后的根目錄:
壓縮源代碼(注意要是 zip 格式)
然后重命名為:
完成!
3.測(cè)試 aspose-cells-20.7-crack.jar 使用
封裝一個(gè) License 驗(yàn)證方法:
public static boolean authrolizeLicense() {
boolean result = false;
try {
InputStream is = com.aspose.cells.License.class.getResourceAsStream("/com.aspose.cells.lic_2999.xml");
License asposeLicense = new License();
asposeLicense.setLicense(is);
is.close();
result = true;
} catch (Exception e) {
e.printStackTrace();
}
return result;
}
修改 main 方法測(cè)試使用:文章來(lái)源:http://www.zghlxwxcb.cn/news/detail-819349.html
public static void main(String[] args) {
/*
// 修改 License.class
try{
crackAspose("C:\\Users\\DYG\\Desktop\\1\\aspose-cells-20.7.jar");
System.out.println("Success!");
}catch (Exception e){
e.printStackTrace();
}
*/
// 測(cè)試破解后的 aspose-cells-20.7-crack.jar
boolean auth = authrolizeLicense();
if (!auth) {
System.out.println("aspose 許可無(wú)效!");
return;
}
System.out.println("aspose 已就緒!");
try{
Workbook wb = new Workbook("F:\\aaa123.xlsx");
Worksheet ws = wb.getWorksheets().get(0);
ImageOrPrintOptions imgOptions = new ImageOrPrintOptions();
imgOptions.setImageFormat(ImageFormat.getPng());
imgOptions.setCellAutoFit(true);
imgOptions.setOnePagePerSheet(true);
SheetRender render = new SheetRender(ws, imgOptions);
render.toImage(0, "F:\\aaa\\123.png");
}
catch (Exception e){
e.printStackTrace();
}
}
運(yùn)行:
樣板圖
生成圖片文章來(lái)源地址http://www.zghlxwxcb.cn/news/detail-819349.html
到了這里,關(guān)于aspose-cells-20.7.jar 去除水印及次數(shù)限制的文章就介紹完了。如果您還想了解更多內(nèi)容,請(qǐng)?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!