1
0
mirror of https://github.com/Mrs4s/MiraiGo.git synced 2025-05-04 19:17:38 +08:00

remove qrcode login limit.

This commit is contained in:
Mrs4s 2021-03-21 10:53:41 +08:00
parent 8e191523f6
commit f75561a2c0
3 changed files with 6 additions and 10 deletions

View File

@ -112,6 +112,7 @@ func (c *QQClient) buildDeviceLockLoginPacket() (uint16, []byte) {
}
func (c *QQClient) buildQRCodeFetchRequestPacket() (uint16, []byte) {
watch := genVersionInfo(AndroidWatch)
seq := c.nextSeq()
req := packets.BuildOicqRequestPacket(0, 0x812, crypto.ECDH, c.RandomKey, func(w *binary.Writer) {
w.WriteHex(`0001110000001000000072000000`) // trans header
@ -124,20 +125,21 @@ func (c *QQClient) buildQRCodeFetchRequestPacket() (uint16, []byte) {
w.WriteBytesShort(EmptyBytes)
w.WriteUInt16(6)
w.Write(tlv.T16(c.version.SSOVersion, 16, c.version.AppId, SystemDeviceInfo.Guid, []byte(c.version.ApkId), []byte(c.version.SortVersionName), c.version.ApkSign))
w.Write(tlv.T16(watch.SSOVersion, 16, watch.AppId, SystemDeviceInfo.Guid, []byte(watch.ApkId), []byte(watch.SortVersionName), watch.ApkSign))
w.Write(tlv.T1B(0, 0, 3, 4, 72, 2, 2))
w.Write(tlv.T1D(c.version.MiscBitmap))
w.Write(tlv.T1D(watch.MiscBitmap))
w.Write(tlv.T1F(false, SystemDeviceInfo.OSType, []byte("7.1.2"), []byte("China Mobile GSM"), SystemDeviceInfo.APN, 2))
w.Write(tlv.T33(SystemDeviceInfo.Guid))
w.Write(tlv.T35(8))
}))
})
sso := packets.BuildSsoPacket(seq, c.version.AppId, "wtlogin.trans_emp", SystemDeviceInfo.IMEI, []byte{}, c.OutGoingPacketSessionId, req, c.ksid)
sso := packets.BuildSsoPacket(seq, watch.AppId, "wtlogin.trans_emp", SystemDeviceInfo.IMEI, []byte{}, c.OutGoingPacketSessionId, req, c.ksid)
packet := packets.BuildLoginPacket(0, 2, make([]byte, 16), sso, []byte{})
return seq, packet
}
func (c *QQClient) buildQRCodeResultQueryRequestPacket(sig []byte) (uint16, []byte) {
watch := genVersionInfo(AndroidWatch)
seq := c.nextSeq()
req := packets.BuildOicqRequestPacket(0, 0x812, crypto.ECDH, c.RandomKey, func(w *binary.Writer) {
w.WriteHex(`0000620000001000000072000000`) // trans header
@ -154,7 +156,7 @@ func (c *QQClient) buildQRCodeResultQueryRequestPacket(sig []byte) (uint16, []by
w.WriteUInt16(0) // const
}))
})
sso := packets.BuildSsoPacket(seq, c.version.AppId, "wtlogin.trans_emp", SystemDeviceInfo.IMEI, []byte{}, c.OutGoingPacketSessionId, req, c.ksid)
sso := packets.BuildSsoPacket(seq, watch.AppId, "wtlogin.trans_emp", SystemDeviceInfo.IMEI, []byte{}, c.OutGoingPacketSessionId, req, c.ksid)
packet := packets.BuildLoginPacket(0, 2, make([]byte, 16), sso, []byte{})
return seq, packet
}

View File

@ -264,9 +264,6 @@ func (c *QQClient) Login() (*LoginResponse, error) {
}
func (c *QQClient) FetchQRCode() (*QRCodeLoginResponse, error) {
if SystemDeviceInfo.Protocol != AndroidWatch {
return nil, errors.New("only android watch protocol can login by QRCode")
}
if c.Online {
return nil, ErrAlreadyOnline
}

View File

@ -215,9 +215,6 @@ func decodeExchangeEmpResponse(c *QQClient, _ *incomingPacketInfo, payload []byt
// wtlogin.trans_emp
func decodeTransEmpResponse(c *QQClient, _ *incomingPacketInfo, payload []byte) (interface{}, error) {
if SystemDeviceInfo.Protocol != AndroidWatch { // safe
return nil, nil
}
if len(payload) < 48 {
return nil, errors.New("missing payload length")
}