- 點擊跳轉=>Unity3D特效百例
- 點擊跳轉=>案例項目實戰(zhàn)源碼
- 點擊跳轉=>游戲腳本-輔助自動化
- 點擊跳轉=>Android控件全解手冊
- 點擊跳轉=>Scratch編程案例
??關于作者
眾所周知,人生是一個漫長的流程,不斷克服困難,不斷反思前進的過程。在這個過程中會產(chǎn)生很多對于人生的質疑和思考,于是我決定將自己的思考,經(jīng)驗和故事全部分享出來,以此尋找共鳴 ?。?!
專注于Android/Unity和各種游戲開發(fā)技巧,以及各種資源分享(網(wǎng)站、工具、素材、源碼、游戲等)
有什么需要歡迎私我,交流群讓學習不再孤單。
??實踐過程
前段時間研究騰訊的TBS離線,雖然搞出來了,但是在學習過程中也發(fā)現(xiàn)了另一個文檔內(nèi)容,也就是Aspose。還不錯,也挺全面,不僅支持的文檔類型非常多,而且在各種設備上都有對應的sdk。
分為免費版和付費版,其實針對大部分情況免費版完全夠用了,只是免費版有水印,也有長度數(shù)量限制。我們就學習下整個過程。
??思路分析
思路?哈哈哈,不寫了,相信很多人也不關心這個,只關心最終結果。我們直接看實際操作。
注:不保證所有版本通用。但思路是setLicense方法里的注冊方法進行修改。
com.aspose.pdf.License pdfLicense=new com.aspose.pdf.License();
com.aspose.words.License wordsLicense=new com.aspose.words.License();
com.aspose.slides.License slidesLicense = new com.aspose.slides.License();
com.aspose.cells.License cellsLicense = new com.aspose.cells.License();
//請點擊這里的setLicense方法進入查看源碼,不同版本對words 的破解方法名不一樣,但道理差不多
pdfLicense.setLicense("");
wordsLicense.setLicense("");
slidesLicense.setLicense("");
cellsLicense.setLicense("");
??動手操作
需要IntelliJ IDEA工具,然后創(chuàng)建一個新的java項目。
首先你需要拿到Aspose的jar包,一共四個,這四個包含pdf的,word的,excel的,ppt的。同時必須需要javassist的包。
方式一:你可以自行去官方下載: Aspose ,下載完放到本地lib下,然后利用本地記在的方式
<!-- aspose 文檔操作工具包,項目本地lib目錄引入 -->
<dependency><!--word-->
<groupId>com.aspose</groupId>
<artifactId>aspose-words</artifactId>
<scope>system</scope>
<systemPath>${basedir}/lib/aspose-words-21.1.0-jdk17.jar</systemPath>
</dependency>
<dependency><!--pdf-->
<groupId>com.aspose</groupId>
<artifactId>aspose-pdf</artifactId>
<scope>system</scope>
<systemPath>${basedir}/lib/aspose-pdf-21.8.jar</systemPath>
</dependency>
<dependency><!--excel-->
<groupId>com.aspose</groupId>
<artifactId>aspose-cells</artifactId>
<scope>system</scope>
<systemPath>${basedir}/lib/aspose-cells-21.8.jar</systemPath>
</dependency>
<dependency><!--pptx-->
<groupId>com.aspose</groupId>
<artifactId>aspose-slides</artifactId>
<scope>system</scope>
<systemPath>${basedir}/lib/aspose-slides-21.8-jdk16.jar</systemPath>
</dependency>
<dependency><!--aspose的jar破解工具-->
<groupId>org.javassist</groupId>
<artifactId>javassist</artifactId>
<version>3.20.0-GA</version>
</dependency>
方式二:或者利用IntelliJ IDEA動態(tài)依賴,依賴方式:
在pom.xml配置aspose的jar包倉庫
<repositories>
<repository>
<id>AsposeJavaAPI</id>
<name>Aspose Java API</name>
<url>https://repository.aspose.com/repo/</url>
</repository>
</repositories>
然后分別加對應的依賴并刷新pom文件進行下載:
<dependency>
<!--word-->
<groupId>com.aspose</groupId>
<artifactId>aspose-words</artifactId>
<version>21.11</version>
<classifier>jdk17</classifier>
</dependency>
<dependency>
<!--pdf-->
<groupId>com.aspose</groupId>
<artifactId>aspose-pdf</artifactId>
<version>21.8</version>
</dependency>
<dependency>
<!--excel-->
<groupId>com.aspose</groupId>
<artifactId>aspose-cells</artifactId>
<version>21.8</version>
</dependency>
<dependency>
<!--pptx-->
<groupId>com.aspose</groupId>
<artifactId>aspose-slides</artifactId>
<version>21.8</version>
<classifier>jdk16</classifier>
</dependency>
<dependency>
<!--jar破解工具-->
<groupId>org.javassist</groupId>
<artifactId>javassist</artifactId>
<version>3.20.0-GA</version>
</dependency>
slides-21.8-版本學習
//傳遞的是你的jar本地絕對路徑,如“D:\\”
private static void modifyPptJar(String jarName) {
try {
//這一步是完整的jar包路徑,選擇自己解壓的jar目錄
ClassPool.getDefault().insertClassPath(jarName);
CtClass zzZJJClass = ClassPool.getDefault().getCtClass("com.aspose.slides.internal.of.public");
CtMethod[] methodA = zzZJJClass.getDeclaredMethods();
for (CtMethod ctMethod : methodA) {
CtClass[] ps = ctMethod.getParameterTypes();
if (ps.length == 3 && ctMethod.getName().equals("do")) {
System.out.println("ps[0].getName==" + ps[0].getName());
ctMethod.setBody("{}");
}
}
//這一步就是將破譯完的代碼放在桌面上
zzZJJClass.writeFile(Desktop);
} catch (Exception e) {
System.out.println("錯誤==" + e);
}
}
words-21.11版本學習
//傳遞的是你的jar本地絕對路徑,如“D:\\”
private static void crackAsposeWordsJar(String jarName){
try {
//這一步是完整的jar包路徑,選擇自己解壓的jar目錄
ClassPool.getDefault().insertClassPath(jarName);
//獲取指定的class文件對象
CtClass zzZJJClass = ClassPool.getDefault().getCtClass("com.aspose.words.zzXDb");
//從class對象中解析獲取指定的方法
CtMethod[] methodA = zzZJJClass.getDeclaredMethods("zzY0J");
//遍歷重載的方法
for (CtMethod ctMethod : methodA) {
CtClass[] ps = ctMethod.getParameterTypes();
if (ctMethod.getName().equals("zzY0J")) {
System.out.println("ps[0].getName==" + ps[0].getName());
//替換指定方法的方法體
ctMethod.setBody("{this.zzZ3l = new java.util.Date(Long.MAX_VALUE);this.zzWSL = com.aspose.words.zzYeQ.zzXgr;zzWiV = this;}");
}
}
//這一步就是將破譯完的代碼放在桌面上
zzZJJClass.writeFile(Desktop);
//獲取指定的class文件對象
CtClass zzZJJClassB = ClassPool.getDefault().getCtClass("com.aspose.words.zzYKk");
//從class對象中解析獲取指定的方法
CtMethod methodB = zzZJJClassB.getDeclaredMethod("zzWy3");
//替換指定方法的方法體
methodB.setBody("{return 256;}");
//這一步就是將破譯完的代碼放在桌面上
zzZJJClassB.writeFile(Desktop);
} catch (Exception e) {
System.out.println("錯誤==" + e);
}
}
cells-21.8版本學習
//傳遞的是你的jar本地絕對路徑,如“D:\\”
public static void crackAsposeCells(String JarPath) throws NotFoundException,CannotCompileException, IOException {
// 這個是得到反編譯的池
ClassPool pool = ClassPool.getDefault();
// 取得需要反編譯的jar文件,設定路徑
pool.insertClassPath(JarPath);
CtClass ctClass = pool.get("com.aspose.cells.License");
CtMethod method_isLicenseSet = ctClass.getDeclaredMethod("isLicenseSet");
method_isLicenseSet.setBody("return true;");
CtMethod method_setLicense = ctClass.getDeclaredMethod("setLicense");
method_setLicense.setBody("{ a = new com.aspose.cells.License();\n" +
" com.aspose.cells.zbkl.a();}");
CtMethod methodL = ctClass.getDeclaredMethod("l");
methodL.setBody("return new java.util.Date(Long.MAX_VALUE);");
ctClass.writeFile(Desktop);
}
pdf-21.8版本學習
//傳遞的是你的jar本地絕對路徑,如“D:\\”
private static void crackAsposePdfJar(String jarName) {
try {
ClassPool.getDefault().insertClassPath(jarName);
CtClass ctClass = ClassPool.getDefault().getCtClass("com.aspose.pdf.ADocument");
CtMethod[] declaredMethods = ctClass.getDeclaredMethods();
int num = 0;
for (int i = 0; i < declaredMethods.length; i++) {
if (num == 2) {
break;
}
CtMethod method = declaredMethods[i];
CtClass[] ps = method.getParameterTypes();
if (ps.length == 2
&& method.getName().equals("lI")
&& ps[0].getName().equals("com.aspose.pdf.ADocument")
&& ps[1].getName().equals("int")) {
//源碼ADocument類的這個方法限制頁數(shù):
// static boolean lI(ADocument var0, int var1) {
// return !lb() && !lj() && !var0.lt() && var1 > 4;
// }
// 最多只能轉換4頁,處理返回false,無限制頁數(shù)
System.out.println(method.getReturnType());
System.out.println(ps[1].getName());
method.setBody("{return false;}");
num = 1;
}
if (ps.length == 0 && method.getName().equals("lt")) {
// 水印處理
method.setBody("{return true;}");
num = 2;
}
}
//修改完,把類的輸出到指定目錄(桌面下)
ctClass.writeFile(Desktop);
} catch (NotFoundException e) {
e.printStackTrace();
} catch (CannotCompileException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
上面執(zhí)行完畢之后,會對應的生成新的jar文件,然后利用壓縮包打開這個jar文件,找到這倆文件
META-INF/37E3C32D.SF
META-INF/37E3C32D.RSA
如果有則刪除,如果沒有不用管。接著創(chuàng)建個license.xml的文件放到resources目錄下
<License>
<Data>
<Products>
<Product>Aspose.Total for Java</Product>
<Product>Aspose.Words for Java</Product>
</Products>
<EditionType>Enterprise</EditionType>
<SubscriptionExpiry>20991231</SubscriptionExpiry>
<LicenseExpiry>20991231</LicenseExpiry>
<SerialNumber>8bfe198c-7f0c-4ef8-8ff0-acc3237bf0d7</SerialNumber>
</Data>
<Signature>
sNLLKGMUdF0r8O1kKilWAGdgfs2BvJb/2Xp8p5iuDVfZXmhppo+d0Ran1P9TKdjV4ABwAgKXxJ3jcQTqE/2IRfqwnPf8itN8aFZlV3TJPYeD3yWE7IT55Gz6EijUpC7aKeoohTb4w2fpox58wWoF3SNp6sK6jDfiAUGEHYJ9pjU=
</Signature>
</License>
FileInputStream fis = new FileInputStream("你存放的license.xml路徑");
License license=new License();
license.setLicense(fis);
至此去除了水印和頁數(shù)限制。
??其他
??作者:小空和小芝中的小空
??轉載說明-務必注明來源:https://zhima.blog.csdn.net/
??這位道友請留步??,我觀你氣度不凡,談吐間隱隱有王者霸氣??,日后定有一番大作為???。。∨赃呌?strong>點贊??收藏??今日傳你,點了吧,未來你成功??,我分文不取,若不成功??,也好回來找我。文章來源:http://www.zghlxwxcb.cn/news/detail-542476.html
溫馨提示:點擊下方卡片獲取更多意想不到的資源。文章來源地址http://www.zghlxwxcb.cn/news/detail-542476.html
到了這里,關于Android修行手冊 - 文檔插件Aspose的jar包去除所有限制學習版的文章就介紹完了。如果您還想了解更多內(nèi)容,請在右上角搜索TOY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關文章,希望大家以后多多支持TOY模板網(wǎng)!