diff --git a/client/client.go b/client/client.go index 4f98c393..f6cd5035 100644 --- a/client/client.go +++ b/client/client.go @@ -1055,7 +1055,7 @@ func (c *QQClient) netLoop() { } payload := pkt.Payload if pkt.Flag2 == 2 { - payload, err = pkt.DecryptPayload(c.RandomKey) + payload, err = pkt.DecryptPayload(c.RandomKey, c.sigInfo.wtSessionTicketKey) if err != nil { continue } diff --git a/protocol/packets/global.go b/protocol/packets/global.go index fb38fbf0..e7cd5140 100644 --- a/protocol/packets/global.go +++ b/protocol/packets/global.go @@ -166,7 +166,7 @@ func parseSsoFrame(payload []byte, flag2 byte) (*IncomingPacket, error) { }, nil } -func (pkt *IncomingPacket) DecryptPayload(random []byte) ([]byte, error) { +func (pkt *IncomingPacket) DecryptPayload(random, sessionKey []byte) ([]byte, error) { reader := binary.NewReader(pkt.Payload) if reader.ReadByte() != 2 { return nil, ErrUnknownFlag @@ -193,6 +193,12 @@ func (pkt *IncomingPacket) DecryptPayload(random []byte) ([]byte, error) { }() return data, nil } + if encryptType == 3 { + return func() []byte { + d := reader.ReadBytes(reader.Len() - 1) + return binary.NewTeaCipher(sessionKey).Decrypt(d) + }(), nil + } if encryptType == 4 { panic("todo") }