🔥🐛 fix lazy data & add base天城文

This commit is contained in:
源文雨 2022-10-03 23:22:40 +08:00
parent 97fea6a93a
commit a2ada0b67e
7 changed files with 96 additions and 47 deletions

View File

@ -390,6 +390,20 @@ print("run[CQ:image,file="+j["img"]+"]")
- [x] 六十四卦用yyy解密xxx
</details>
<details>
<summary>base天城文加解密</summary>
`import _ "github.com/FloatTech/ZeroBot-Plugin/plugin/baseamasiro"`
- [x] 天城文加密xxx
- [x] 天城文解密xxx
- [x] 天城文用yyy加密xxx
- [x] 天城文用yyy解密xxx
</details>
<details>
<summary>bilibili</summary>

10
go.mod
View File

@ -4,12 +4,12 @@ go 1.19
require (
github.com/Coloured-glaze/gg v1.3.4
github.com/FloatTech/AnimeAPI v1.5.1-0.20220921020517-f4076c11486c
github.com/FloatTech/floatbox v0.0.0-20220917062226-31fb3ec4b135
github.com/FloatTech/AnimeAPI v1.5.1-0.20221003151003-71d7e86c895f
github.com/FloatTech/floatbox v0.0.0-20221003150509-1eb268ad10ff
github.com/FloatTech/sqlite v0.4.0
github.com/FloatTech/ttl v0.0.0-20220715042055-15612be72f5b
github.com/FloatTech/zbpctrl v1.5.2-0.20220921013146-40d64bc7799c
github.com/FloatTech/zbputils v1.5.1-0.20220922024334-73bc7af39d08
github.com/FloatTech/zbputils v1.5.1-0.20221003150718-106abe37a694
github.com/RomiChan/syncx v0.0.0-20220404072119-d7ea0ae15a4c
github.com/antchfx/htmlquery v1.2.5
github.com/corona10/goimagehash v1.1.0
@ -17,10 +17,9 @@ require (
github.com/fumiama/cron v1.3.0
github.com/fumiama/go-base16384 v1.6.1
github.com/fumiama/go-registry v0.1.6
github.com/fumiama/gofastTEA v0.0.10
github.com/fumiama/gotracemoe v0.0.3
github.com/fumiama/sqlite3 v1.14.6
github.com/fumiama/unibase2n v0.0.0-20221001124937-1eec9a152907
github.com/fumiama/unibase2n v0.0.0-20221003115227-e7db987de949
github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0
github.com/jinzhu/gorm v1.9.16
github.com/jozsefsallai/gophersauce v1.0.1
@ -44,6 +43,7 @@ require (
github.com/ericpauley/go-quantize v0.0.0-20200331213906-ae555eb2afa4 // indirect
github.com/faiface/beep v1.1.0 // indirect
github.com/fsnotify/fsnotify v1.4.9 // indirect
github.com/fumiama/gofastTEA v0.0.10 // indirect
github.com/gabriel-vasile/mimetype v1.0.4 // indirect
github.com/go-ole/go-ole v1.2.6 // indirect
github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0 // indirect

16
go.sum
View File

@ -2,18 +2,18 @@ github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym
github.com/Coloured-glaze/gg v1.3.4 h1:l31zIF/HaVwkzjrj+A56RGQoSKyKuR1IWtIrqXGFStI=
github.com/Coloured-glaze/gg v1.3.4/go.mod h1:Ih5NLNNDHOy3RJbB0EPqGTreIzq/H02TGThIagh8HJg=
github.com/DATA-DOG/go-sqlmock v1.3.3/go.mod h1:f/Ixk793poVmq4qj/V1dPUg2JEAKC73Q5eFN3EC/SaM=
github.com/FloatTech/AnimeAPI v1.5.1-0.20220921020517-f4076c11486c h1:L4mAdwNIqFi+tas13k1yJV9CyNXncTR8qvZ42sBPMxQ=
github.com/FloatTech/AnimeAPI v1.5.1-0.20220921020517-f4076c11486c/go.mod h1:8tw2qmRQW2bmfAU34bef84EPYZOkSrtYtgPkNdWuxVE=
github.com/FloatTech/floatbox v0.0.0-20220917062226-31fb3ec4b135 h1:HJZRF10i/vszUsZXJ+13oz+y1DTgCW453SFTeJvjjyo=
github.com/FloatTech/floatbox v0.0.0-20220917062226-31fb3ec4b135/go.mod h1:VNqP+XqXDOEArudsDVYQJfZd5bO6Sj4l4oRa8DM8cAw=
github.com/FloatTech/AnimeAPI v1.5.1-0.20221003151003-71d7e86c895f h1:Cei6vTDTGs1ap2o3ufI2I2Tgkz97bKKbVUrFOb4l9gk=
github.com/FloatTech/AnimeAPI v1.5.1-0.20221003151003-71d7e86c895f/go.mod h1:a8bKmB4WUKlC/3IT6CjB7bpsb+POjFGf7HhndWmvHX8=
github.com/FloatTech/floatbox v0.0.0-20221003150509-1eb268ad10ff h1:eWWdYIfpu91bdvFcdLL27w8O8v3u0O6iph632FAqXww=
github.com/FloatTech/floatbox v0.0.0-20221003150509-1eb268ad10ff/go.mod h1:4UDl6E/I2HqAqRnKdsxxfO28fkqGo3CzFOP2BhyI6ag=
github.com/FloatTech/sqlite v0.4.0 h1:fvQ1vc7fw99jYXccs5KItMluy7QL1t6NxbkH7aN1F4g=
github.com/FloatTech/sqlite v0.4.0/go.mod h1:i33d92OtR8jcp5fBUvQtospf27+MkfUxnGwnZ95E/dA=
github.com/FloatTech/ttl v0.0.0-20220715042055-15612be72f5b h1:tvciXWq2nuvTbFeJGLDNIdRX3BI546D3O7k7vrVueZw=
github.com/FloatTech/ttl v0.0.0-20220715042055-15612be72f5b/go.mod h1:fHZFWGquNXuHttu9dUYoKuNbm3dzLETnIOnm1muSfDs=
github.com/FloatTech/zbpctrl v1.5.2-0.20220921013146-40d64bc7799c h1:zYcKvMbwQeifSQg0LnxhmCdyP3mb7ZqS6rjt68jbukw=
github.com/FloatTech/zbpctrl v1.5.2-0.20220921013146-40d64bc7799c/go.mod h1:+2mGs9vUWJsvfcbodcmFegqOKEqHnLwopF1jTLVs/gU=
github.com/FloatTech/zbputils v1.5.1-0.20220922024334-73bc7af39d08 h1:VoqFAE1Igk5DjKe33wQLWLF64LC745Uam+gdCEEaaHE=
github.com/FloatTech/zbputils v1.5.1-0.20220922024334-73bc7af39d08/go.mod h1:C+PfyuEOxooTDb1S/SoptP3K+pTCXbUvC/AxXb3Q2yk=
github.com/FloatTech/zbputils v1.5.1-0.20221003150718-106abe37a694 h1:5Mrqp7vWfGHa2UaGPlEtEO90oQGZqsLz64OKax9BTKE=
github.com/FloatTech/zbputils v1.5.1-0.20221003150718-106abe37a694/go.mod h1:G2moRET7IGbq4ME7lzqzx4FxVzU0NvtYTf3Q6FyYEUw=
github.com/PuerkitoBio/goquery v1.5.1/go.mod h1:GsLWisAFVj4WgDibEWF4pvYnkVQBpKBKeU+7zCJoLcc=
github.com/RomiChan/syncx v0.0.0-20220404072119-d7ea0ae15a4c h1:cNPOdTNiVwxLpROLjXCgbIPvdkE+BwvxDvgmdYmWx6Q=
github.com/RomiChan/syncx v0.0.0-20220404072119-d7ea0ae15a4c/go.mod h1:KqZzu7slNKROh3TSYEH/IUMG6f4M+1qubZ5e52QypsE=
@ -58,8 +58,8 @@ github.com/fumiama/gotracemoe v0.0.3 h1:iI5EbE9A3UUbfukG6+/soYPjp1S31eCNYf4tw7s6
github.com/fumiama/gotracemoe v0.0.3/go.mod h1:tyqahdUzHf0bQIAVY/GYmDWvYYe5ik1ZbhnGYh+zl40=
github.com/fumiama/sqlite3 v1.14.6 h1:+e+iygyiDXQJVi7xeXIviBvR7hAc5y20WA9hRwfKn10=
github.com/fumiama/sqlite3 v1.14.6/go.mod h1:Xx9a2/OtHuy9pBjow0N+bE/RhNeZ7zZz5xh25vqbA5A=
github.com/fumiama/unibase2n v0.0.0-20221001124937-1eec9a152907 h1:x+wRdSK0Hx9X+pBxB7jN/hnir55Rbh3KJ9eiGzIb4GY=
github.com/fumiama/unibase2n v0.0.0-20221001124937-1eec9a152907/go.mod h1:lEaZsT4FRSqcjnQ5q8y+mkenkzR/r1D3BJmfdp0vqDg=
github.com/fumiama/unibase2n v0.0.0-20221003115227-e7db987de949 h1:VAzR8aoS2SCEBmRF9rqCPyXgXoP8mZ1viNL4mLWUg0Q=
github.com/fumiama/unibase2n v0.0.0-20221003115227-e7db987de949/go.mod h1:lEaZsT4FRSqcjnQ5q8y+mkenkzR/r1D3BJmfdp0vqDg=
github.com/gabriel-vasile/mimetype v1.0.4 h1:uBejfH8l3/2f+5vjl1e4xIaSyNEhRBZ5N/ij7ohpNd8=
github.com/gabriel-vasile/mimetype v1.0.4/go.mod h1:6CDPel/o/3/s4+bp6kIbsWATq8pmgOisOPG40CJa6To=
github.com/gdamore/encoding v1.0.0/go.mod h1:alR0ol34c49FCSBLjhosxzcPHQbf2trDkoo5dl+VrEg=

View File

@ -64,6 +64,7 @@ import (
_ "github.com/FloatTech/ZeroBot-Plugin/plugin/b14" // base16384加解密
_ "github.com/FloatTech/ZeroBot-Plugin/plugin/baidu" // 百度一下
_ "github.com/FloatTech/ZeroBot-Plugin/plugin/base64gua" // base64卦加解密
_ "github.com/FloatTech/ZeroBot-Plugin/plugin/baseamasiro" // base天城文加解密
_ "github.com/FloatTech/ZeroBot-Plugin/plugin/bilibili" // b站相关
_ "github.com/FloatTech/ZeroBot-Plugin/plugin/book_review" // 哀伤雪刃吧推书记录
_ "github.com/FloatTech/ZeroBot-Plugin/plugin/cangtoushi" // 藏头诗

View File

@ -2,12 +2,10 @@
package b14coder
import (
"unsafe"
"github.com/FloatTech/floatbox/crypto"
ctrl "github.com/FloatTech/zbpctrl"
"github.com/FloatTech/zbputils/control"
base14 "github.com/fumiama/go-base16384"
tea "github.com/fumiama/gofastTEA"
zero "github.com/wdvxdr1123/ZeroBot"
"github.com/wdvxdr1123/ZeroBot/message"
"github.com/wdvxdr1123/ZeroBot/utils/helper"
@ -42,7 +40,7 @@ func init() {
en.OnRegex(`^用(.+)加密\s*(.+)$`).SetBlock(true).
Handle(func(ctx *zero.Ctx) {
key, str := ctx.State["regex_matched"].([]string)[1], ctx.State["regex_matched"].([]string)[2]
t := getea(key)
t := crypto.GetTEA(key)
es, err := base14.UTF16BE2UTF8(base14.Encode(t.Encrypt(helper.StringToBytes(str))))
if err == nil {
ctx.SendChain(message.Text(helper.BytesToString(es)))
@ -53,7 +51,7 @@ func init() {
en.OnRegex(`^用(.+)解密\s*([一-踀]+[㴁-㴆]?)$`).SetBlock(true).
Handle(func(ctx *zero.Ctx) {
key, str := ctx.State["regex_matched"].([]string)[1], ctx.State["regex_matched"].([]string)[2]
t := getea(key)
t := crypto.GetTEA(key)
es, err := base14.UTF82UTF16BE(helper.StringToBytes(str))
if err == nil {
ctx.SendChain(message.Text(helper.BytesToString(t.Decrypt(base14.Decode(es)))))
@ -62,15 +60,3 @@ func init() {
}
})
}
func getea(key string) tea.TEA {
kr := []rune(key)
if len(kr) > 4 {
kr = kr[:4]
} else {
for len(kr) < 4 {
kr = append(kr, rune(4-len(kr)))
}
}
return *(*tea.TEA)(*(*unsafe.Pointer)(unsafe.Pointer(&kr)))
}

View File

@ -2,11 +2,9 @@
package base64gua
import (
"unsafe"
"github.com/FloatTech/floatbox/crypto"
ctrl "github.com/FloatTech/zbpctrl"
"github.com/FloatTech/zbputils/control"
tea "github.com/fumiama/gofastTEA"
"github.com/fumiama/unibase2n"
zero "github.com/wdvxdr1123/ZeroBot"
"github.com/wdvxdr1123/ZeroBot/message"
@ -42,7 +40,7 @@ func init() {
en.OnRegex(`^六十四卦用(.+)加密\s*(.+)$`).SetBlock(true).
Handle(func(ctx *zero.Ctx) {
key, str := ctx.State["regex_matched"].([]string)[1], ctx.State["regex_matched"].([]string)[2]
t := getea(key)
t := crypto.GetTEA(key)
es, err := unibase2n.UTF16BE2UTF8(unibase2n.Base64Gua.Encode(t.Encrypt(helper.StringToBytes(str))))
if err == nil {
ctx.SendChain(message.Text(helper.BytesToString(es)))
@ -53,7 +51,7 @@ func init() {
en.OnRegex(`^六十四卦用(.+)解密\s*([䷀-䷿]+[☰☱]?)$`).SetBlock(true).
Handle(func(ctx *zero.Ctx) {
key, str := ctx.State["regex_matched"].([]string)[1], ctx.State["regex_matched"].([]string)[2]
t := getea(key)
t := crypto.GetTEA(key)
es, err := unibase2n.UTF82UTF16BE(helper.StringToBytes(str))
if err == nil {
ctx.SendChain(message.Text(helper.BytesToString(t.Decrypt(unibase2n.Base64Gua.Decode(es)))))
@ -62,15 +60,3 @@ func init() {
}
})
}
func getea(key string) tea.TEA {
kr := []rune(key)
if len(kr) > 4 {
kr = kr[:4]
} else {
for len(kr) < 4 {
kr = append(kr, rune(4-len(kr)))
}
}
return *(*tea.TEA)(*(*unsafe.Pointer)(unsafe.Pointer(&kr)))
}

View File

@ -0,0 +1,62 @@
// Package baseamasiro base天城文 与 tea 加解密
package baseamasiro
import (
"github.com/FloatTech/floatbox/crypto"
ctrl "github.com/FloatTech/zbpctrl"
"github.com/FloatTech/zbputils/control"
"github.com/fumiama/unibase2n"
zero "github.com/wdvxdr1123/ZeroBot"
"github.com/wdvxdr1123/ZeroBot/message"
"github.com/wdvxdr1123/ZeroBot/utils/helper"
)
func init() {
en := control.Register("base64gua", &ctrl.Options[*zero.Ctx]{
DisableOnDefault: false,
Help: "base天城文加解密\n" +
"- 天城文加密xxx\n- 天城文解密xxx\n- 天城文用yyy加密xxx\n- 天城文用yyy解密xxx",
})
en.OnRegex(`^天城文加密\s*(.+)$`).SetBlock(true).
Handle(func(ctx *zero.Ctx) {
str := ctx.State["regex_matched"].([]string)[1]
es := unibase2n.BaseDevanagari.EncodeString(str)
if es != "" {
ctx.SendChain(message.Text(es))
} else {
ctx.SendChain(message.Text("加密失败!"))
}
})
en.OnRegex(`^天城文解密\s*([ऀ-ॿ]+[-৫]?)$`).SetBlock(true).
Handle(func(ctx *zero.Ctx) {
str := ctx.State["regex_matched"].([]string)[1]
es := unibase2n.BaseDevanagari.DecodeString(str)
if es != "" {
ctx.SendChain(message.Text(es))
} else {
ctx.SendChain(message.Text("解密失败!"))
}
})
en.OnRegex(`^天城文用(.+)加密\s*(.+)$`).SetBlock(true).
Handle(func(ctx *zero.Ctx) {
key, str := ctx.State["regex_matched"].([]string)[1], ctx.State["regex_matched"].([]string)[2]
t := crypto.GetTEA(key)
es, err := unibase2n.UTF16BE2UTF8(unibase2n.BaseDevanagari.Encode(t.Encrypt(helper.StringToBytes(str))))
if err == nil {
ctx.SendChain(message.Text(helper.BytesToString(es)))
} else {
ctx.SendChain(message.Text("加密失败!"))
}
})
en.OnRegex(`^天城文用(.+)解密\s*([ऀ-ॿ]+[-৫]?)$`).SetBlock(true).
Handle(func(ctx *zero.Ctx) {
key, str := ctx.State["regex_matched"].([]string)[1], ctx.State["regex_matched"].([]string)[2]
t := crypto.GetTEA(key)
es, err := unibase2n.UTF82UTF16BE(helper.StringToBytes(str))
if err == nil {
ctx.SendChain(message.Text(helper.BytesToString(t.Decrypt(unibase2n.BaseDevanagari.Decode(es)))))
} else {
ctx.SendChain(message.Text("解密失败!"))
}
})
}