吾爱破解 - 52pojie.cn

 找回密码
 注册[Register]

QQ登录

只需一步,快速开始

查看: 1488|回复: 33
收起左侧

[原创] MyBatisCodeHelper-Pro-3.3.6的新激活方案

  [复制链接]
wyakuan 发表于 2024-10-15 17:50
本帖最后由 wyakuan 于 2024-10-15 18:37 编辑

感谢大佬@lvbuqing 的帖子,原帖地址:
https://www.52pojie.cn/thread-1967307-1-1.html

感谢大佬@ljkgpxs  提供的修改反序列化的思路:
通过修改反序列化,添加 userMac、valid、validTo、paidKey 的属性值,激活时输入任意字符,即可实现在线激活或者离线激活

1、找到修改反序列化的类和方法
安装插件后,咱们分别试下在线激活和离线激活,输入任意字符点激活,
在线激活:报错不好定位错误在哪,离线激活:报错直接显示错误在哪
2024-10-15_155125.png

咱们就从离线激活入手,报错信息如下:
[Java] 纯文本查看 复制代码
激活码不正常java.lang.RuntimeException: com.ccnode.codegenerator.af.f.b: 密文有问题
at com.ccnode.codegenerator.af.f.d.b(SourceFile:281)
at com.ccnode.codegenerator.af.f.e.a(SourceFile:19)
at com.ccnode.codegenerator.af.b.a.a(SourceFile:412)
at com.ccnode.codegenerator.af.c.a(SourceFile:65)
at com.ccnode.codegenerator.b.a.doOKAction(SourceFile:219)


打开反编译工具 jadx-gui-1.5.0.exe,将 instrumented-MyBatisCodeHelper-Pro241-3.3.6+2321.jar 拖进去。

找到 com.ccnode.codegenerator.af.f.d.b(SourceFile:281):
这是激活时验证公钥的地方,这不是我们要找的。
2024-10-15_162321.png


找到 com.ccnode.codegenerator.af.f.e.a(SourceFile:19):
看到 Base64.getDecoder().decode 和 f1767a.fromJson(str2, f.class),这是对字符串(str)进行解码,然后反序列化转成对象(f)的过程,这就是我们要找的。
2024-10-15_162841.png

我们看一下方法返回的对象(f)的结构:
2024-10-15_163739.png

到这我们就找到了反序列化的方法,我们修改一下这个类的方法,添加 userMac、valid、validTo、paidKey 的属性值,
修改这个方法需要添加 gson 和 jettison 两个Jar包,可以通过Maven添加依赖后下载(pom.xml添加以下依赖)。
[XML] 纯文本查看 复制代码
<dependency>
   <groupId>com.google.code.gson</groupId>
   <artifactId>gson</artifactId>
   <version>2.11.0</version>
</dependency>
<dependency>
    <groupId>org.codehaus.jettison</groupId>
    <artifactId>jettison</artifactId>
    <version>1.5.4</version>
</dependency>

[Java] 纯文本查看 复制代码
File oldJar = new File("D:\\test\\instrumented-MyBatisCodeHelper-Pro241-3.3.6+2321.jar");
String decodeClassFullName = "com.ccnode.codegenerator.af.f.e";
String jarDir = oldJar.getParent();

// 加载类
ClassPool classPool = ClassPool.getDefault();
// 添加需要修改和所依赖的Jar包
classPool.appendClassPath(oldJar.getAbsolutePath());
classPool.appendClassPath("D:\\test\\gson-2.11.0.jar");
classPool.appendClassPath("D:\\test\\jettison-1.5.4.jar");

// 获取需要修改的解码类
CtClass decodeCtClass = classPool.get(decodeClassFullName);
// 解码类的解码方法并修改
CtMethod decodeCtMethod = Arrays.stream(decodeCtClass.getDeclaredMethods())
        .filter(method -> {
            try {
                return Modifier.isPublic(method.getModifiers())
                        && method.getParameterTypes().length == 1
                        && String.class.getSimpleName().equals(method.getParameterTypes()[0].getSimpleName());
            } catch (NotFoundException e) {
                throw new RuntimeException(e);
            }
        }).findFirst().orElseThrow();
