Mybatis Plus 插件激活流程分析

大概描述下流程,之前分析的时候做的记录被删了:IDEA中输入激活码,点击激活后,会采集一些电脑的信息,比如是不是32位系统,是不是64位系统,是不是mac,是不是windows,是不是linux等信息,然后和输入的激活码一起通过POST的方式用json格式传递给https://www.codesmagic.com/activate(出现的uri一共有5个,分别是/、/activate、/report、/e、/any,没有去分析其他的),返回值为json格式,包含有verified、message、key、result,key和result就是http://blog.lanyus.com/archives/235.html这里的key和result,会写入到mybatis.xml中。

我用go语言写了一份授权服务器,源码如下:

package main

import (
    "github.com/valyala/fasthttp"
    "log"
)

var cert = []byte(`-----BEGIN CERTIFICATE-----
MIICizCCAfQCCQCa+Bme67WDODANBgkqhkiG9w0BAQsFADCBiDELMAkGA1UEBhMC
VVMxEjAQBgNVBAgMCUd1YW5nRG9uZzESMBAGA1UEBwwJR3VhbmdaaG91MRswGQYD
VQQKDBJ3d3cuY29kZXNtYWdpYy5jb20xFzAVBgNVBAsMDmNvZGVzbWFnaWMuY29t
MRswGQYDVQQDDBJ3d3cuY29kZXNtYWdpYy5jb20wIBcNMTYwNzI1MDk1MTA1WhgP
MjExNjA3MDEwOTUxMDVaMIGIMQswCQYDVQQGEwJVUzESMBAGA1UECAwJR3VhbmdE
b25nMRIwEAYDVQQHDAlHdWFuZ1pob3UxGzAZBgNVBAoMEnd3dy5jb2Rlc21hZ2lj
LmNvbTEXMBUGA1UECwwOY29kZXNtYWdpYy5jb20xGzAZBgNVBAMMEnd3dy5jb2Rl
c21hZ2ljLmNvbTCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEAxWQssZs7LhWe
JGCSj09n4hRClnomp5dpVJG+Xwbb7EJHy6rHfngbd+RFs+LP9UA3ZLEQV9y5Unra
tiTTQcmpYJkLZhVQBbns0x5lLRoZJB62/stD0alMRmrdGO4glyoo06tB1HgYpytv
3qTsaX2BJ3f5ZUcKMx9yVN8hk6WrfqcCAwEAATANBgkqhkiG9w0BAQsFAAOBgQCn
ijK9yKqr1lVz1JOiDH3XSpr8BxZKeCw416oB/rPQ4xzuMUvUxRIQeaSerABnQh/E
tE742IhI/dJ80a9+7xZyujaZvOGj+wXcDXvNA2LwtaZzaShWNahMJEyitXZIRC4C
ubJKOH/1SV+7HxxBCRxSsY82XBwu0kQyV038ncssRw==
-----END CERTIFICATE-----
`)
var key = []byte(`-----BEGIN RSA PRIVATE KEY-----
MIICWwIBAAKBgQDFZCyxmzsuFZ4kYJKPT2fiFEKWeianl2lUkb5fBtvsQkfLqsd+
eBt35EWz4s/1QDdksRBX3LlSetq2JNNByalgmQtmFVAFuezTHmUtGhkkHrb+y0PR
qUxGat0Y7iCXKijTq0HUeBinK2/epOxpfYEnd/llRwozH3JU3yGTpat+pwIDAQAB
AoGAY045egT5qf6wN+bp9PVi8wd0VJYRmmD/Wc+U8ePWgq75xcoeYU71qsSKGKz0
KJNtCthVu45NIeSy4c33BnL5Jb9cBjExvGAK09GEwjg75yAQ9O2V3Beck6SaTPZ8
/W6aZEHO1n/UaQxPYB2HZ+RHWOBznSknyO55QwnpSajkWoECQQD7g5xatHPj1a4o
kh/NFCQx4nTBipOfCOkVgrOmgFFmXRz3JTf1mDRuEVOBloo/XKidHmdMPoCPAeau
U/dbve3nAkEAyOlxv7OiiA5+9GglXtx1gGxNXN3Osegneme++cvM5E6BjgDb6J6t
C3XZU4Znbsjf2W5FLlYQ8jzw00dILvRRQQJASQdE3d1pjOzdXbBYBX7kp4teZVfs
VxAKRZGmwiCeAf/lSimHXwsrpg3n1ke0qoMn/j72tV+sill99n4w43V5XwJATVVe
DVYNt6UsxNLZn5voNph5ZseR6fTcTUdlwSzrHu4A/DHkc7OwE/s2vem8Im57i2vg
gSdrunIumISVik1MgQJAP/Ls1/7rmgGh9sxIN73CBEJDBS80AdxEwk/KAcniAA5q
HhkuX4v7LeW6LIJYIbyUmfhdaIHtoi5k0FFINrOZFg==
-----END RSA PRIVATE KEY-----
`)

