mirror of
https://github.com/Mrs4s/MiraiGo.git
synced 2025-05-04 11:07:40 +08:00
fix decode error.
This commit is contained in:
parent
2050e45664
commit
8a968656c1
@ -46,7 +46,7 @@ func (c *QQClient) buildLoginPacket() (uint16, []byte) {
|
||||
w.Write(tlv.T107(0))
|
||||
w.Write(tlv.T142("com.tencent.mobileqq"))
|
||||
w.Write(tlv.T144(
|
||||
SystemDeviceInfo.AndroidId,
|
||||
[]byte(SystemDeviceInfo.IMEI),
|
||||
SystemDeviceInfo.GenDeviceInfoData(),
|
||||
SystemDeviceInfo.OSType,
|
||||
SystemDeviceInfo.Version.Release,
|
||||
|
@ -139,7 +139,7 @@ func decodeExchangeEmpResponse(c *QQClient, _ uint16, payload []byte) (interface
|
||||
return nil, nil
|
||||
}
|
||||
if cmd == 15 { // TODO: 免密登录
|
||||
c.decodeT119(m[0x119])
|
||||
c.decodeT119R(m[0x119])
|
||||
}
|
||||
return nil, nil
|
||||
}
|
||||
|
@ -23,18 +23,6 @@ func (c *QQClient) decodeT119(data []byte) {
|
||||
reader := binary.NewReader(tea.Decrypt(data))
|
||||
reader.ReadBytes(2)
|
||||
m := reader.ReadTlvMap(2)
|
||||
if len(c.sigInfo.sKey) > 0 { // refresh
|
||||
if t120, ok := m[0x120]; ok {
|
||||
c.sigInfo.sKey = t120
|
||||
c.sigInfo.sKeyExpiredTime = time.Now().Unix() + 43200 // 86400 / 2
|
||||
c.Debug("skey updated: %v", c.sigInfo.sKey)
|
||||
}
|
||||
if t11a, ok := m[0x11a]; ok {
|
||||
c.Nickname, c.Age, c.Gender = readT11A(t11a)
|
||||
c.Debug("account info updated: " + c.Nickname)
|
||||
}
|
||||
return
|
||||
}
|
||||
if t130, ok := m[0x130]; ok {
|
||||
c.decodeT130(t130)
|
||||
}
|
||||
@ -117,6 +105,23 @@ func (c *QQClient) decodeT119(data []byte) {
|
||||
c.Gender = gender
|
||||
}
|
||||
|
||||
// wtlogin.exchange_emp
|
||||
func (c *QQClient) decodeT119R(data []byte) {
|
||||
tea := binary.NewTeaCipher(SystemDeviceInfo.TgtgtKey)
|
||||
reader := binary.NewReader(tea.Decrypt(data))
|
||||
reader.ReadBytes(2)
|
||||
m := reader.ReadTlvMap(2)
|
||||
if t120, ok := m[0x120]; ok {
|
||||
c.sigInfo.sKey = t120
|
||||
c.sigInfo.sKeyExpiredTime = time.Now().Unix() + 43200 // 86400 / 2
|
||||
c.Debug("skey updated: %v", c.sigInfo.sKey)
|
||||
}
|
||||
if t11a, ok := m[0x11a]; ok {
|
||||
c.Nickname, c.Age, c.Gender = readT11A(t11a)
|
||||
c.Debug("account info updated: " + c.Nickname)
|
||||
}
|
||||
}
|
||||
|
||||
func (c *QQClient) decodeT130(data []byte) {
|
||||
reader := binary.NewReader(data)
|
||||
reader.ReadBytes(2)
|
||||
|
@ -1,9 +1,11 @@
|
||||
package tlv
|
||||
|
||||
import "github.com/Mrs4s/MiraiGo/binary"
|
||||
import (
|
||||
"github.com/Mrs4s/MiraiGo/binary"
|
||||
)
|
||||
|
||||
func T144(
|
||||
androidId, devInfo, osType, osVersion, simInfo, apn []byte,
|
||||
imei, devInfo, osType, osVersion, simInfo, apn []byte,
|
||||
isGuidFromFileNull, isGuidAvailable, isGuidChanged bool,
|
||||
guidFlag uint32,
|
||||
buildModel, guid, buildBrand, tgtgtKey []byte,
|
||||
@ -13,7 +15,7 @@ func T144(
|
||||
w.WriteTlv(binary.NewWriterF(func(w *binary.Writer) {
|
||||
w.EncryptAndWrite(tgtgtKey, binary.NewWriterF(func(w *binary.Writer) {
|
||||
w.WriteUInt16(5)
|
||||
w.Write(T109(androidId))
|
||||
w.Write(T109(imei))
|
||||
w.Write(T52D(devInfo))
|
||||
w.Write(T124(osType, osVersion, simInfo, apn))
|
||||
w.Write(T128(isGuidFromFileNull, isGuidAvailable, isGuidChanged, guidFlag, buildModel, guid, buildBrand))
|
||||
|
Loading…
x
Reference in New Issue
Block a user