String returnType = decodeCtMethod.getReturnType().getName();
decodeCtMethod.setBody("{"
        // 添加 userMac、valid、validTo、paidKey 属性值
        + " org.codehaus.jettison.json.JSONObject jsonObject;"
        + " try {"
        + "     jsonObject = new org.codehaus.jettison.json.JSONObject($1);"
        + " } catch (Exception e) {"
        + "     jsonObject = new org.codehaus.jettison.json.JSONObject();"
        + " }"
        + " if (!jsonObject.has(\"userMac\") || jsonObject.get(\"userMac\") == null) {"
        + "     String macAddress;"
        + "     try {"
        + "         java.net.InetAddress ip = java.net.InetAddress.getLocalHost();"
        + "         java.net.NetworkInterface network = java.net.NetworkInterface.getByInetAddress(ip);"
        + "         byte[] mac = network.getHardwareAddress();"
        + "         StringBuilder stringBuilder = new StringBuilder();"
        + "         for (int i = 0; i < mac.length; i++) {"
        + "             byte b = mac[i];"
        + "             stringBuilder.append(Character.forDigit((b >> 4) & 0xF, 16));"
        + "             stringBuilder.append(Character.forDigit(b & 0xF, 16));"
        + "             stringBuilder.append(\"-\");"
        + "         }"
        + "         macAddress = stringBuilder.substring(0, stringBuilder.length() - 1).toUpperCase();"
        + "     } catch (Exception e) {"
        + "         macAddress = \"00-00-00-00-00-00\";"
        + "     }"
        + "     jsonObject.put(\"userMac\", macAddress);"
        + " }"
        + " jsonObject.put(\"valid\", true);"
        + " jsonObject.put(\"validTo\", 4102415999000L);"
        + " jsonObject.put(\"paidKey\", java.util.UUID.randomUUID().toString());"
        + " $1 = jsonObject.toString();"
        // 将Json字符串转换成指定对象
        + "com.google.gson.Gson gson = new com.google.gson.Gson();"
        + returnType + " result = (" + returnType + ")gson.fromJson($1," + returnType + ".class);"
        + "return result;"
        + "}");
// 将修改后的解码类文件写到本地
decodeCtClass.writeFile(jarDir);

// 修改强制退出类
String exitClassFullName = "com.ccnode.codegenerator.myconfigurable.Profile";
CtClass exitCtClass = classPool.get(exitClassFullName);
exitCtClass.getDeclaredMethod("getIfUseNewMapping").setBody("{return 1;}");
// 将修改后的解码类文件写到本地
exitCtClass.writeFile(jarDir);

我们将修改好的 com.ccnode.codegenerator.af.f.e.class 文件替换原来Jar包里的文件,试着在线和离线激活,随意输入字符都能激活成功
2024-10-15_165603.png

PS:后面新版本如何快速找到这个类?在 jadx-gui-1.5.0.exe 的工具栏点文本搜索,输入“private static Gson”,一下子就找到了


2、哈哈,显示激活成功了,是不是很高兴,别急还有坑。

在使用插件生成代码时,会出现弹窗,然后强制idea退出
2024-10-15_165753.png

在 jadx-gui-1.5.0.exe 的工具栏点文本搜索,输入“你正在使用”,点击进去就能看到插件做了判断:
getIfUseNewMapping() > 100 就会出现弹窗,然后强制退出
2024-10-15_172745.png


我们修改下 com.ccnode.codegenerator.myconfigurable.Profile 的 getIfUseNewMapping(),直接返回1即可。
[Java] 纯文本查看 复制代码
// 修改强制退出类
String exitClassFullName = "com.ccnode.codegenerator.myconfigurable.Profile";
CtClass exitCtClass = classPool.get(exitClassFullName);
exitCtClass.getDeclaredMethod("getIfUseNewMapping").setBody("{return 1;}");
// 将修改后的解码类文件写到本地
exitCtClass.writeFile(jarDir);

将修改好的 com.ccnode.codegenerator.myconfigurable.Profile.class 文件替换原来Jar包里的文件,就不会出现弹窗了。


3、将修改好的 class 文件替换原来Jar包里的文件,手动替换容易出错,咱们用Java来替换,生成新的Jar包
[Java] 纯文本查看 复制代码
// 生成新Jar包,并将修改好的类文件添加到新的Jar包中
File newJar = new File(oldJar.getAbsolutePath().replace(".jar", "-new" + ".jar"));
// 修改好的类文件
List<String> editClasses = Stream.of(decodeClassFullName, exitClassFullName).map(item -> item.replace(".", "/") + ".class").toList();
try (JarFile jarFile = new JarFile(oldJar); JarOutputStream jarOutputStream = new JarOutputStream(new FileOutputStream(newJar))) {
    Enumeration<JarEntry> entries = jarFile.entries();
    while (entries.hasMoreElements()) {
        JarEntry entry = entries.nextElement();
        // 将修改后的类文件和原Jar包的类文件,都添加到新的JAR中
        try (InputStream inputStream = editClasses.contains(entry.getName()) ? new FileInputStream(new File(jarDir, entry.getName())) : jarFile.getInputStream(entry)) {
            jarOutputStream.putNextEntry(new JarEntry(entry.getName()));
            byte[] bytes = inputStream.readAllBytes();
            jarOutputStream.write(bytes);
            jarOutputStream.closeEntry();
        }
    }
}


免费评分

参与人数 5吾爱币 +4 热心值 +5 收起 理由
liuman02 + 1 + 1 用心讨论,共获提升!
rosng + 1 + 1 谢谢@Thanks!
ad910 + 1 + 1 谢谢@Thanks!
Carinx + 1 + 1 谢谢@Thanks!
Tori97 + 1 欢迎分析讨论交流,吾爱破解论坛有你更精彩!