func main() {
    m := func(ctx *fasthttp.RequestCtx) {
        switch {
        case ctx.IsGet():
            ctx.SetContentType("text/html; charset=utf-8")
            ctx.WriteString("127.0.0.1 www.codesmagic.com")
            log.Println(ctx.RemoteIP().String() + "(" + string(ctx.UserAgent()) + ") visited " + string(ctx.Request.RequestURI()) + " GET")
        case ctx.IsPost():
            ctx.SetContentType("application/json;charset=UTF-8")
            ctx.WriteString("{\"verified\":true,\"message\":\"Activation success\",\"key\":\"30820122300d06092a864886f70d01010105000382010f003082010a02820101008e5fae9b71952c2715dba9fb9cd5f13eaf47f4175acd03bca61f39b30f73e3d6d9f80a4d2600cfdee0d9f78800bbd71ae9d07d380136c1edd853a4022454641d98e52f6e5bbff866ed8a75bf05bfe4b45d8280715611a1bf92c8fc907f98f25c66559796814928b7e63cf3d61c4a096648ddd967f47b31c972d690a41a3737bb30e500057aebc256346120b322e19ccd4c2a5cbc6cf6092ccbbde107bacf2a9efe2aaa435bba5e672ed7d44447818846ab7ca6a3bc3e7480aa0936c72ea353266627063cbd7886aa99aaa1e798ef7b59777fdd7ae20c686ac2fba37269b7e56e12bd281af02e240af1ea110d226da4340111384796b6b945f936df6a37994c5b0203010001\",\"result\":\"4b59bca03a48ee797f312509d4d4bbe0e5e8f4a83890e3b12152ad93f26e0b9127293050ede126f05cb26f4f3f40fc6c83a056013d347aeff7d01e411954175cf4e30d7e45b6edd625083bf4cc18c515c9b26e264001f7d90ab2f35ad05b7b6cf15a8212372370344ec03289f50b520ea125da3e1bf4fe5eb11a00b043ec352ec19eebbb203c29978066e293adb6b9781d8ef72247f0dbdbf7df98e314b915f750832cc1e7eee108ea1759437ba36ada428ebdb864bbba495f9a3e6f5544b04e301cfc8004ae7b373f61367bbc967ac23fd4272b001f48e63725e2f35907e2134e5f56e034324dce90889374d7db1f1f02913abf55758be79a62d6ca7f6be4e0\"}")
            log.Println(ctx.RemoteIP().String() + "(" + string(ctx.UserAgent()) + ") visited " + string(ctx.Request.RequestURI()) + " POST")
        default:
            ctx.Error("not found", fasthttp.StatusNotFound)
            log.Println(ctx.RemoteIP().String() + "(" + string(ctx.UserAgent()) + ") visited " + string(ctx.Request.RequestURI()))
        }
    }
    log.Println("*************************************************************")
    log.Println("** Mybatis License Server                                  **")
    log.Println("** by: ilanyu                                              **")
    log.Println("** http://www.lanyus.com/                                  **")
    log.Println("** Alipay donation: [email protected]                **")
    log.Println("** Please support genuine!!!                               **")
    log.Println("** listen on 0.0.0.0:443...                                **")
    log.Println("** You can use https://127.0.0.1 as license server         **")
    log.Println("** You should add 127.0.0.1 www.codesmagic.com to hosts    **")
    log.Println("*************************************************************")
    if err := fasthttp.ListenAndServeTLSEmbed("0.0.0.0:443", cert, key, m); err != nil {
        log.Fatal(err)
    }
}

key和result可以用http://blog.lanyus.com/archives/235.html中提到的自己生成新的,使用时需要添加127.0.0.1 www.codesmagic.com到hosts中。

标签: none

已有 3 条评论

  1. p0mp0k0 p0mp0k0

    这个我也试过了,仍然报错,楼主提供的3种方法,我都试过了,报的错是一样的。
    2016.2.1+2.85
    都是这个错
    “Cannot load project: com.intellij.ide.plugins.PluginManager$StartupAbortedException: com.intellij.diagnostic.PluginException: com.seventh7.mybatis.setting.MybatisSetting cannot be cast to com.seventh7.mybatis.setting.MybatisSetting [Plugin: com.seventh7.plugin.mybatis]”

    1. @p0mp0k0
      https://drive.google.com/open?id=0Bx7wGDIg2K-7VExyQ0h3Qm9DdDA
      试试这个编译好的agent模式的

  2. yu yu

    你这RSA公钥是怎么来的? 不会是源码中找出来的吧?

评论已关闭