mirror of
https://github.com/Mrs4s/MiraiGo.git
synced 2025-05-04 19:17:38 +08:00
supported device lock login.
This commit is contained in:
parent
f4f1f11b58
commit
2289b05764
@ -78,6 +78,23 @@ func (c *QQClient) buildLoginPacket() (uint16, []byte) {
|
|||||||
return seq, packet
|
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) {
|
func (c *QQClient) buildCaptchaPacket(result string, sign []byte) (uint16, []byte) {
|
||||||
seq := c.nextSeq()
|
seq := c.nextSeq()
|
||||||
req := packets.BuildOicqRequestPacket(c.Uin, 0x810, crypto.ECDH, c.RandomKey, func(w *binary.Writer) {
|
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
|
return seq, packet
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *QQClient) buildOnlinePushRespPacket() {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *QQClient) buildFriendGroupListRequestPacket(friendStartIndex, friendListCount, groupStartIndex, groupListCount int16) (uint16, []byte) {
|
func (c *QQClient) buildFriendGroupListRequestPacket(friendStartIndex, friendListCount, groupStartIndex, groupListCount int16) (uint16, []byte) {
|
||||||
seq := c.nextSeq()
|
seq := c.nextSeq()
|
||||||
d50, _ := proto.Marshal(&pb.D50ReqBody{
|
d50, _ := proto.Marshal(&pb.D50ReqBody{
|
||||||
|
@ -56,14 +56,17 @@ func decodeLoginResponse(c *QQClient, seq uint16, payload []byte) (interface{},
|
|||||||
} // need captcha
|
} // need captcha
|
||||||
|
|
||||||
if t == 160 {
|
if t == 160 {
|
||||||
|
return LoginResponse{
|
||||||
|
Success: false,
|
||||||
|
Error: UnsafeDeviceError,
|
||||||
|
VerifyUrl: string(m[0x204]),
|
||||||
|
ErrorMessage: "",
|
||||||
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
if t == 204 {
|
if t == 204 {
|
||||||
return LoginResponse{
|
c.t104 = m[0x104]
|
||||||
Success: false,
|
return c.sendAndWait(c.buildDeviceLockLoginPacket(m[0x402]))
|
||||||
Error: DeviceLockError,
|
|
||||||
}, nil
|
|
||||||
} // drive lock
|
} // drive lock
|
||||||
|
|
||||||
if t149, ok := m[0x149]; ok {
|
if t149, ok := m[0x149]; ok {
|
||||||
|
@ -8,6 +8,7 @@ var (
|
|||||||
|
|
||||||
type (
|
type (
|
||||||
LoginError int
|
LoginError int
|
||||||
|
|
||||||
LoginResponse struct {
|
LoginResponse struct {
|
||||||
Success bool
|
Success bool
|
||||||
Error LoginError
|
Error LoginError
|
||||||
@ -16,6 +17,9 @@ type (
|
|||||||
CaptchaImage []byte
|
CaptchaImage []byte
|
||||||
CaptchaSign []byte
|
CaptchaSign []byte
|
||||||
|
|
||||||
|
// Unsafe device
|
||||||
|
VerifyUrl string
|
||||||
|
|
||||||
// other error
|
// other error
|
||||||
ErrorMessage string
|
ErrorMessage string
|
||||||
}
|
}
|
||||||
@ -91,5 +95,6 @@ const (
|
|||||||
NeedCaptcha LoginError = 1
|
NeedCaptcha LoginError = 1
|
||||||
DeviceLockError = 2
|
DeviceLockError = 2
|
||||||
OtherLoginError = 3
|
OtherLoginError = 3
|
||||||
|
UnsafeDeviceError = 4
|
||||||
UnknownLoginError = -1
|
UnknownLoginError = -1
|
||||||
)
|
)
|
||||||
|
10
protocol/tlv/t401.go
Normal file
10
protocol/tlv/t401.go
Normal 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)
|
||||||
|
})
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user