Git Product home page Git Product logo

go-mirai-client's Introduction

Go-Mirai-Client

默认端口9000,若启动失败,将依次在9001-9020端口中选择可用的端口启动。

快速登录辅助(非首次登录使用)

GMCLoginHelper

session.token 登录说明

只支持单账号登录,如需多账号登录,请放不同文件夹内,例如

Files
|- File one
|  |- gmc.exe
|  |- session.token
|  |- deviceInfo.toml
|  |- logs
|  |  |- 2023-06-30.log
|  |  |- latest.log
|  |- plugins
|  |  |- default.json
|  |- device
|  |  |- device-1688014725597.json
|- File two
|  |- gmc.exe
|  |- session.token
|  |- deviceInfo.toml
|  |- logs
|  |  |- 2023-06-30.log
|  |  |- latest.log
|  |- plugins
|  |  |- default.json
|  |- device
|  |  |- device-1688014725597.json

QQ群

用于收发QQ消息,并通过 websocket + protobuf 上报给 server 进行处理。

支持的开发语言:Java/Kotlin , JavaScript , TypeScript , Python , Golang , C/C++ , 易语言 。详情查看 Protobufbot

可以使用其他任意语言编写websocket server实现通信,协议:onebot_idl

有问题发issue,或者进QQ群335783090

频道API使用条件

必须是AndroidPhone协议且子频道通知开启(关闭通知将无法接收消息)【订不订阅无所谓】

已支持频道API的SDK有 JavaScript , TypeScript , Golang

使用说明

  1. 启动程序

    • Windows 非专业用户在 Releases 下载带有lorca 的版本,启动时会自动打开UI界面(需要Edge/Chrome浏览器,安装在默认位置)。
    • 专业用户可以下载不带有lorca的版本,手动打开浏览器地址http://localhost:9000/,端口号可以通过-port 9000 参数修改,Linux服务器可以远程访问http://<服务器地址>:9000
  2. 创建机器人

    • 建议选择扫码创建,使用机器人账号直接扫码,点击确认后登录。
    • 使用密码创建可能处理验证码。
    • 每次登录必须使用相同随机种子(数字),否则容易冻结。(建议使用账号作为随机种子)
  3. 配置消息处理器

    • 在首次启动自动生成的gmc_config.json中配置服务器URL,修改后重启生效。
    • 如果使用其他人编写的程序,建议把gmc_config.json打包在一起发送给用户。

验证码类型及处理方法

使用密码登录会遇到验证码,点击机器人下方图标处理验证码,处理验证码时必须用到浏览器。

  1. 设备锁验证码:复制链接到手机打开处理,可能需要扫码,如果添加参数-sms会优先使用短信验证码。
  2. 短信验证码:直接输入短信内容提交。
  3. 滑块验证码:使用滑块验证助手

运行参数

Usage of GMC:
  -uin int
        机器人QQ
  -pass string
        机器人密码
  -port int
        http管理端口(默认 9000), 0表示随机, 如果不需要处理验证码, 可以随便填
  -sms bool
        登录优先使用短信验证
  -ws_url string
        消息处理websocket服务器地址
  -device string
        设备文件位置
  -help
        帮助

自动登陆

有2种方式可以实现自动登录。

  1. 发送HTTP请求自动登录 支持多账号
  2. 使用运行参数自动登录 只能单账号

发送HTTP请求自动登录

启动程序后,通过编写脚本,发送请求实现自动登录POST http://localhost/bot/create/v1/

{
  "bot_id": 123,
  "password": "xxx",
  "device_seed": 123
}

使用运行参数自动登录

Windows

创建一个文件,后缀为.bat,写入以下内容,双击运行

Go-Mirai-Client.exe -uin <机器人QQ> -pass <机器人密码> -port <HTTP端口> -device <设备信息位置> -ws_url <消息处理器地址> -sms <是否优先短信登录>

Linux

创建一个文件,后缀为.sh,写入以下内容,添加执行权限,运行

chmod +x ./Go-Mirai-Client

./Go-Mirai-Client -uin <机器人QQ> -pass <机器人密码> -port <HTTP端口> -device <设备信息位置> -ws_url <消息处理器地址> -sms <是否优先短信登录>

多开

每次启动必须使用不同端口,默认使用9000端口。可以通过指定参数-port 9000修改端口,端口设置为0表示随机端口。

Docker

docker run -it \
--name=gmc \
-p 9000:9000 \
-e UIN=<账号> \
-e PASS=<密码> \
-e WS_URL=<WebSocket地址> \
-e DEVICE=/deivce/123.json \
-v <设备文件目录>:/deivce \
lz1998/gmc:0.1.19

修改协议

修改device文件的protocol,对应关系如下:

  • IPad: 0
  • AndroidPhone: 1
  • AndroidWatch: 2
  • MacOS: 3
  • 企点: 4
  • IPad: 5
  • AndroidPad: 6

输入其他数字默认表示IPad

go-mirai-client's People

Contributors

2mf8 avatar lz1998 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

go-mirai-client's Issues

企点协议无法登录,当前应用版本过低

INFO[2023-08-18 17:21:55] 初始化日志
INFO[2023-08-18 17:21:55] 登录中...
INFO[2023-08-18 17:21:55] connect to server: [59.83.207.254:8080]
WARN[2023-08-18 17:21:55] 设备信息被封禁,请删除设备(device)文件夹里对应设备文件后重试
INFO[2023-08-18 17:21:55] 验证码处理页面: http://localhost:9000/
ERRO[2023-08-18 17:21:55] 当前应用版本过低,请升级至最新版或联系客服沟通。
WARN[2023-08-18 17:21:55] 登陆失败,建议开启/关闭设备锁后重试,或删除device-.json文件后再次尝试
ERRO[2023-08-18 17:21:55] 密码错误或账号被冻结
ERRO[2023-08-18 17:21:55] failed to login, err: 遇到不可处理的登录错误

初始化 Sign 失败

WARN[2023-10-05 11:01:44] 0
WARN[2023-10-05 11:01:44] ?uin=0&android_id=&guid=&qimei36=&key=
WARN[2023-10-05 11:01:44] 初始化 Sign 失败
%!(EXTRA *url.Error=Get "/register?uin=0&android_id=&guid=&qimei36=&key=": unsupported protocol scheme "")

file issue

please add upload and download file of group and privite message. i need it very much

密码登录的SignServer校验问题

版本0.3.0
1.密码创建账号的SignServer无法通过校验,具体的部分是在pkg/bot/bot.go 第73行

