1
0
mirror of https://github.com/Mrs4s/MiraiGo.git synced 2025-05-04 11:07:40 +08:00

client: update Android version

This commit is contained in:
wdvxdr 2022-06-20 22:28:42 +08:00
parent d09215e943
commit 0ce160e357
No known key found for this signature in database
GPG Key ID: 703F8C071DE7A1B6
6 changed files with 49 additions and 19 deletions

View File

@ -434,17 +434,27 @@ func (c *QQClient) buildRequestTgtgtNopicsigPacket() (uint16, []byte) {
return seq, c.transport.PackPacket(&nreq) return seq, c.transport.PackPacket(&nreq)
} }
func (c *QQClient) buildRequestChangeSigPacket(mainSigMap uint32) (uint16, []byte) { func (c *QQClient) buildRequestChangeSigPacket(changeD2 bool) (uint16, []byte) {
seq := c.nextSeq() seq := c.nextSeq()
req := c.buildOicqRequestPacket(c.Uin, 0x0810, binary.NewWriterF(func(w *binary.Writer) { req := c.buildOicqRequestPacket(c.Uin, 0x0810, binary.NewWriterF(func(w *binary.Writer) {
w.WriteUInt16(11) if changeD2 {
w.WriteUInt16(17) w.WriteUInt16(11)
} else {
w.WriteUInt16(10)
}
w.WriteUInt16(19)
w.Write(tlv.T100(c.version.SSOVersion, 100, mainSigMap)) w.Write(tlv.T100(c.version.SSOVersion, 100, c.version.MainSigMap))
w.Write(tlv.T10A(c.sig.TGT)) w.Write(tlv.T10A(c.sig.TGT))
w.Write(tlv.T116(c.version.MiscBitmap, c.version.SubSigmap)) w.Write(tlv.T116(c.version.MiscBitmap, c.version.SubSigmap))
w.Write(tlv.T108(c.sig.Ksid)) w.Write(tlv.T108(c.sig.Ksid))
h := md5.Sum(c.sig.D2Key) var key []byte
if changeD2 {
h := md5.Sum(c.sig.D2Key)
key = h[:]
} else {
key = c.sig.TGTKey
}
w.Write(tlv.T144( w.Write(tlv.T144(
c.deviceInfo.AndroidId, c.deviceInfo.AndroidId,
c.deviceInfo.GenDeviceInfoData(), c.deviceInfo.GenDeviceInfoData(),
@ -456,9 +466,14 @@ func (c *QQClient) buildRequestChangeSigPacket(mainSigMap uint32) (uint16, []byt
c.deviceInfo.Model, c.deviceInfo.Model,
c.deviceInfo.Guid, c.deviceInfo.Guid,
c.deviceInfo.Brand, c.deviceInfo.Brand,
h[:], key,
)) ))
w.Write(tlv.T143(c.sig.D2)) w.Write(tlv.T112(c.Uin))
if changeD2 {
w.Write(tlv.T143(c.sig.D2))
} else {
w.Write(tlv.T145(c.deviceInfo.Guid))
}
w.Write(tlv.T142(c.version.ApkId)) w.Write(tlv.T142(c.version.ApkId))
w.Write(tlv.T154(seq)) w.Write(tlv.T154(seq))
w.Write(tlv.T18(16, uint32(c.Uin))) w.Write(tlv.T18(16, uint32(c.Uin)))
@ -474,7 +489,7 @@ func (c *QQClient) buildRequestChangeSigPacket(mainSigMap uint32) (uint16, []byt
"qzone.qq.com", "vip.qq.com", "qun.qq.com", "game.qq.com", "qqweb.qq.com", "qzone.qq.com", "vip.qq.com", "qun.qq.com", "game.qq.com", "qqweb.qq.com",
"office.qq.com", "ti.qq.com", "mail.qq.com", "qzone.com", "mma.qq.com", "office.qq.com", "ti.qq.com", "mail.qq.com", "qzone.com", "mma.qq.com",
})) }))
// w.Write(tlv.T202(c.deviceInfo.WifiBSSID, c.deviceInfo.WifiSSID)) w.Write(tlv.T202(c.deviceInfo.WifiBSSID, c.deviceInfo.WifiSSID))
})) }))
req2 := network.Request{ req2 := network.Request{

View File

@ -332,7 +332,7 @@ func (c *QQClient) TokenLogin(token []byte) error {
// SystemDeviceInfo.TgtgtKey = r.ReadBytesShort() // SystemDeviceInfo.TgtgtKey = r.ReadBytesShort()
c.deviceInfo.TgtgtKey = r.ReadBytesShort() c.deviceInfo.TgtgtKey = r.ReadBytesShort()
} }
_, err = c.sendAndWait(c.buildRequestChangeSigPacket(c.version.MainSigMap)) _, err = c.sendAndWait(c.buildRequestChangeSigPacket(true))
if err != nil { if err != nil {
return err return err
} }

View File

@ -788,7 +788,7 @@ func decodeWordSegmentation(_ *QQClient, _ *network.IncomingPacketInfo, payload
func decodeSidExpiredPacket(c *QQClient, i *network.IncomingPacketInfo, _ []byte) (any, error) { func decodeSidExpiredPacket(c *QQClient, i *network.IncomingPacketInfo, _ []byte) (any, error) {
/* /*
_, err := c.sendAndWait(c.buildRequestChangeSigPacket(3554528)) _, err := c.sendAndWait(c.buildRequestChangeSigPacket(true))
if err != nil { if err != nil {
return nil, errors.Wrap(err, "resign client error") return nil, errors.Wrap(err, "resign client error")
} }

View File

@ -32,16 +32,16 @@ func (i Protocol) Version() *AppVersion {
case AndroidPhone: // Dumped by mirai from qq android v8.8.38 case AndroidPhone: // Dumped by mirai from qq android v8.8.38
return &AppVersion{ return &AppVersion{
ApkId: "com.tencent.mobileqq", ApkId: "com.tencent.mobileqq",
AppId: 537100432, AppId: 537044845,
SubAppId: 537100432, SubAppId: 537044845,
SortVersionName: "8.8.38", SortVersionName: "8.8.95",
BuildTime: 1634310940, BuildTime: 1654672174,
ApkSign: []byte{0xA6, 0xB7, 0x45, 0xBF, 0x24, 0xA2, 0xC2, 0x77, 0x52, 0x77, 0x16, 0xF6, 0xF3, 0x6E, 0xB6, 0x8D}, ApkSign: []byte{0xA6, 0xB7, 0x45, 0xBF, 0x24, 0xA2, 0xC2, 0x77, 0x52, 0x77, 0x16, 0xF6, 0xF3, 0x6E, 0xB6, 0x8D},
SdkVersion: "6.0.0.2487", SdkVersion: "6.0.0.2512",
SSOVersion: 16, SSOVersion: 18,
MiscBitmap: 184024956, MiscBitmap: 150470524,
SubSigmap: 0x10400, SubSigmap: 0x10400,
MainSigMap: 34869472, MainSigMap: 16724722,
Protocol: i, Protocol: i,
} }
case AndroidWatch: case AndroidWatch:

View File

@ -9,7 +9,8 @@ import (
// SendGroupSign 发送群聊打卡消息 // SendGroupSign 发送群聊打卡消息
func (c *QQClient) SendGroupSign(target int64) { func (c *QQClient) SendGroupSign(target int64) {
_, _ = c.sendAndWait(c.buildGroupSignPacket(target)) _, pkt := c.buildGroupSignPacket(target)
_ = c.sendPacket(pkt)
} }
func (c *QQClient) buildGroupSignPacket(groupId int64) (uint16, []byte) { func (c *QQClient) buildGroupSignPacket(groupId int64) (uint16, []byte) {

14
internal/tlv/t112.go Normal file
View File

@ -0,0 +1,14 @@
package tlv
import (
"strconv"
"github.com/Mrs4s/MiraiGo/binary"
)
func T112(uin int64) []byte {
return binary.NewWriterF(func(w *binary.Writer) {
w.WriteUInt16(0x112)
w.WriteStringShort(strconv.FormatInt(uin, 10))
})
}