Mybatis Plus 插件注册机
分析的版本为2.83
先看下面的代码
public static synchronized boolean refValid()
{
if (!validated)
{
validated = true;
try
{
String key = MybatisSetting.getInstance().getKey(); //KEY
String result = MybatisSetting.getInstance().getResult(); //RESULT
if ((StringUtils.isBlank(key)) || (StringUtils.isBlank(result)))
{
valid = false;
}
else
{
Key publicKey = Codec.loadKey(key);
Codec.decrypt(publicKey, Hexs.toBytes(result));
valid = true;
}
}
catch (Exception e)
{
valid = false;
}
}
return valid;
}
这里说明KEY和RESULT其实是C:Usersilanyu\.IntelliJIdea2016.2configoptionsmybatis.xml这个文件中获取到的
下面的
Key publicKey = Codec.loadKey(key);
Codec.decrypt(publicKey, Hexs.toBytes(result));
这两句是校验KEY和RESULT的
具体代码如下
public static Key loadKey(String key)
{
Preconditions.checkNotNull(key, "key must not be null");
try
{
KeyFactory factory = KeyFactory.getInstance("RSA");
X509EncodedKeySpec spec = new X509EncodedKeySpec(Hexs.toBytes(key));
return factory.generatePublic(spec);
}
catch (Exception e)
{
throw new RuntimeException(e);
}
}
public static byte[] decrypt(Key key, byte[] raw)
{
Preconditions.checkNotNull(key, "key must not be null");
Preconditions.checkNotNull(raw, "raw must not be null");
try
{
Cipher cipher = Cipher.getInstance("RSA");
cipher.init(2, key);
return cipher.doFinal(raw);
}
catch (Exception e)
{
throw new RuntimeException(e);
}
}
首先对KEY检查,看是否含有公钥,有就通过,没有就失败
然后用KEY里的公钥检测能不能用来解密RESULT
针对性的注册机:
package com.lanyus;
import javax.crypto.BadPaddingException;
import javax.crypto.Cipher;
import javax.crypto.IllegalBlockSizeException;
import javax.crypto.NoSuchPaddingException;
import java.security.*;
import java.security.interfaces.RSAPrivateKey;
import java.security.interfaces.RSAPublicKey;
public class Main {
public static void main(String[] args) throws NoSuchAlgorithmException, NoSuchPaddingException, InvalidKeyException, BadPaddingException, IllegalBlockSizeException {
KeyPairGenerator keygen = KeyPairGenerator.getInstance("RSA");
keygen.initialize(512);
KeyPair kp = keygen.generateKeyPair();
RSAPrivateKey privateKey = (RSAPrivateKey)kp.getPrivate();
RSAPublicKey publicKey = (RSAPublicKey)kp.getPublic();
System.out.println("KEY:\n" + bytesToHexString(publicKey.getEncoded()) + "\n");
Cipher cipher = Cipher.getInstance("RSA");
cipher.init(Cipher.ENCRYPT_MODE,privateKey);
System.out.println("RESULT:\n" + bytesToHexString(cipher.doFinal("ilanyu".getBytes())) + "\n");
}
private static String bytesToHexString(byte[] src){
StringBuilder stringBuilder = new StringBuilder("");
if (src == null || src.length <= 0) {
return null;
}
for (byte aSrc : src) {
int v = aSrc & 0xFF;
String hv = Integer.toHexString(v);
if (hv.length() < 2) {
stringBuilder.append(0);
}
stringBuilder.append(hv);
}
return stringBuilder.toString();
}
}
计算出来的KEY和RESULT:
KEY:
305c300d06092a864886f70d0101010500034b003048024100878e6bea07d7052499419efe4ed4382f426dc5ca2d01140f896a6d0566526c6757ff591347d888bd032f94ce92609ce0cc349de0ba9043dc3163f9667438a14d0203010001
RESULT:
414834456369b9329793f0b42c6c0af67d00516c7ceb136ad221fa0355dc2cd611ed1bcd36b61d00ba7e587d253c1de145831cd0d65b891c9dc34430f9e69c59
说下KEY和RESULT的使用方法:
1、安装官方版mybatis plus插件,然后关闭IDEA
2、hosts中添加127.0.0.1 www.codesmagic.com
3、记事本打开C:Users\{USER}\.IntelliJIdea{VERSION}configoptionsmybatis.xml,写入到对应的字段中,打开idea,mybatis插件已经激活
v2.92 + idea2017.1 + mac 成功, 感谢楼主
C:\Users\{USER}\.IntelliJIdea{VERSION}\config\options\mybatis.xml这个路径在mac上没有找到呢
@skyler
mac上的地址是这个
/Users/{user}/Library/Preferences/IntelliJIdea2017.1/options
v2.92 + idea2017.1.3 + OS X EI Capitian 成功
已激活,感谢大神
亲测可行。谢谢楼主
必须点个赞,成功激活
可以 idea2017.2.1 Mybatis plus 2.92 成功激活 感谢博主分享
插件更新到3.0了,重写了架构,破解不了了
MyBatis plugin 3.13 有破解方法吗
@sdhery
看了下,用的kotlin写的,还用了zkm混淆,暂时没时间搞这些,最近课特多
@ilanyu同求3.1.4破解方法,跪谢
@Freeway
最新版已经破解了,后续会产出破解思路。
https://www.awei.org/2017/11/08/idea-mybatis-plugin-3-21-po-jie-fang-fa/
@Freeway 给力
mybatis plugin 这个插件已经是个注册在国外的公司在运作,最新代码都已经混淆过了,也不是那个路径了,怎么激活呢,求解啊
大佬,最新版本是 3.42 无法破解啊
mybatis plugin 最新到 4.0.3了,有大神破解么?
同求
记事本打开C:Users \ {USER} \ .IntelliJIdea { VERSION} configoptionsmybatis.xml,是在这个里面添加什么啊
人呢 打开这个xml干嘛?