查看全部评分

本帖被以下淘专辑推荐:

发帖前要善用论坛搜索功能,那里可能会有你要找的答案或者已经有人发布过相同内容了,请勿重复发帖。

 楼主| wyakuan 发表于 2024-10-15 18:45
本帖最后由 wyakuan 于 2024-10-16 13:25 编辑

添加一个修改好的

instrumented-MyBatisCodeHelper-Pro241-3.3.6 2321.zip

2.11 MB, 下载次数: 123, 下载积分: 吾爱币 -1 CB

 楼主| wyakuan 发表于 2024-10-16 18:13
本帖最后由 wyakuan 于 2024-10-17 20:47 编辑

如果可以连网,那就用在线激活,在线激活有个一劳永逸的方案,就是修改 Gson Jar包中的Gson.fromJson方法,添加 valid、validTo、paidKey 的属性值即可激活。
好处:不用每个版本都去破解一次,只要将修改好的 gson-2.11.0_modify.jar 放到 MyBatisCodeHelper-Pro 插件的lib目录下即可。
2024-10-16_175220.png

PS:后期如果在idea内直接升级插件的话,记得重新复制 gson-2.11.0_modify.jar 过去,因为在idea内升级,它是先把旧插件删除的,gson包也会被删除

gson-2.11.0_modify.zip

257.67 KB, 下载次数: 45, 下载积分: 吾爱币 -1 CB

heihuwudi 发表于 2024-10-18 09:06
大佬,我这边插件反编译出来的代码和图上不一样呢,是要按照我这边反编译出来的构建json数据吗?
package com.ccnode.codegenerator.af.e;

import com.google.gson.annotations.SerializedName;

/* loaded from: instrumented-MyBatisCodeHelper-Pro241-3.3.6+2321.jar:com/ccnode/codegenerator/af/e/e.class */
public class e {

    /* renamed from: a, reason: collision with root package name */
    @SerializedName("paidKey")
    private String f1764a;

    @SerializedName("userPluginName")
    private String b;

    public String a() {
        return this.f1764a;
    }

    public String b() {
        return this.b;
    }

    public void a(String str) {
        this.f1764a = str;
    }

    public void b(String str) {
        this.b = str;
    }

    public boolean equals(Object obj) {
        if (obj == this) {
            return true;
        }
        if (!(obj instanceof e)) {
            return false;
        }
        e eVar = (e) obj;
        if (!eVar.a(this)) {
            return false;
        }
        String a2 = a();
        String a3 = eVar.a();
        if (a2 == null) {
            if (a3 != null) {
                return false;
            }
        } else if (!a2.equals(a3)) {
            return false;
        }
        String b = b();
        String b2 = eVar.b();
        if (b == null) {
            if (b2 != null) {
                return false;
            }
            return true;
        }
        if (!b.equals(b2)) {
            return false;
        }
        return true;
    }

    protected boolean a(Object obj) {
        return obj instanceof e;
    }

    public int hashCode() {
        String a2 = a();
        int hashCode = (1 * 59) + (a2 == null ? 43 : a2.hashCode());
        String b = b();
        return (hashCode * 59) + (b == null ? 43 : b.hashCode());
    }

    public String toString() {
        return "UnLockRequest(paidKey=" + a() + ", userPluginName=" + b() + ")";
    }
}
似水流年小小 发表于 2024-10-16 07:15
有人试试嘛?  有没有毒
jun269 发表于 2024-10-16 08:08

高手,牛
jun269 发表于 2024-10-16 08:39
本帖最后由 jun269 于 2024-10-16 08:44 编辑

楼主,您打包的这个东西是不是就是一个成品,软件安装完后直接拖进去即可?您这个是不是适合于JetBrains这款软件系列的所有产品?谢谢!
暗影拽神 发表于 2024-10-16 09:25
先收藏在点赞
wangzhe123456 发表于 2024-10-16 09:36
非常棒,支持
Carinx 发表于 2024-10-16 10:22
你小子思路真不错,好一招偷天换日
lvbuqing 发表于 2024-10-16 11:11
。。。为啥不直接拉取gson源码编译一下
 楼主| wyakuan 发表于 2024-10-16 12:14
lvbuqing 发表于 2024-10-16 11:11
。。。为啥不直接拉取gson源码编译一下

你是说,修改gson源码里的fromJson方法吗?这个我试过,改过一版,只能在线激活,离线激活在验证公匙就被拦住了,都走不到fromJson方法。不过对可以联网,选在线激活的倒是一劳永逸哦,等有空我上传下
您需要登录后才可以回帖 登录 | 注册[Register]

本版积分规则

返回列表

RSS订阅|小黑屋|处罚记录|联系我们|吾爱破解 - LCG - LSG ( 京ICP备16042023号 | 京公网安备 11010502030087号 )

GMT+8, 2024-10-18 10:38

Powered by Discuz!

Copyright © 2001-2020, Tencent Cloud.

快速回复 返回顶部 返回列表