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

supported device lock login.

This commit is contained in:
Mrs4s 2020-07-08 13:17:41 +08:00
parent f4f1f11b58
commit 2289b05764
4 changed files with 41 additions and 10 deletions

View File

@ -78,6 +78,23 @@ func (c *QQClient) buildLoginPacket() (uint16, []byte) {
return seq, packet
}
func (c *QQClient) buildDeviceLockLoginPacket(t402 []byte) (uint16, []byte) {
seq := c.nextSeq()
req := packets.BuildOicqRequestPacket(c.Uin, 0x0810, crypto.ECDH, c.RandomKey, func(w *binary.Writer) {
w.WriteUInt16(20)
w.WriteUInt16(4)
w.Write(tlv.T8(2052))
w.Write(tlv.T104(c.t104))
w.Write(tlv.T116(150470524, 66560))
h := md5.Sum(append(append(SystemDeviceInfo.Guid, []byte("stMNokHgxZUGhsYp")...), t402...))
w.Write(tlv.T401(h[:]))
})
sso := packets.BuildSsoPacket(seq, "wtlogin.login", SystemDeviceInfo.IMEI, []byte{}, c.OutGoingPacketSessionId, req, c.ksid)
packet := packets.BuildLoginPacket(c.Uin, 2, make([]byte, 16), sso, []byte{})
return seq, packet
}
func (c *QQClient) buildCaptchaPacket(result string, sign []byte) (uint16, []byte) {
seq := c.nextSeq()
req := packets.BuildOicqRequestPacket(c.Uin, 0x810, crypto.ECDH, c.RandomKey, func(w *binary.Writer) {
@ -163,10 +180,6 @@ func (c *QQClient) buildConfPushRespPacket(t int32, pktSeq int64, jceBuf []byte)
return seq, packet
}
func (c *QQClient) buildOnlinePushRespPacket() {
}
func (c *QQClient) buildFriendGroupListRequestPacket(friendStartIndex, friendListCount, groupStartIndex, groupListCount int16) (uint16, []byte) {
seq := c.nextSeq()
d50, _ := proto.Marshal(&pb.D50ReqBody{

View File

@ -56,14 +56,17 @@ func decodeLoginResponse(c *QQClient, seq uint16, payload []byte) (interface{},
} // need captcha
if t == 160 {
return LoginResponse{
Success: false,
Error: UnsafeDeviceError,
VerifyUrl: string(m[0x204]),
ErrorMessage: "",
}, nil
}
if t == 204 {
return LoginResponse{
Success: false,
Error: DeviceLockError,
}, nil
c.t104 = m[0x104]
return c.sendAndWait(c.buildDeviceLockLoginPacket(m[0x402]))
} // drive lock
if t149, ok := m[0x149]; ok {

View File

@ -7,7 +7,8 @@ var (
)
type (
LoginError int
LoginError int
LoginResponse struct {
Success bool
Error LoginError
@ -16,6 +17,9 @@ type (
CaptchaImage []byte
CaptchaSign []byte
// Unsafe device
VerifyUrl string
// other error
ErrorMessage string
}
@ -91,5 +95,6 @@ const (
NeedCaptcha LoginError = 1
DeviceLockError = 2
OtherLoginError = 3
UnsafeDeviceError = 4
UnknownLoginError = -1
)

10
protocol/tlv/t401.go Normal file
View File

@ -0,0 +1,10 @@
package tlv
import "github.com/Mrs4s/MiraiGo/binary"
func T401(d []byte) []byte {
return binary.NewWriterF(func(w *binary.Writer) {
w.WriteUInt16(0x401)
w.WriteTlv(d)
})
}