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

improve t544

This commit is contained in:
Mrs4s 2023-03-11 01:07:26 +08:00
parent cdc207867e
commit 365235008b
No known key found for this signature in database
GPG Key ID: 3186E98FA19CE3A7
3 changed files with 30 additions and 14 deletions

View File

@ -112,7 +112,9 @@ func (c *QQClient) buildLoginPacket() (uint16, []byte) {
w.WriteUInt32(9) // sub command w.WriteUInt32(9) // sub command
w.WriteUInt32(0) // 被演了 w.WriteUInt32(0) // 被演了
}) })
t.Append(tlv.T544Custom("810_9", salt, wrapper.DandelionEnergy)) if t544 := tlv.T544Custom(uint64(c.Uin), "810_9", salt, wrapper.DandelionEnergy); t544 != nil {
t.Append(t544)
}
} }
if c.Device().QImei36 != "" { if c.Device().QImei36 != "" {
t.Append(tlv.T545([]byte(c.Device().QImei36))) t.Append(tlv.T545([]byte(c.Device().QImei36)))
@ -366,7 +368,9 @@ func (c *QQClient) buildSMSCodeSubmitPacket(code string) (uint16, []byte) {
}, },
} }
if wrapper.DandelionEnergy != nil { if wrapper.DandelionEnergy != nil {
t.Append(tlv.T544(uint64(c.Uin), "810_7", 7, c.version().SdkVersion, c.Device().Guid, wrapper.DandelionEnergy)) if t544 := tlv.T544(uint64(c.Uin), "810_7", 7, c.version().SdkVersion, c.Device().Guid, wrapper.DandelionEnergy); t544 != nil {
t.Append(t544)
}
} }
req := c.buildOicqRequestPacket(c.Uin, 0x0810, t) req := c.buildOicqRequestPacket(c.Uin, 0x0810, t)
r := network.Request{ r := network.Request{
@ -395,7 +399,9 @@ func (c *QQClient) buildTicketSubmitPacket(ticket string) (uint16, []byte) {
t.Append(tlv.T(0x547, c.sig.T547)) t.Append(tlv.T(0x547, c.sig.T547))
} }
if wrapper.DandelionEnergy != nil { if wrapper.DandelionEnergy != nil {
t.Append(tlv.T544(uint64(c.Uin), "810_2", 2, c.version().SdkVersion, c.Device().Guid, wrapper.DandelionEnergy)) if t544 := tlv.T544(uint64(c.Uin), "810_2", 2, c.version().SdkVersion, c.Device().Guid, wrapper.DandelionEnergy); t544 != nil {
t.Append(t544)
}
} }
req := c.buildOicqRequestPacket(c.Uin, 0x0810, t) req := c.buildOicqRequestPacket(c.Uin, 0x0810, t)
r := network.Request{ r := network.Request{

View File

@ -2,22 +2,32 @@ package tlv
import "github.com/Mrs4s/MiraiGo/binary" import "github.com/Mrs4s/MiraiGo/binary"
func T544(userId uint64, moduleId string, subCmd uint32, sdkVersion string, guid []byte, signer func(string, []byte) []byte) []byte { // temporary solution
return binary.NewWriterF(func(w *binary.Writer) {
w.WriteUInt16(0x544) func T544(userId uint64, moduleId string, subCmd uint32, sdkVersion string, guid []byte, signer func(uint64, string, []byte) ([]byte, error)) []byte {
salt := binary.NewWriterF(func(w *binary.Writer) { salt := binary.NewWriterF(func(w *binary.Writer) {
w.WriteUInt64(userId) w.WriteUInt64(userId)
w.WriteBytesShort(guid) w.WriteBytesShort(guid)
w.WriteBytesShort([]byte(sdkVersion)) w.WriteBytesShort([]byte(sdkVersion))
w.WriteUInt32(subCmd) w.WriteUInt32(subCmd)
}) })
w.WriteBytesShort(signer(moduleId, salt)) // temporary solution sign, err := signer(userId, moduleId, salt)
if err != nil {
return nil
}
return binary.NewWriterF(func(w *binary.Writer) {
w.WriteUInt16(0x544)
w.WriteBytesShort(sign)
}) })
} }
func T544Custom(moduleId string, salt []byte, signer func(string, []byte) []byte) []byte { func T544Custom(userId uint64, moduleId string, salt []byte, signer func(uint64, string, []byte) ([]byte, error)) []byte {
sign, err := signer(userId, moduleId, salt)
if err != nil {
return nil
}
return binary.NewWriterF(func(w *binary.Writer) { return binary.NewWriterF(func(w *binary.Writer) {
w.WriteUInt16(0x544) w.WriteUInt16(0x544)
w.WriteBytesShort(signer(moduleId, salt)) w.WriteBytesShort(sign)
}) })
} }

View File

@ -1,3 +1,3 @@
package wrapper package wrapper
var DandelionEnergy func(string, []byte) []byte var DandelionEnergy func(uint64, string, []byte) ([]byte, error)