1
0
mirror of https://github.com/Mrs4s/MiraiGo.git synced 2025-05-07 20:45:53 +08:00

update new type.

This commit is contained in:
Mrs4s 2020-09-24 09:09:29 +08:00
parent 916d230456
commit 7721ebdde8
2 changed files with 8 additions and 2 deletions

View File

@ -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
}

View File

@ -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")
}