Aspose.Words.jdk16.jar 实现无需安装Office ,通过制作Word模版,Java程序就可以自动生成Word文件,试用版本会在生成的word文件头部添加:
Evaluation Only. Created with Aspose.Words. Copyright 2003-2011 Aspose Pty Ltd.
而且对于文件大小也有限制.
Java的破解是相当Easy的,和dll破解不是在一个档次,今天手痒就顺手把它破解了.记录一下破解过程,供大家交流学习使用。
1. 下载Asm 4.0 版本:
http://download.forge.objectweb.org/asm/asm-4.0-bin.zip
2. 找到许可限制文件:
使用Java Decompiler 找打许可限制类:
ZIZ.class
static void M(Document paramDocument)
{
if (GM.aX() == GL.ZFE) {
return;
}
String str1 = "Evaluation Only. Created with Aspose.Words. Copyright 2003-2011 Aspose Pty Ltd.";
String str2 = "This document was truncated here because it was created using Aspose.Words in Evaluation Mode.";
Ã(paramDocument, str1, str2);
}
看来方法M就是许可限制的核心方法。
3. 修改字节码
首先使用ASM重命名该方法,然后新增一个空的方法。
public class AsmModify extends ClassLoader implements Opcodes {
public static void main(String[] args) throws IOException, IllegalArgumentException, SecurityException, IllegalAccessException, InvocationTargetException {
ClassReader cr = new ClassReader("com.aspose.words.ZIZ");
ClassWriter cw = new ClassWriter(cr, ClassWriter.COMPUTE_MAXS);
ClassVisitor cv = new MethodChangeClassAdapter(cw);
static class MethodChangeClassAdapter extends ClassVisitor implements Opcodes {
public MethodChangeClassAdapter(final ClassVisitor cv) {
super(Opcodes.ASM4, cv);
}
@Override
public void visit(int version, int access, String name, String signature, String superName, String[] interfaces) {
if (cv != null) {
cv.visit(version, access, name, signature, superName, interfaces);
}
}
@Override
public void visitCode() {
super.visitCode();
}
}
}
修改后的class多了一个方法:
这样就完成破解了。
4. 打包
使用Winrar把修改后的ZIZ.class 放回Aspose.Words.jdk16.jar,删除签名文件: