-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
希望mirai能支持对json消息的ark签名 #2279
Comments
看起来可能好像和 |
是的是的,可惜我比较菜,希望mirai能支持,这样就能填补mirai不能发送视频消息的空缺了 |
最近我也遇到了这个问题,也在想办法能不能制作token出来,但是能力有限根本不知道怎么计算,不知道你是怎么通过oicq的core去获取token的呢? |
在第一条帖子中我已经说明了获取token的方法,这个token值并不是oicq进行计算的,我也试图找到他的算法,但最终以失败告终,通过oicq的底层代码可知,原本的json的文本内容,通过了增加了一些新的东西进去之后进行了两次编码(or 加密?)通过发送消息的方式发送回了腾讯服务器,然后本地监听了message事件,等待腾讯服务器返回签名好的json,然后在返回给ark签名的函数结果。关于oicq实现的代码不方便展现,这一功能实现原理在第一条已经提到过了,可以通过原来音乐分享的入口将type改为10通过小程序的方式”申请“签名好的token值,oicq的ark签名方法无法整个移植到mirai来,以为他需要发送消息的协议。 |
这个是从服务器动态拉取js代码来计算的吧?我之前找的,可能忘了 |
emmmmm,反正token值不是本地计算的,是要把json文本发送回腾讯服务器然后腾讯服务器计算完,返回带有签名的json回来,然后QQ机器人发出去 |
新版macqq查询打开的文件就能看到arkapp的js缓存文件 |
这样子嘛?有能找到相关的token的算法嘛?望提供下,谢谢! |
我还没仔细看过,这玩意可能是算法,可能是界面,而且是从服务器拉取的 |
直接贴链接不好么 |
这个方法是根据oicq单独写出来,链接只有oicq通过OidbSvc.0xb77_9分享音乐的方法 |
好吧 |
谢谢!我昨天在好几个地方看见你的id在问这个问题,但是都没人回答,谢谢你的代码! |
好的 |
我根据这个测了下,不知道为什么都是Time Out :(
|
以上的json只有手机端能显示吗 |
@Nambers 如果你用的最新的miria源代码的话,应该是QQ版本不支持该OidbSvc,可能需要你重新抓 |
qs 不过我对着 qq 8.8.95里面看了下,结构体和mirai一样的。我晚点可以试一下能不能抓到这个包 |
我看了下,我没抓到 0xb77 这个包, 但是有另外两个可能有关系的包 |
我看了下AdaptShareInfo, 我觉得他比较有可能取到ark, @Serializable
internal class StAdaptShareInfoReq(
@JvmField @ProtoNumber(1) val extInfo: StCommonExt? = null,
@JvmField @ProtoNumber(2) val appid: String = "",
@JvmField @ProtoNumber(3) val title: String = "",
@JvmField @ProtoNumber(4) val desc: String = "",
@JvmField @ProtoNumber(5) val time: Int = 0,
@JvmField @ProtoNumber(6) val scene: Int /* enum */ = 0,
@JvmField @ProtoNumber(7) val templetType: Int /* enum */ = 0,
@JvmField @ProtoNumber(8) val businessType: Int /* enum */ = 0,
@JvmField @ProtoNumber(9) val picUrl: String = "",
@JvmField @ProtoNumber(10) val vidUrl: String = "",
@JvmField @ProtoNumber(11) val jumpUrl: String = "",
@JvmField @ProtoNumber(12) val iconUrl: String = "",
@JvmField @ProtoNumber(13) val verType: Int = 0,
@JvmField @ProtoNumber(14) val shareType: Int = 0,
@JvmField @ProtoNumber(15) val versionId: String = "",
@JvmField @ProtoNumber(16) val withShareTicket: Int = 0,
@JvmField @ProtoNumber(17) val webURL: String = "",
@JvmField @ProtoNumber(18) val appidRich: String = "",
@JvmField @ProtoNumber(19) val template: StTemplateInfo? = null,
@JvmField @ProtoNumber(20) val rcvOpenId: String = ""
) : ProtoBuf
@Serializable
internal class StAdaptShareInfoRsp(
@JvmField @ProtoNumber(1) val extInfo: StCommonExt? = null,
@JvmField @ProtoNumber(2) val jsonData: String = ""
) : ProtoBuf 但是因为我模拟器上的qq不知道为什么打开不了任何小程序了(比如腾讯文档/qq音乐), 唯一抓到的包还是坏的, 然后我手上没有真机来抓 :( |
您好 请问如何正确调用此函数 本人不太熟悉nodejs 望回复 谢谢! |
我很抱歉,如果你不是oicq的开发者无法使用这个函数,以及有人写出了mirai支持的方法,详情可参考https://github.com/Mrs4s/MiraiGo/pull/307,我的疑惑也就此解开,也提醒各位请勿滥用ark签名去签名违法、违规的标签,json卡片最终会因为ark签名滥用而导致和谐,祝您早日替换成图片替换成卡片,再次关闭本issue |
了解 因为我是Java开发者 所以对于这两种语言不太熟悉 感谢您的回复 我再学习下 |
好的好的 |
关于mirai发送json不显示的问题&分析
一、问题复现
代码编写采用的是mirai-js以及TypeScript语言,实现代码如下:
发送完的卡片消息如下,但是手机端无法显示(不截图了)
二、问题分析
经过多方求助,根据oicq某某大佬提供,发出去的卡片需要带上token值,而这个token值是和整个token文本相呼应的,整个文本改了token值也要跟着变化,否则就会出现只能发不能收的现象,获取token这个一过程叫做ark签名(小栗子框架是这么定义的)
现在已经知晓的方法除了小栗子框架以外,开源的机器人框架可以使用小程序分享来获取签名后的json,由于我不熟悉Java和Kotlin没办法使用mirai的代码去实现一个签名的函数作为参考,因此采用oicq的core来签名上述的json如下:
可以看到签名后已经拿到了对应的token值“e0e8a49720c42903dc476783aced2d77”,在使用mirai发送试试
发送成功!!!!
三、总结与期盼
根据大佬提供的思路,只要支持音乐分享的框架,仅仅只需要把原来的type类型改成10就是小程序分享,具体代码如何实现的我不清楚,不是我发现的这一签名方法,希望mirai能支持ark签名的功能,让json消息不再是多余的存在!
The text was updated successfully, but these errors were encountered: