无废话aspose-words-18.6 java版破解
用到的工具:
JByteMod、javassist 可在文章最下方下載
下載原版aspose-words-18.6-jdk16.jar
使用執行JByteMod-1.8.0.jar反編譯其源碼查看其注冊文件的加載類
??? package com.aspose.words;
??? ?
??? import asposewobfuscated.*;
??? import java.io.*;
??? ?
??? public class License
??? {
??????? @Deprecated
??????? public boolean getIsLicensed() {
??????????? return zzZLX.zzZJT() == 1;
??????? }
?????? ?
??????? public boolean isLicensed() {
??????????? return zzZLX.zzZJT() == 1;
??????? }
?????? ?
??????? public void setLicense(final String licenseName) throws Exception {
??????????? if (licenseName == null) {
??????????????? throw new NullPointerException("licenseName");
??????????? }
??????????? new zzZLX().zzY(licenseName, zz2W.zzA3());
??????? }
?????? ?
??????? public void setLicense(final InputStream stream) throws Exception {
??????????? if (stream == null) {
??????????????? throw new NullPointerException("stream");
??????????? }
??????????? new zzZLX().zzX(stream);
??????? }
??? }
可見主要的處理類為zzZLX,反編譯后找到關鍵代碼如下
??????? private static void zzZ(final Node node, final Node node2) throws Exception {
??????????? byte[] bytes;
??????????? if (node != null) {
??????????????? final StringBuilder sb;
??????????????? zzZ(sb = new StringBuilder(), node);
??????????????? bytes = sb.toString().getBytes("UTF-16LE");
??????????? }
??????????? else {
??????????????? bytes = new byte[0];
??????????? }
??????????? byte[] decode;
??????????? if (node2 != null) {
??????????????? decode = zz35.decode(node2.getFirstChild().getNodeValue());
??????????? }
??????????? else {
??????????????? decode = new byte[0];
??????????? }
??????????? final Signature instance = Signature.getInstance("SHA1withRSA");
??????????? instance.initVerify(KeyFactory.getInstance("RSA").generatePublic(new RSAPublicKeySpec(new BigInteger(1, zzZg(zz35.decode("0nRuwNEddXwLfXB7pw66G71MS93gW8mNzJ7vuh3Sf4VAEOBfpxtHLCotymv1PoeukxYe31K441Ivq0Pkvx1yZZG4O1KCv3Omdbs7uqzUB4xXHlOub4VsTODzDJ5MWHqlRCB1HHcGjlyT2sVGiovLt0Grvqw5+QXBuinoBY0suX0="))), new BigInteger(1, zzZg(zz35.decode("AQAB"))))));
??????????? instance.update(bytes);
??????????? if (!instance.verify(decode)) {
??????????????? throw new IllegalStateException("The signature is invalid.");
??????????? }
??????? }
可見這是使用rsa加密驗證許可證的合法性,只需要屏蔽驗證過程許可證即有效,使用javassist進行代碼修改:
?? ??? ?public static void changeMethod() throws Exception {
?? ??? ??? ?ClassPool.getDefault().insertClassPath(
?? ??? ??? ??? ??? ?"D:/aspose-words-18.6-jdk16.jar");
?? ??? ??? ?CtClass c2 = ClassPool.getDefault()
?? ??? ??? ??? ??? ?.getCtClass("com.aspose.words.zzZLX");
?? ??? ??? ?CtMethod[] ms = c2.getDeclaredMethods();
?? ??? ??? ?for (CtMethod c : ms) {
?? ??? ??? ??? ?System.out.println(c.getName());
?? ??? ??? ??? ?CtClass[] ps = c.getParameterTypes();
?? ??? ??? ??? ?for (CtClass cx : ps) {
?? ??? ??? ??? ??? ?System.out.println("\t" + cx.getName());
?? ??? ??? ??? ?}
??? ?
?? ??? ??? ??? ?if (c.getName().equals("zzZ") && ps.length == 2
?? ??? ??? ??? ??? ??? ?&& ps[0].getName().equals("org.w3c.dom.Node")
?? ??? ??? ??? ??? ??? ?&& ps[1].getName().equals("org.w3c.dom.Node")) {
?? ??? ??? ??? ??? ?System.out.println("find it!");
?? ??? ??? ??? ??? ?c.insertBefore("{return;}");
?? ??? ??? ??? ?}
??? ?
?? ??? ??? ?}
?? ??? ??? ?c2.writeFile();
??? ?
?? ??? ?}
以上可生成zzZLX.class文件,放入jar文件中替換,為防止文件指紋校驗,刪除jar文件中的META-INF文件夾
下面生成一個許可文件com.aspose.words.lic_2999.xml:
??? <License>
????? <Data>
??????? <Products>
????????? <Product>Aspose.Words for Java</Product>
??????? </Products>
??????? <EditionType>Enterprise</EditionType>
??????? <SubscriptionExpiry>29991231</SubscriptionExpiry>
??????? <LicenseExpiry>29991231</LicenseExpiry>
??????? <SerialNumber>---</SerialNumber>
????? </Data>
????? <Signature>---</Signature>
??? </License>
為方便使用,我將此文件放入了jar文件根目錄下
以下為使用代碼,Enjoy it:)
??? package test_fileconvert;
??? ?
??? import java.io.File;
??? import java.io.FileOutputStream;
??? import java.io.InputStream;
??? ?
??? import com.aspose.words.Document;
??? import com.aspose.words.License;
??? import com.aspose.words.SaveFormat;
??? ?
??? public class Doc2Pdf {
??? ?
?? ??? ?public static void main(String[] args) throws Exception {
?? ??? ??? ?doc2pdf("e:/pjtemp/f_new.docx", "e:/pjtemp/f_new.pdf");
?? ??? ?}
??? ?
?? ??? ?public static boolean getLicense() throws Exception {
?? ??? ??? ?boolean result = false;
?? ??? ??? ?try {
??? ?
?? ??? ??? ??? ?InputStream is = com.aspose.words.Document.class
?? ??? ??? ??? ??? ??? ?.getResourceAsStream("/com.aspose.words.lic_2999.xml");
?? ??? ??? ??? ?License aposeLic = new License();
?? ??? ??? ??? ?aposeLic.setLicense(is);
?? ??? ??? ??? ?result = true;
?? ??? ??? ??? ?is.close();
?? ??? ??? ?} catch (Exception e) {
?? ??? ??? ??? ?e.printStackTrace();
?? ??? ??? ??? ?throw e;
?? ??? ??? ?}
?? ??? ??? ?return result;
?? ??? ?}
??? ?
?? ??? ?public static void doc2pdf(String inPath, String outPath) throws Exception {
?? ??? ??? ?if (!getLicense()) { // 驗證License 若不驗證則轉化出的pdf文檔有水印
?? ??? ??? ??? ?throw new Exception("com.aspose.words lic ERROR!");
?? ??? ??? ?}
??? ?
?? ??? ??? ?System.out.println(inPath + " -> " + outPath);
??? ?
?? ??? ??? ?try {
?? ??? ??? ??? ?long old = System.currentTimeMillis();
?? ??? ??? ??? ?File file = new File(outPath);
?? ??? ??? ??? ?FileOutputStream os = new FileOutputStream(file);
?? ??? ??? ??? ?Document doc = new Document(inPath); // word文檔
?? ??? ??? ??? ?// 支持RTF HTML,OpenDocument, PDF,EPUB, XPS轉換
?? ??? ??? ??? ?doc.save(os, SaveFormat.PDF);
?? ??? ??? ??? ?long now = System.currentTimeMillis();
?? ??? ??? ??? ?System.out.println("convert OK! " + ((now - old) / 1000.0) + "秒");
?? ??? ??? ?} catch (Exception e) {
?? ??? ??? ??? ?e.printStackTrace();
?? ??? ??? ?}
?? ??? ?}
??? }
注意:此教程及下載文件只允許學習使用,不得用于商業用途,請購買授權正版 aspose官網。
--------------------------------------------------------------------------------------------------
下載:
aspose-words-18.6-jdk16-crack.jar
JByteMod-Beta-master編譯版
jboss-javassist-javassist-rel_3_23_0_ga ?
--------------------- ?
作者:shadowkiss ?
來源:CSDN ?
原文:https://blog.csdn.net/shadowkiss/article/details/80868472 ?
版權聲明:本文為博主原創文章,轉載請附上博文鏈接!
總結
以上是生活随笔為你收集整理的无废话aspose-words-18.6 java版破解的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 工作209:整理订单的重置逻辑
- 下一篇: 前端学习(2670): vue3.0实战