From d216d26eb1635115052a1563cda7545be275752a Mon Sep 17 00:00:00 2001 From: Mrs4s <1844812067@qq.com> Date: Mon, 25 Jan 2021 03:53:20 +0800 Subject: [PATCH] fix protocol. --- client/builders.go | 2 +- client/client.go | 1 + client/decoders.go | 4 +++- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/client/builders.go b/client/builders.go index ef11bf4c..c3c292c5 100644 --- a/client/builders.go +++ b/client/builders.go @@ -222,7 +222,7 @@ func (c *QQClient) buildRequestTgtgtNopicsigPacket() (uint16, []byte) { })) w.Write(tlv.T147(16, []byte(c.version.SortVersionName), c.version.ApkSign)) w.Write(tlv.T177(c.version.BuildTime, c.version.SdkVersion)) - w.Write(tlv.T400(c.g, c.Uin, SystemDeviceInfo.Guid, []byte("stMNokHgxZUGhsYp"), 1, 16, c.t403)) + w.Write(tlv.T400(c.g, c.Uin, SystemDeviceInfo.Guid, c.dpwd, 1, 16, c.t403)) w.Write(tlv.T187(SystemDeviceInfo.MacAddress)) w.Write(tlv.T188(SystemDeviceInfo.AndroidId)) w.Write(tlv.T194(SystemDeviceInfo.IMSIMd5)) diff --git a/client/client.go b/client/client.go index 8f9b7811..f2c123d7 100644 --- a/client/client.go +++ b/client/client.go @@ -57,6 +57,7 @@ type QQClient struct { retryTimes int version *versionInfo + dpwd []byte syncCookie []byte pubAccountCookie []byte msgCtrlBuf []byte diff --git a/client/decoders.go b/client/decoders.go index e42ed6cf..8d3a6137 100644 --- a/client/decoders.go +++ b/client/decoders.go @@ -6,6 +6,7 @@ import ( "fmt" "github.com/Mrs4s/MiraiGo/client/pb/cmd0x6ff" "github.com/Mrs4s/MiraiGo/client/pb/profilecard" + "github.com/Mrs4s/MiraiGo/utils" "net" "strconv" "strings" @@ -40,8 +41,9 @@ func decodeLoginResponse(c *QQClient, _ uint16, payload []byte) (interface{}, er reader.ReadUInt16() m := reader.ReadTlvMap(2) if m.Exists(0x402) { + c.dpwd = []byte(utils.RandomString(16)) c.t402 = m[0x402] - h := md5.Sum(append(append(SystemDeviceInfo.Guid, []byte("stMNokHgxZUGhsYp")...), c.t402...)) + h := md5.Sum(append(append(SystemDeviceInfo.Guid, c.dpwd...), c.t402...)) c.g = h[:] } if t == 0 { // login success