func Login(cli *client.QQClient) (bool, error) {  
	cli.AllowSlider = true  
	if GTL.ClientProtocol == 1 && GTL.SignServer != "" {  
		wrapper.DandelionEnergy = Energy  
		wrapper.FekitGetSign = Sign  
	} else if GTL.SignServer != "" {  
		fmt.Println("SignServer 不支持该协议")  
	}

我填的是我自己搭建的内网SignServer,框架为unidbg-fetch-qsign,内容为http://192.168.49.162:18901,但是不管怎么换协议,都会进入“SignServer 不支持该协议”的分支内。

前端文件缺少

使用版本为0.3.0

  1. 源码编译遇到问题,没有前端文件。具体的报错是在pkg/static/static.go

//go:embed static
具体报错为
....\pkg\static\static.go:10:12: pattern static: no matching files found

我从已发布包中下载源码也没有发现前端文件。

增加反向ws连接token验证与自动登录

用反向ws连接云bot上游,因为过不了access_token验证,一直握手失败

time="2020-12-09 00:45:17" level=warning msg="连接Websocket服务器 ws://xn--v9x.net/ 时出现错误: websocket: bad handshake"

以及,似乎没有看到自动登录的设置。(如果是我眼拙,麻烦告知一下)

新手疑惑

你好,在运行的时候在MyAspect.java变量log找不到符号,是什么意思。

群聊消息问题

版本0.3.0

1.群聊消息无法接收,私聊消息是正常的。登录协议我选择的是ipad,扫码登录。

群聊和私聊都遇到图片发送失败问题

腾讯云Linux, 出口带宽1M, 链接的图片大小为406kb

�[36mINFO�[0m[2021-10-01 17:39:52] Bot(1649565448) Private(649565448) <- <image url="http://域名/meituxiuxiu_7029.jpg"/> �[31mERRO�[0m[2021-10-01 17:40:12] failed to upload private image, dial tcp 180.102.111.81:14000: i/o timeout connect error github.com/Mrs4s/MiraiGo/client.(*QQClient).highwayUploadByBDH github.com/Mrs4s/[email protected]/client/highway.go:121 github.com/Mrs4s/MiraiGo/client.(*QQClient).UploadGroupImage github.com/Mrs4s/[email protected]/client/image.go:60 github.com/Mrs4s/MiraiGo/client.(*QQClient).uploadPrivateImage github.com/Mrs4s/[email protected]/client/image.go:135 github.com/Mrs4s/MiraiGo/client.(*QQClient).UploadPrivateImage github.com/Mrs4s/[email protected]/client/image.go:124 github.com/ProtobufBot/Go-Mirai-Client/pkg/bot.preProcessPrivateSendingMessage github.com/ProtobufBot/Go-Mirai-Client/pkg/bot/api_handler.go:51 github.com/ProtobufBot/Go-Mirai-Client/pkg/bot.HandleSendPrivateMsg github.com/ProtobufBot/Go-Mirai-Client/pkg/bot/api_handler.go:157 github.com/ProtobufBot/Go-Mirai-Client/pkg/bot.handleApiFrame github.com/ProtobufBot/Go-Mirai-Client/pkg/bot/remote.go:176 github.com/ProtobufBot/Go-Mirai-Client/pkg/bot.OnWsRecvMessage.func1 github.com/ProtobufBot/Go-Mirai-Client/pkg/bot/remote.go:143 github.com/ProtobufBot/Go-Mirai-Client/pkg/safe_ws.NewSafeWebSocket.func2.1 github.com/ProtobufBot/Go-Mirai-Client/pkg/safe_ws/safe_ws.go:78 github.com/ProtobufBot/Go-Mirai-Client/pkg/util.SafeGo.func1 github.com/ProtobufBot/Go-Mirai-Client/pkg/util/util.go:118 runtime.goexit runtime/asm_amd64.s:1581 upload failed github.com/Mrs4s/MiraiGo/client.(*QQClient).UploadGroupImage github.com/Mrs4s/[email protected]/client/image.go:63 github.com/Mrs4s/MiraiGo/client.(*QQClient).uploadPrivateImage github.com/Mrs4s/[email protected]/client/image.go:135 github.com/Mrs4s/MiraiGo/client.(*QQClient).UploadPrivateImage github.com/Mrs4s/[email protected]/client/image.go:124 github.com/ProtobufBot/Go-Mirai-Client/pkg/bot.preProcessPrivateSendingMessage github.com/ProtobufBot/Go-Mirai-Client/pkg/bot/api_handler.go:51 github.com/ProtobufBot/Go-Mirai-Client/pkg/bot.HandleSendPrivateMsg github.com/ProtobufBot/Go-Mirai-Client/pkg/bot/api_handler.go:157 github.com/ProtobufBot/Go-Mirai-Client/pkg/bot.handleApiFrame github.com/ProtobufBot/Go-Mirai-Client/pkg/bot/remote.go:176 github.com/ProtobufBot/Go-Mirai-Client/pkg/bot.OnWsRecvMessage.func1 github.com/ProtobufBot/Go-Mirai-Client/pkg/bot/remote.go:143 github.com/ProtobufBot/Go-Mirai-Client/pkg/safe_ws.NewSafeWebSocket.func2.1 github.com/ProtobufBot/Go-Mirai-Client/pkg/safe_ws/safe_ws.go:78 github.com/ProtobufBot/Go-Mirai-Client/pkg/util.SafeGo.func1 github.com/ProtobufBot/Go-Mirai-Client/pkg/util/util.go:118 runtime.goexit runtime/asm_amd64.s:1581

编译不通过

go build -ldflags "-s -w -extldflags '-static'" -o gmc ./service/gmc

github.com/ProtobufBot/Go-Mirai-Client/pkg/bot

pkg/bot/bot.go:119:11: undefined: wrapper.RegisterSign

群发送图片上传失败

ERRO[2021-09-24 21:39:40] failed to upload group image, dial tcp 180.109.192.140:14000: i/o timeout
connect error
github.com/Mrs4s/MiraiGo/client.(*QQClient).highwayUploadByBDH
        github.com/Mrs4s/[email protected]/client/highway.go:121
github.com/Mrs4s/MiraiGo/client.(*QQClient).UploadGroupImage
        github.com/Mrs4s/[email protected]/client/image.go:60
github.com/ProtobufBot/Go-Mirai-Client/pkg/bot.preProcessGroupSendingMessage
        github.com/ProtobufBot/Go-Mirai-Client/pkg/bot/api_handler.go:98
github.com/ProtobufBot/Go-Mirai-Client/pkg/bot.HandleSendGroupMsg
        github.com/ProtobufBot/Go-Mirai-Client/pkg/bot/api_handler.go:173
github.com/ProtobufBot/Go-Mirai-Client/pkg/bot.handleApiFrame
        github.com/ProtobufBot/Go-Mirai-Client/pkg/bot/remote.go:181
github.com/ProtobufBot/Go-Mirai-Client/pkg/bot.OnWsRecvMessage.func1
        github.com/ProtobufBot/Go-Mirai-Client/pkg/bot/remote.go:143
github.com/ProtobufBot/Go-Mirai-Client/pkg/safe_ws.NewSafeWebSocket.func2.1
        github.com/ProtobufBot/Go-Mirai-Client/pkg/safe_ws/safe_ws.go:78
github.com/ProtobufBot/Go-Mirai-Client/pkg/util.SafeGo.func1
        github.com/ProtobufBot/Go-Mirai-Client/pkg/util/util.go:118
runtime.goexit
        runtime/asm_amd64.s:1581
upload failed
github.com/Mrs4s/MiraiGo/client.(*QQClient).UploadGroupImage
        github.com/Mrs4s/[email protected]/client/image.go:63
github.com/ProtobufBot/Go-Mirai-Client/pkg/bot.preProcessGroupSendingMessage
        github.com/ProtobufBot/Go-Mirai-Client/pkg/bot/api_handler.go:98
github.com/ProtobufBot/Go-Mirai-Client/pkg/bot.HandleSendGroupMsg
        github.com/ProtobufBot/Go-Mirai-Client/pkg/bot/api_handler.go:173
github.com/ProtobufBot/Go-Mirai-Client/pkg/bot.handleApiFrame
        github.com/ProtobufBot/Go-Mirai-Client/pkg/bot/remote.go:181
github.com/ProtobufBot/Go-Mirai-Client/pkg/bot.OnWsRecvMessage.func1
        github.com/ProtobufBot/Go-Mirai-Client/pkg/bot/remote.go:143
github.com/ProtobufBot/Go-Mirai-Client/pkg/safe_ws.NewSafeWebSocket.func2.1
        github.com/ProtobufBot/Go-Mirai-Client/pkg/safe_ws/safe_ws.go:78
github.com/ProtobufBot/Go-Mirai-Client/pkg/util.SafeGo.func1
        github.com/ProtobufBot/Go-Mirai-Client/pkg/util/util.go:118
runtime.goexit
        runtime/asm_amd64.s:1581

私聊没问题,只会 failed to upload group image

同学,您这个项目引入了63个开源组件,存在1个漏洞,辛苦升级一下

检测到 ProtobufBot/Go-Mirai-Client 一共引入了63个开源组件,存在1个漏洞

漏洞标题:Gin-Gonic Gin 环境问题漏洞
缺陷组件:github.com/gin-gonic/[email protected]
漏洞编号:CVE-2020-28483
漏洞描述:Gin-Gonic Gin是Gin-Gonic团队的一个基于Go语言的用于快速构建Web应用的框架。
github.com/gin-gonic/gin 全部版本存在安全漏洞,该漏洞源于可以通过设置X-Forwarded-For头来欺骗客户端的IP。
影响范围:(∞, 1.7.7)
最小修复版本:1.7.7
缺陷组件引入路径:main@->github.com/gin-gonic/[email protected]

另外还有几个漏洞,详细报告:https://mofeisec.com/jr?p=a10600

多websocket连接

希望能增加 被动连接websocket 且支持多个消息处理服务器进行连接

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.