This commit is contained in:
1-6
2023-09-24 08:50:43 +08:00
parent 20416a586a
commit e9eb67473b
9 changed files with 35 additions and 216 deletions
+5 -6
View File
@@ -1,11 +1,8 @@
# 使用Debian镜像作为基础镜像
FROM debian:11
# 将APT源更换为国内源(这里使用阿里云的源)
RUN sed -i 's/deb.debian.org/mirrors.aliyun.com/g' /etc/apt/sources.list && \
sed -i 's/security.debian.org/mirrors.aliyun.com\/debian-security/g' /etc/apt/sources.list
# 更新软件包索引并安装必要的工具
RUN apt-get update && apt-get install -y \
python3 \
python3-pip \
@@ -58,7 +55,9 @@ ENV PATH="/usr/local/sillyGirl/language/node:${PATH}"
ENV SILLYGIRL_DATA_PATH=/usr/local/sillyGirl/
# 指定容器启动时要运行的命令
CMD ["/usr/local/sillyGirl/sillyGirl", "-t"]
# CMD ["/usr/local/sillyGirl/sillyGirl", "-t"]
# docker build -t my-sillygirl .
# docker run -d --restart always --name my-sillygirl my-sillygirl
CMD ["/usr/local/sillyGirl/sillyGirl -t"]
# docker build -t sillygirl .
# docker run -d --restart always --name sillygirl sillygirl
+2 -1
View File
@@ -17,6 +17,7 @@ _*
fanli_vip
cable
sillyplus.cache
sillyplus.*
main
sillyplus.pid
sillyGirl.pid
@@ -36,4 +37,4 @@ test*
node_modules
plugins
bin
language
language
-96
View File
@@ -1,96 +0,0 @@
package main
import (
"crypto/aes"
"crypto/cipher"
"encoding/base64"
"fmt"
"io/ioutil"
"net/http"
"net/url"
)
func getJS(user, pass, title string) string {
baseURL := "http://aut.zhelee.cn/plugin/download"
queryParams := url.Values{}
queryParams.Set("title", title)
queryParams.Set("username", user)
queryParams.Set("password", pass)
queryParams.Set("version", "1")
u, err := url.Parse(baseURL)
if err != nil {
panic(err)
}
u.RawQuery = queryParams.Encode()
urlStr := u.String()
method := "POST"
client := &http.Client{}
req, err := http.NewRequest(method, urlStr, nil)
if err != nil {
fmt.Println(err)
return ""
}
res, err := client.Do(req)
if err != nil {
fmt.Println(err)
return ""
}
defer res.Body.Close()
body, err := ioutil.ReadAll(res.Body)
if err != nil {
fmt.Println(err)
return ""
}
// fmt.Println(string(body))
return string(body)
}
func main() {
user := "test1234"
pass := "test1234"
title := "hook"
plaintext := getJS(user, pass, title)
key := getKey("test1234")
panic(key)
decrypted, err := decrypt(string(plaintext), []byte(key))
// 打印解密后的数据
fmt.Println(err)
fmt.Printf("解密后的数据:%s\n", decrypted)
}
func getKey(user string) string {
t := user + "killsillygirltodeath109times"
if len(t) > 32 {
return t[:32]
}
// if len(t) > 24 {
// return t[:24]
// }
// return t[:16]
return t[:24]
}
// 使用AES-CBC模式进行解密
func decrypt(encrypted string, key []byte) (string, error) {
block, err := aes.NewCipher(key)
if err != nil {
return "", err
}
ciphertext, err := base64.StdEncoding.DecodeString(encrypted)
if err != nil {
return "", err
}
iv := ciphertext[:aes.BlockSize]
ciphertext = ciphertext[aes.BlockSize:]
decrypter := cipher.NewCBCDecrypter(block, iv)
decrypted := make([]byte, len(ciphertext))
decrypter.CryptBlocks(decrypted, ciphertext)
return string(decrypted), nil
}
-86
View File
@@ -1,86 +0,0 @@
/**
* @title 怪兽插件下载
* @create_at 2022-07-04 16:05:44
* @description 🐒仅供学习,访问傻妞地址下载:http://${ app.ip }:${ app.port ?? "8080"}/api/fuckatm?title=hook&username=username&password=password
* @author 佚名
* @version v1.0.0
* @http GET /api/fuckatm
* @encrypt true
* @form {key: "autMan.title", "title": "默认标题", required: true, tooltip: "请求参数title为空时"}
* @form {key: "autMan.username", "title": "默认用户", required: true, tooltip: "请求参数username为空时"}
* @form {key: "autMan.password", "title": "默认密码", required: true, tooltip: "请求参数password为空时"}
*/
const plt = s.getPlatform()
const autMan = Bucket("autMan")
const base_url = "http://aut.zhelee.cn/plugin/"
class AESCipher {
constructor(key) {
this.key = key;
}
decrypt(encrypt) {
const encryptBuffer = Buffer.from(encrypt, 'base64');
const decipher = crypto.createDecipheriv('aes-256-cbc', this.key, encryptBuffer.slice(0, 16));
let decrypted = decipher.update(encryptBuffer.slice(16).toString('hex'), 'hex', 'utf8');
decrypted += decipher.final('utf8');
return decrypted;
}
}
function main() {
if (req) {
let title = req.query("title")
if (!title) {
title = autMan.title ?? ""
}
if (!title) {
res.send("title不为空")
return
}
let username = req.query("username")
if (!username) {
username = autMan.username ?? ""
}
if (!username) {
res.send("username不为空")
return
}
let password = req.query("password")
if (!password) {
password = autMan.password ?? ""
}
if (!password) {
res.send("password不为空")
return
}
let { body } = request({
url: base_url + "download?" + strings.encodeQueryString({
title,
username,
password,
version: "1",
dataType: "text"
}),
method: "POST",
})
console.log("==",body)
let key = username + "killsillygirltodeath109times"
key = Buffer.from(key)
key = key.length() > 32 ? key.slice(0, 32) : key.slice(0, 24)
let cipher = new AESCipher(key.toString())
res.send(cipher.decrypt(body))
let resp = request({
url: base_url + "remove?" + strings.encodeQueryString({
title: title,
username: username,
password: password,
version: "1",
}),
method: "POST",
})
console.log("remove", resp.body)
}
}
main()
+13 -13
View File
@@ -124,19 +124,19 @@ func initNodePlugins() {
} else {
// fmt.Println("非插件目录", event.Name)
}
// tf := event.Name + "/node_modules/sillygirl.d.ts"
// ti := event.Name + "/demo.main.js"
// if _, err := os.Stat(tf); err != nil {
// os.Mkdir(event.Name+"/node_modules", 0700)
// os.WriteFile(tf, []byte(typeat), 0700)
// }
// go func() {
// time.Sleep(time.Second)
// if _, err := os.Stat(ti); err != nil {
// os.Mkdir(event.Name+"/node_modules", 0700)
// os.WriteFile(ti, []byte(defaultScript(plugin_name)), 0700)
// }
// }()
tf := event.Name + "/node_modules/sillygirl.d.ts"
ti := event.Name + "/demo.main.js"
if _, err := os.Stat(tf); err != nil {
os.Mkdir(event.Name+"/node_modules", 0700)
os.WriteFile(tf, []byte(typeat), 0700)
}
go func() {
time.Sleep(time.Second)
if _, err := os.Stat(ti); err != nil {
os.Mkdir(event.Name+"/node_modules", 0700)
os.WriteFile(ti, []byte(defaultScript(plugin_name)), 0700)
}
}()
} else if plugin_index {
// fmt.Println("增加插件", event.Name)
// RemNodePlugin(plugin_name)
-1
View File
@@ -116,7 +116,6 @@ func (sg *SillyGirlService) SenderListen(stream srpc.SillyGirlService_SenderList
var persistent bool
ctx := stream.Context()
defer fmt.Println("已关闭,", "===")
for {
req, err := stream.Recv()
// fmt.Println("req", string(utils.JsonMarshal(req)))
-1
View File
@@ -14,7 +14,6 @@ func getPaterner(uuid, path string) (string, string, bool) {
break
}
}
for _, f := range ls { //同源
if f.Address == address && (f.Title == path || f.UUID == path) {
data = plugins.GetBytes(f.UUID)
+1 -2
View File
@@ -7,7 +7,6 @@ import (
"embed"
"fmt"
"io"
"io/ioutil"
"net"
"net/http"
"os"
@@ -132,7 +131,7 @@ func initWeb() {
}
if is_index {
var data []byte
data, err = ioutil.ReadAll(file)
data, err = io.ReadAll(file)
if err != nil {
return err
}
+14 -10
View File
@@ -6,6 +6,7 @@ import (
"os"
"os/exec"
"runtime"
"strings"
"time"
// _ "github.com/cdle/sillyplus/adapters/qq"
@@ -65,10 +66,10 @@ func main() {
}
if t {
// core.Logs.Info("Terminal机器人已连接")
scanner := bufio.NewScanner(os.Stdin)
a := &core.Factory{}
a.Init("terminal", "default", nil)
i := 0
i := 1
a.SetIsAdmin(func(s string) bool {
return true
})
@@ -81,24 +82,27 @@ func main() {
// fmt.Println(`do action: ` + string(utils.JsonMarshal(m)))
// return ""
// })
reader := bufio.NewReader(os.Stdin)
for {
input, err := reader.ReadString('\n')
if err != nil {
core.Logs.Error(err)
a.Destroy()
break
}
input = strings.TrimSpace(input)
for scanner.Scan() {
data := scanner.Text()
s := &core.CustomSender{
// Type: "terminal",
// Message: string(data),
// Admin: true,
F: a,
}
i++
s.SetFsps(&common.FakerSenderParams{
Content: data,
Content: input,
MessageID: fmt.Sprint(i),
})
s.SetContent(data)
core.Messages <- s
// 在这里可以根据输入执行相应的逻辑
}
core.Logs.Info("Terminal机器人异常,请检查运行环境设置,如果是docker环境,请附加-it参数")
} else {
// core.Logs.Info("Terminal机器人不可用,运行带-t参数即可启用")
}