mirror of
https://github.com/Mrs4s/MiraiGo.git
synced 2025-05-04 11:07:40 +08:00
feat: qrcode login.
This commit is contained in:
parent
a1d72e772a
commit
8e191523f6
@ -62,6 +62,11 @@ func (r *Reader) ReadInt32() int32 {
|
||||
return (int32(b[0]) << 24) | (int32(b[1]) << 16) | (int32(b[2]) << 8) | int32(b[3])
|
||||
}
|
||||
|
||||
func (r *Reader) ReadInt64() int64 {
|
||||
b := r.ReadBytes(8)
|
||||
return ((int64(b[0]) << 56) | (int64(b[1]) << 48) | (int64(b[2]) << 40) | (int64(b[3]) << 32) | int64(b[4])<<24) | (int64(b[5]) << 16) | (int64(b[6]) << 8) | int64(b[7])
|
||||
}
|
||||
|
||||
func (r *Reader) ReadString() string {
|
||||
data := r.ReadBytes(int(r.ReadInt32() - 4))
|
||||
return string(data)
|
||||
|
@ -3,6 +3,7 @@ package binary
|
||||
import (
|
||||
"bytes"
|
||||
"encoding/binary"
|
||||
"encoding/hex"
|
||||
)
|
||||
|
||||
type Writer bytes.Buffer
|
||||
@ -48,6 +49,11 @@ func (w *Writer) Write(b []byte) {
|
||||
(*bytes.Buffer)(w).Write(b)
|
||||
}
|
||||
|
||||
func (w *Writer) WriteHex(h string) {
|
||||
b, _ := hex.DecodeString(h)
|
||||
w.Write(b)
|
||||
}
|
||||
|
||||
func (w *Writer) WriteByte(b byte) {
|
||||
(*bytes.Buffer)(w).WriteByte(b)
|
||||
}
|
||||
@ -77,7 +83,7 @@ func (w *Writer) WriteString(v string) {
|
||||
}
|
||||
|
||||
func (w *Writer) WriteStringShort(v string) {
|
||||
w.WriteTlv([]byte(v))
|
||||
w.WriteBytesShort([]byte(v))
|
||||
}
|
||||
|
||||
func (w *Writer) WriteBool(b bool) {
|
||||
@ -117,17 +123,17 @@ func (w *Writer) WriteUniPacket(commandName string, sessionId, extraData, body [
|
||||
})
|
||||
}
|
||||
|
||||
func (w *Writer) WriteTlv(data []byte) {
|
||||
func (w *Writer) WriteBytesShort(data []byte) {
|
||||
w.WriteUInt16(uint16(len(data)))
|
||||
w.Write(data)
|
||||
}
|
||||
|
||||
func (w *Writer) WriteTlvLimitedSize(data []byte, limit int) {
|
||||
if len(data) <= limit {
|
||||
w.WriteTlv(data)
|
||||
w.WriteBytesShort(data)
|
||||
return
|
||||
}
|
||||
w.WriteTlv(data[:limit])
|
||||
w.WriteBytesShort(data[:limit])
|
||||
}
|
||||
|
||||
func (w *Writer) Bytes() []byte {
|
||||
|
@ -87,7 +87,7 @@ func (c *QQClient) buildLoginPacket() (uint16, []byte) {
|
||||
}
|
||||
w.Write(tlv.T177(c.version.BuildTime, c.version.SdkVersion))
|
||||
w.Write(tlv.T516())
|
||||
w.Write(tlv.T521())
|
||||
w.Write(tlv.T521(0))
|
||||
w.Write(tlv.T525(tlv.T536([]byte{0x01, 0x00})))
|
||||
})
|
||||
sso := packets.BuildSsoPacket(seq, c.version.AppId, "wtlogin.login", SystemDeviceInfo.IMEI, []byte{}, c.OutGoingPacketSessionId, req, c.ksid)
|
||||
@ -111,6 +111,122 @@ func (c *QQClient) buildDeviceLockLoginPacket() (uint16, []byte) {
|
||||
return seq, packet
|
||||
}
|
||||
|
||||
func (c *QQClient) buildQRCodeFetchRequestPacket() (uint16, []byte) {
|
||||
seq := c.nextSeq()
|
||||
req := packets.BuildOicqRequestPacket(0, 0x812, crypto.ECDH, c.RandomKey, func(w *binary.Writer) {
|
||||
w.WriteHex(`0001110000001000000072000000`) // trans header
|
||||
w.WriteUInt32(uint32(time.Now().Unix()))
|
||||
w.Write(packets.BuildCode2DRequestPacket(0, 0, 0x31, func(w *binary.Writer) {
|
||||
w.WriteUInt16(0) // const
|
||||
w.WriteUInt32(16) // app id
|
||||
w.WriteUInt64(0) // const
|
||||
w.WriteByte(8) // const
|
||||
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.T1B(0, 0, 3, 4, 72, 2, 2))
|
||||
w.Write(tlv.T1D(c.version.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)
|
||||
packet := packets.BuildLoginPacket(0, 2, make([]byte, 16), sso, []byte{})
|
||||
return seq, packet
|
||||
}
|
||||
|
||||
func (c *QQClient) buildQRCodeResultQueryRequestPacket(sig []byte) (uint16, []byte) {
|
||||
seq := c.nextSeq()
|
||||
req := packets.BuildOicqRequestPacket(0, 0x812, crypto.ECDH, c.RandomKey, func(w *binary.Writer) {
|
||||
w.WriteHex(`0000620000001000000072000000`) // trans header
|
||||
w.WriteUInt32(uint32(time.Now().Unix()))
|
||||
w.Write(packets.BuildCode2DRequestPacket(1, 0, 0x12, func(w *binary.Writer) {
|
||||
w.WriteUInt16(5) // const
|
||||
w.WriteByte(1) // const
|
||||
w.WriteUInt32(8) // product type
|
||||
w.WriteUInt32(16) // app id
|
||||
w.WriteBytesShort(sig)
|
||||
w.WriteUInt64(0) // const
|
||||
w.WriteByte(8) // const
|
||||
w.WriteBytesShort(EmptyBytes)
|
||||
w.WriteUInt16(0) // const
|
||||
}))
|
||||
})
|
||||
sso := packets.BuildSsoPacket(seq, c.version.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) buildQRCodeLoginPacket(t106, t16a, t318 []byte) (uint16, []byte) {
|
||||
seq := c.nextSeq()
|
||||
req := packets.BuildOicqRequestPacket(c.Uin, 0x0810, crypto.ECDH, c.RandomKey, func(w *binary.Writer) {
|
||||
w.WriteUInt16(9)
|
||||
w.WriteUInt16(24)
|
||||
|
||||
w.Write(tlv.T18(16, uint32(c.Uin)))
|
||||
w.Write(tlv.T1(uint32(c.Uin), SystemDeviceInfo.IpAddress))
|
||||
w.Write(binary.NewWriterF(func(w *binary.Writer) {
|
||||
w.WriteUInt16(0x106)
|
||||
w.WriteBytesShort(t106)
|
||||
}))
|
||||
//w.Write(tlv.T106(uint32(c.Uin), 0, c.version.AppId, c.version.SSOVersion, c.PasswordMd5, true, SystemDeviceInfo.Guid, SystemDeviceInfo.TgtgtKey, 0))
|
||||
w.Write(tlv.T116(c.version.MiscBitmap, c.version.SubSigmap))
|
||||
w.Write(tlv.T100(c.version.SSOVersion, c.version.AppId, c.version.MainSigMap))
|
||||
w.Write(tlv.T107(0))
|
||||
w.Write(tlv.T142(c.version.ApkId))
|
||||
w.Write(tlv.T144(
|
||||
[]byte(SystemDeviceInfo.IMEI),
|
||||
SystemDeviceInfo.GenDeviceInfoData(),
|
||||
SystemDeviceInfo.OSType,
|
||||
SystemDeviceInfo.Version.Release,
|
||||
SystemDeviceInfo.SimInfo,
|
||||
SystemDeviceInfo.APN,
|
||||
false, true, false, tlv.GuidFlag(),
|
||||
SystemDeviceInfo.Model,
|
||||
SystemDeviceInfo.Guid,
|
||||
SystemDeviceInfo.Brand,
|
||||
SystemDeviceInfo.TgtgtKey,
|
||||
))
|
||||
|
||||
w.Write(tlv.T145(SystemDeviceInfo.Guid))
|
||||
w.Write(tlv.T147(16, []byte(c.version.SortVersionName), c.version.ApkSign))
|
||||
w.Write(binary.NewWriterF(func(w *binary.Writer) {
|
||||
w.WriteUInt16(0x16A)
|
||||
w.WriteBytesShort(t16a)
|
||||
}))
|
||||
w.Write(tlv.T154(seq))
|
||||
w.Write(tlv.T141(SystemDeviceInfo.SimInfo, SystemDeviceInfo.APN))
|
||||
w.Write(tlv.T8(2052))
|
||||
w.Write(tlv.T511([]string{
|
||||
"tenpay.com", "openmobile.qq.com", "docs.qq.com", "connect.qq.com",
|
||||
"qzone.qq.com", "vip.qq.com", "gamecenter.qq.com", "qun.qq.com", "game.qq.com",
|
||||
"qqweb.qq.com", "office.qq.com", "ti.qq.com", "mail.qq.com", "mma.qq.com",
|
||||
}))
|
||||
w.Write(tlv.T187(SystemDeviceInfo.MacAddress))
|
||||
w.Write(tlv.T188(SystemDeviceInfo.AndroidId))
|
||||
if len(SystemDeviceInfo.IMSIMd5) != 0 {
|
||||
w.Write(tlv.T194(SystemDeviceInfo.IMSIMd5))
|
||||
}
|
||||
w.Write(tlv.T191(0x00))
|
||||
if len(SystemDeviceInfo.WifiBSSID) != 0 && len(SystemDeviceInfo.WifiSSID) != 0 {
|
||||
w.Write(tlv.T202(SystemDeviceInfo.WifiBSSID, SystemDeviceInfo.WifiSSID))
|
||||
}
|
||||
w.Write(tlv.T177(c.version.BuildTime, c.version.SdkVersion))
|
||||
w.Write(tlv.T516())
|
||||
w.Write(tlv.T521(8))
|
||||
//w.Write(tlv.T525(tlv.T536([]byte{0x01, 0x00})))
|
||||
w.Write(binary.NewWriterF(func(w *binary.Writer) {
|
||||
w.WriteUInt16(0x318)
|
||||
w.WriteBytesShort(t318)
|
||||
}))
|
||||
})
|
||||
sso := packets.BuildSsoPacket(seq, c.version.AppId, "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) {
|
||||
@ -190,7 +306,7 @@ func (c *QQClient) buildRequestTgtgtNopicsigPacket() (uint16, []byte) {
|
||||
w.Write(tlv.T1(uint32(c.Uin), SystemDeviceInfo.IpAddress))
|
||||
w.Write(binary.NewWriterF(func(w *binary.Writer) {
|
||||
w.WriteUInt16(0x106)
|
||||
w.WriteTlv(c.sigInfo.encryptedA1)
|
||||
w.WriteBytesShort(c.sigInfo.encryptedA1)
|
||||
}))
|
||||
w.Write(tlv.T116(c.version.MiscBitmap, c.version.SubSigmap))
|
||||
w.Write(tlv.T100(c.version.SSOVersion, 2, c.version.MainSigMap))
|
||||
@ -227,7 +343,7 @@ func (c *QQClient) buildRequestTgtgtNopicsigPacket() (uint16, []byte) {
|
||||
w.Write(tlv.T194(SystemDeviceInfo.IMSIMd5))
|
||||
w.Write(tlv.T202(SystemDeviceInfo.WifiBSSID, SystemDeviceInfo.WifiSSID))
|
||||
w.Write(tlv.T516())
|
||||
w.Write(tlv.T521())
|
||||
w.Write(tlv.T521(0))
|
||||
w.Write(tlv.T525(tlv.T536([]byte{0x01, 0x00})))
|
||||
|
||||
})
|
||||
|
@ -130,6 +130,7 @@ type handlerInfo struct {
|
||||
var decoders = map[string]func(*QQClient, *incomingPacketInfo, []byte) (interface{}, error){
|
||||
"wtlogin.login": decodeLoginResponse,
|
||||
"wtlogin.exchange_emp": decodeExchangeEmpResponse,
|
||||
"wtlogin.trans_emp": decodeTransEmpResponse,
|
||||
"StatSvc.register": decodeClientRegisterResponse,
|
||||
"StatSvc.ReqMSFOffline": decodeMSFOfflinePacket,
|
||||
"MessageSvc.PushNotify": decodeSvcNotify,
|
||||
@ -163,6 +164,10 @@ func NewClient(uin int64, password string) *QQClient {
|
||||
return NewClientMd5(uin, md5.Sum([]byte(password)))
|
||||
}
|
||||
|
||||
func NewClientEmpty() *QQClient {
|
||||
return NewClient(0, "")
|
||||
}
|
||||
|
||||
func NewClientMd5(uin int64, passwordMd5 [16]byte) *QQClient {
|
||||
crypto.ECDH.FetchPubKey(uin)
|
||||
cli := &QQClient{
|
||||
@ -258,6 +263,47 @@ func (c *QQClient) Login() (*LoginResponse, error) {
|
||||
return &l, nil
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
if c.Conn == nil {
|
||||
err := c.connect()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
go c.netLoop()
|
||||
}
|
||||
i, err := c.sendAndWait(c.buildQRCodeFetchRequestPacket())
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "fetch qrcode error")
|
||||
}
|
||||
return i.(*QRCodeLoginResponse), nil
|
||||
}
|
||||
|
||||
func (c *QQClient) QueryQRCodeStatus(sig []byte) (*QRCodeLoginResponse, error) {
|
||||
i, err := c.sendAndWait(c.buildQRCodeResultQueryRequestPacket(sig))
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "query result error")
|
||||
}
|
||||
return i.(*QRCodeLoginResponse), nil
|
||||
}
|
||||
|
||||
func (c *QQClient) QRCodeLogin(info *QRCodeLoginInfo) (*LoginResponse, error) {
|
||||
i, err := c.sendAndWait(c.buildQRCodeLoginPacket(info.tmpPwd, info.tmpNoPicSig, info.tgtQR))
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "qrcode login error")
|
||||
}
|
||||
rsp := i.(LoginResponse)
|
||||
if rsp.Success {
|
||||
c.init()
|
||||
}
|
||||
return &rsp, nil
|
||||
}
|
||||
|
||||
// SubmitCaptcha send captcha to server
|
||||
func (c *QQClient) SubmitCaptcha(result string, sign []byte) (*LoginResponse, error) {
|
||||
seq, packet := c.buildCaptchaPacket(result, sign)
|
||||
|
@ -213,6 +213,88 @@ func decodeExchangeEmpResponse(c *QQClient, _ *incomingPacketInfo, payload []byt
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
// 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")
|
||||
}
|
||||
reader := binary.NewReader(payload)
|
||||
reader.ReadBytes(5) // trans req head
|
||||
reader.ReadByte()
|
||||
reader.ReadUInt16()
|
||||
cmd := reader.ReadUInt16()
|
||||
reader.ReadBytes(21)
|
||||
reader.ReadByte()
|
||||
reader.ReadUInt16()
|
||||
reader.ReadUInt16()
|
||||
reader.ReadInt32()
|
||||
reader.ReadInt64()
|
||||
body := binary.NewReader(reader.ReadBytes(reader.Len() - 1))
|
||||
if cmd == 0x31 {
|
||||
body.ReadUInt16()
|
||||
body.ReadInt32()
|
||||
code := body.ReadByte()
|
||||
if code != 0 {
|
||||
return nil, errors.Errorf("wtlogin.trans_emp sub cmd 0x31 error: %v", code)
|
||||
}
|
||||
sig := body.ReadBytesShort()
|
||||
body.ReadUInt16()
|
||||
m := body.ReadTlvMap(2)
|
||||
if m.Exists(0x17) {
|
||||
return &QRCodeLoginResponse{
|
||||
State: QRCodeImageFetch,
|
||||
ImageData: m[0x17],
|
||||
Sig: sig,
|
||||
}, nil
|
||||
}
|
||||
return nil, errors.Errorf("wtlogin.trans_emp sub cmd 0x31 error: image not found")
|
||||
}
|
||||
if cmd == 0x12 {
|
||||
aVarLen := body.ReadUInt16()
|
||||
if aVarLen != 0 {
|
||||
aVarLen-- // 阴间的位移操作
|
||||
if body.ReadByte() == 2 {
|
||||
body.ReadInt64() // uin ?
|
||||
aVarLen -= 8
|
||||
}
|
||||
}
|
||||
if aVarLen > 0 {
|
||||
body.ReadBytes(int(aVarLen))
|
||||
}
|
||||
body.ReadInt32() // app id?
|
||||
code := body.ReadByte()
|
||||
if code != 0 {
|
||||
if code == 0x30 {
|
||||
return &QRCodeLoginResponse{State: QRCodeWaitingForScan}, nil
|
||||
}
|
||||
if code == 0x35 {
|
||||
return &QRCodeLoginResponse{State: QRCodeWaitingForConfirm}, nil
|
||||
}
|
||||
if code == 0x11 {
|
||||
return &QRCodeLoginResponse{State: QRCodeTimeout}, nil
|
||||
}
|
||||
return nil, errors.Errorf("wtlogin.trans_emp sub cmd 0x12 error: %v", code)
|
||||
}
|
||||
c.Uin = body.ReadInt64()
|
||||
body.ReadInt32() // sig create time
|
||||
body.ReadUInt16()
|
||||
m := body.ReadTlvMap(2)
|
||||
if !m.Exists(0x18) || !m.Exists(0x1e) || !m.Exists(0x19) {
|
||||
return nil, errors.New("wtlogin.trans_emp sub cmd 0x12 error: tlv error")
|
||||
}
|
||||
SystemDeviceInfo.TgtgtKey = m[0x1e]
|
||||
return &QRCodeLoginResponse{State: QRCodeConfirmed, LoginInfo: &QRCodeLoginInfo{
|
||||
tmpPwd: m[0x18],
|
||||
tmpNoPicSig: m[0x19],
|
||||
tgtQR: m[0x65],
|
||||
}}, nil
|
||||
}
|
||||
return nil, errors.Errorf("unknown trans_emp response: %v", cmd)
|
||||
}
|
||||
|
||||
// ConfigPushSvc.PushReq
|
||||
func decodePushReqPacket(c *QQClient, _ *incomingPacketInfo, payload []byte) (interface{}, error) {
|
||||
request := &jce.RequestPacket{}
|
||||
|
@ -15,6 +15,8 @@ var (
|
||||
type (
|
||||
LoginError int
|
||||
|
||||
QRCodeLoginState int
|
||||
|
||||
MemberPermission int
|
||||
|
||||
ClientProtocol int
|
||||
@ -37,6 +39,21 @@ type (
|
||||
ErrorMessage string
|
||||
}
|
||||
|
||||
QRCodeLoginResponse struct {
|
||||
State QRCodeLoginState
|
||||
|
||||
ImageData []byte
|
||||
Sig []byte
|
||||
|
||||
LoginInfo *QRCodeLoginInfo
|
||||
}
|
||||
|
||||
QRCodeLoginInfo struct {
|
||||
tmpPwd []byte
|
||||
tmpNoPicSig []byte
|
||||
tgtQR []byte
|
||||
}
|
||||
|
||||
FriendInfo struct {
|
||||
Uin int64
|
||||
Nickname string
|
||||
@ -271,6 +288,12 @@ const (
|
||||
SliderNeededError LoginError = 8
|
||||
UnknownLoginError LoginError = -1
|
||||
|
||||
QRCodeImageFetch QRCodeLoginState = 1
|
||||
QRCodeWaitingForScan QRCodeLoginState = 2
|
||||
QRCodeWaitingForConfirm QRCodeLoginState = 3
|
||||
QRCodeTimeout QRCodeLoginState = 4
|
||||
QRCodeConfirmed QRCodeLoginState = 5
|
||||
|
||||
Owner MemberPermission = iota
|
||||
Administrator
|
||||
Member
|
||||
|
@ -203,14 +203,14 @@ func genVersionInfo(p ClientProtocol) *versionInfo {
|
||||
}
|
||||
case AndroidWatch:
|
||||
return &versionInfo{
|
||||
ApkId: "com.tencent.mobileqq",
|
||||
AppId: 537061176,
|
||||
SortVersionName: "8.2.7",
|
||||
BuildTime: 1571193922,
|
||||
ApkId: "com.tencent.qqlite",
|
||||
AppId: 537064446,
|
||||
SortVersionName: "2.0.5",
|
||||
BuildTime: 1559564731,
|
||||
ApkSign: []byte{0xA6, 0xB7, 0x45, 0xBF, 0x24, 0xA2, 0xC2, 0x77, 0x52, 0x77, 0x16, 0xF6, 0xF3, 0x6E, 0xB6, 0x8D},
|
||||
SdkVersion: "6.0.0.2413",
|
||||
SdkVersion: "6.0.0.236",
|
||||
SSOVersion: 5,
|
||||
MiscBitmap: 184024956,
|
||||
MiscBitmap: 16252796,
|
||||
SubSigmap: 0x10400,
|
||||
MainSigMap: 34869472,
|
||||
}
|
||||
|
@ -55,6 +55,23 @@ func BuildOicqRequestPacket(uin int64, commandId uint16, encrypt IEncryptMethod,
|
||||
return p.Bytes()
|
||||
}
|
||||
|
||||
func BuildCode2DRequestPacket(seq uint32, j uint64, cmd uint16, bodyFunc func(writer *binary.Writer)) []byte {
|
||||
return binary.NewWriterF(func(w *binary.Writer) {
|
||||
body := binary.NewWriterF(bodyFunc)
|
||||
w.WriteByte(2)
|
||||
w.WriteUInt16(uint16(43 + len(body) + 1))
|
||||
w.WriteUInt16(cmd)
|
||||
w.Write(make([]byte, 21))
|
||||
w.WriteByte(3)
|
||||
w.WriteUInt16(0)
|
||||
w.WriteUInt16(50) // version
|
||||
w.WriteUInt32(seq)
|
||||
w.WriteUInt64(j)
|
||||
w.Write(body)
|
||||
w.WriteByte(3)
|
||||
})
|
||||
}
|
||||
|
||||
func BuildSsoPacket(seq uint16, appId uint32, commandName, imei string, extData, outPacketSessionId, body, ksid []byte) []byte {
|
||||
p := binary.NewWriter()
|
||||
p.WriteIntLvPacket(4, func(writer *binary.Writer) {
|
||||
@ -95,7 +112,7 @@ func ParseIncomingPacket(payload, d2key []byte) (*IncomingPacket, error) {
|
||||
flag1 := reader.ReadInt32()
|
||||
flag2 := reader.ReadByte()
|
||||
if reader.ReadByte() != 0 { // flag3
|
||||
return nil, errors.WithStack(ErrUnknownFlag)
|
||||
//return nil, errors.WithStack(ErrUnknownFlag)
|
||||
}
|
||||
reader.ReadString() // uin string
|
||||
decrypted := func() (data []byte) {
|
||||
|
@ -13,7 +13,7 @@ func T1(uin uint32, ip []byte) []byte {
|
||||
}
|
||||
return binary.NewWriterF(func(w *binary.Writer) {
|
||||
w.WriteUInt16(0x01)
|
||||
w.WriteTlv(binary.NewWriterF(func(w *binary.Writer) {
|
||||
w.WriteBytesShort(binary.NewWriterF(func(w *binary.Writer) {
|
||||
w.WriteUInt16(1)
|
||||
w.WriteUInt32(rand.Uint32())
|
||||
w.WriteUInt32(uin)
|
||||
|
@ -7,7 +7,7 @@ import (
|
||||
func T100(ssoVersion, protocol, mainSigMap uint32) []byte {
|
||||
return binary.NewWriterF(func(w *binary.Writer) {
|
||||
w.WriteUInt16(0x100)
|
||||
w.WriteTlv(binary.NewWriterF(func(w *binary.Writer) {
|
||||
w.WriteBytesShort(binary.NewWriterF(func(w *binary.Writer) {
|
||||
w.WriteUInt16(1)
|
||||
w.WriteUInt32(ssoVersion)
|
||||
w.WriteUInt32(16)
|
||||
|
@ -5,6 +5,6 @@ import "github.com/Mrs4s/MiraiGo/binary"
|
||||
func T104(data []byte) []byte {
|
||||
return binary.NewWriterF(func(w *binary.Writer) {
|
||||
w.WriteUInt16(0x104)
|
||||
w.WriteTlv(data)
|
||||
w.WriteBytesShort(data)
|
||||
})
|
||||
}
|
||||
|
@ -40,10 +40,10 @@ func T106(uin, salt, appId, ssoVer uint32, passwordMd5 [16]byte, guidAvailable b
|
||||
}
|
||||
w.WriteUInt32(appId)
|
||||
w.WriteUInt32(1) // password login
|
||||
w.WriteTlv([]byte(strconv.FormatInt(int64(uin), 10)))
|
||||
w.WriteBytesShort([]byte(strconv.FormatInt(int64(uin), 10)))
|
||||
w.WriteUInt16(0)
|
||||
})
|
||||
w.WriteTlv(binary.NewWriterF(func(w *binary.Writer) {
|
||||
w.WriteBytesShort(binary.NewWriterF(func(w *binary.Writer) {
|
||||
b := make([]byte, 4)
|
||||
if salt != 0 {
|
||||
binary2.BigEndian.PutUint32(b, salt)
|
||||
|
@ -5,7 +5,7 @@ import "github.com/Mrs4s/MiraiGo/binary"
|
||||
func T107(picType uint16) []byte {
|
||||
return binary.NewWriterF(func(w *binary.Writer) {
|
||||
w.WriteUInt16(0x107)
|
||||
w.WriteTlv(binary.NewWriterF(func(w *binary.Writer) {
|
||||
w.WriteBytesShort(binary.NewWriterF(func(w *binary.Writer) {
|
||||
w.WriteUInt16(picType)
|
||||
w.WriteByte(0x00)
|
||||
w.WriteUInt16(0)
|
||||
|
@ -5,6 +5,6 @@ import "github.com/Mrs4s/MiraiGo/binary"
|
||||
func T108(imei string) []byte {
|
||||
return binary.NewWriterF(func(w *binary.Writer) {
|
||||
w.WriteUInt16(0x108)
|
||||
w.WriteTlv([]byte(imei))
|
||||
w.WriteBytesShort([]byte(imei))
|
||||
})
|
||||
}
|
||||
|
@ -9,7 +9,7 @@ import (
|
||||
func T109(androidId []byte) []byte {
|
||||
return binary.NewWriterF(func(w *binary.Writer) {
|
||||
w.WriteUInt16(0x109)
|
||||
w.WriteTlv(binary.NewWriterF(func(w *binary.Writer) {
|
||||
w.WriteBytesShort(binary.NewWriterF(func(w *binary.Writer) {
|
||||
h := md5.Sum(androidId)
|
||||
w.Write(h[:])
|
||||
}))
|
||||
|
@ -5,6 +5,6 @@ import "github.com/Mrs4s/MiraiGo/binary"
|
||||
func T10A(arr []byte) []byte {
|
||||
return binary.NewWriterF(func(w *binary.Writer) {
|
||||
w.WriteUInt16(0x10A)
|
||||
w.WriteTlv(arr)
|
||||
w.WriteBytesShort(arr)
|
||||
})
|
||||
}
|
||||
|
@ -5,7 +5,7 @@ import "github.com/Mrs4s/MiraiGo/binary"
|
||||
func T116(miscBitmap, subSigMap uint32) []byte {
|
||||
return binary.NewWriterF(func(w *binary.Writer) {
|
||||
w.WriteUInt16(0x116)
|
||||
w.WriteTlv(binary.NewWriterF(func(w *binary.Writer) {
|
||||
w.WriteBytesShort(binary.NewWriterF(func(w *binary.Writer) {
|
||||
w.WriteByte(0x00)
|
||||
w.WriteUInt32(miscBitmap)
|
||||
w.WriteUInt32(subSigMap)
|
||||
|
@ -5,7 +5,7 @@ import "github.com/Mrs4s/MiraiGo/binary"
|
||||
func T124(osType, osVersion, simInfo, apn []byte) []byte {
|
||||
return binary.NewWriterF(func(w *binary.Writer) {
|
||||
w.WriteUInt16(0x124)
|
||||
w.WriteTlv(binary.NewWriterF(func(w *binary.Writer) {
|
||||
w.WriteBytesShort(binary.NewWriterF(func(w *binary.Writer) {
|
||||
w.WriteTlvLimitedSize(osType, 16)
|
||||
w.WriteTlvLimitedSize(osVersion, 16)
|
||||
w.WriteUInt16(2) // Network type wifi
|
||||
|
@ -5,7 +5,7 @@ import "github.com/Mrs4s/MiraiGo/binary"
|
||||
func T128(isGuidFromFileNull, isGuidAvailable, isGuidChanged bool, guidFlag uint32, buildModel, guid, buildBrand []byte) []byte {
|
||||
return binary.NewWriterF(func(w *binary.Writer) {
|
||||
w.WriteUInt16(0x128)
|
||||
w.WriteTlv(binary.NewWriterF(func(w *binary.Writer) {
|
||||
w.WriteBytesShort(binary.NewWriterF(func(w *binary.Writer) {
|
||||
w.WriteUInt16(0)
|
||||
w.WriteBool(isGuidFromFileNull)
|
||||
w.WriteBool(isGuidAvailable)
|
||||
|
@ -5,11 +5,11 @@ import "github.com/Mrs4s/MiraiGo/binary"
|
||||
func T141(simInfo, apn []byte) []byte {
|
||||
return binary.NewWriterF(func(w *binary.Writer) {
|
||||
w.WriteUInt16(0x141)
|
||||
w.WriteTlv(binary.NewWriterF(func(w *binary.Writer) {
|
||||
w.WriteBytesShort(binary.NewWriterF(func(w *binary.Writer) {
|
||||
w.WriteUInt16(1)
|
||||
w.WriteTlv(simInfo)
|
||||
w.WriteBytesShort(simInfo)
|
||||
w.WriteUInt16(2) // network type wifi
|
||||
w.WriteTlv(apn)
|
||||
w.WriteBytesShort(apn)
|
||||
}))
|
||||
})
|
||||
}
|
||||
|
@ -5,7 +5,7 @@ import "github.com/Mrs4s/MiraiGo/binary"
|
||||
func T142(apkId string) []byte {
|
||||
return binary.NewWriterF(func(w *binary.Writer) {
|
||||
w.WriteUInt16(0x142)
|
||||
w.WriteTlv(binary.NewWriterF(func(w *binary.Writer) {
|
||||
w.WriteBytesShort(binary.NewWriterF(func(w *binary.Writer) {
|
||||
w.WriteUInt16(0)
|
||||
w.WriteTlvLimitedSize([]byte(apkId), 32)
|
||||
}))
|
||||
|
@ -5,6 +5,6 @@ import "github.com/Mrs4s/MiraiGo/binary"
|
||||
func T143(arr []byte) []byte {
|
||||
return binary.NewWriterF(func(w *binary.Writer) {
|
||||
w.WriteUInt16(0x143)
|
||||
w.WriteTlv(arr)
|
||||
w.WriteBytesShort(arr)
|
||||
})
|
||||
}
|
||||
|
@ -12,7 +12,7 @@ func T144(
|
||||
) []byte {
|
||||
return binary.NewWriterF(func(w *binary.Writer) {
|
||||
w.WriteUInt16(0x144)
|
||||
w.WriteTlv(binary.NewWriterF(func(w *binary.Writer) {
|
||||
w.WriteBytesShort(binary.NewWriterF(func(w *binary.Writer) {
|
||||
w.EncryptAndWrite(tgtgtKey, binary.NewWriterF(func(w *binary.Writer) {
|
||||
w.WriteUInt16(5)
|
||||
w.Write(T109(imei))
|
||||
|
@ -5,7 +5,7 @@ import "github.com/Mrs4s/MiraiGo/binary"
|
||||
func T145(guid []byte) []byte {
|
||||
return binary.NewWriterF(func(w *binary.Writer) {
|
||||
w.WriteUInt16(0x145)
|
||||
w.WriteTlv(binary.NewWriterF(func(w *binary.Writer) {
|
||||
w.WriteBytesShort(binary.NewWriterF(func(w *binary.Writer) {
|
||||
w.Write(guid)
|
||||
}))
|
||||
})
|
||||
|
@ -5,7 +5,7 @@ import "github.com/Mrs4s/MiraiGo/binary"
|
||||
func T147(appId uint32, apkVersionName, apkSignatureMd5 []byte) []byte {
|
||||
return binary.NewWriterF(func(w *binary.Writer) {
|
||||
w.WriteUInt16(0x147)
|
||||
w.WriteTlv(binary.NewWriterF(func(w *binary.Writer) {
|
||||
w.WriteBytesShort(binary.NewWriterF(func(w *binary.Writer) {
|
||||
w.WriteUInt32(appId)
|
||||
w.WriteTlvLimitedSize(apkVersionName, 32)
|
||||
w.WriteTlvLimitedSize(apkSignatureMd5, 32)
|
||||
|
@ -5,7 +5,7 @@ import "github.com/Mrs4s/MiraiGo/binary"
|
||||
func T154(seq uint16) []byte {
|
||||
return binary.NewWriterF(func(w *binary.Writer) {
|
||||
w.WriteUInt16(0x154)
|
||||
w.WriteTlv(binary.NewWriterF(func(w *binary.Writer) {
|
||||
w.WriteBytesShort(binary.NewWriterF(func(w *binary.Writer) {
|
||||
w.WriteUInt32(uint32(seq))
|
||||
}))
|
||||
})
|
||||
|
@ -5,14 +5,14 @@ import "github.com/Mrs4s/MiraiGo/binary"
|
||||
func T16(ssoVersion, appId, subAppId uint32, guid, apkId, apkVersionName, apkSign []byte) []byte {
|
||||
return binary.NewWriterF(func(w *binary.Writer) {
|
||||
w.WriteUInt16(0x16)
|
||||
w.WriteTlv(binary.NewWriterF(func(w *binary.Writer) {
|
||||
w.WriteBytesShort(binary.NewWriterF(func(w *binary.Writer) {
|
||||
w.WriteUInt32(ssoVersion)
|
||||
w.WriteUInt32(appId)
|
||||
w.WriteUInt32(subAppId)
|
||||
w.Write(guid)
|
||||
w.WriteTlv(apkId)
|
||||
w.WriteTlv(apkVersionName)
|
||||
w.WriteTlv(apkSign)
|
||||
w.WriteBytesShort(apkId)
|
||||
w.WriteBytesShort(apkVersionName)
|
||||
w.WriteBytesShort(apkSign)
|
||||
}))
|
||||
})
|
||||
}
|
||||
|
@ -5,7 +5,7 @@ import "github.com/Mrs4s/MiraiGo/binary"
|
||||
func T166(imageType byte) []byte {
|
||||
return binary.NewWriterF(func(w *binary.Writer) {
|
||||
w.WriteUInt16(0x166)
|
||||
w.WriteTlv(binary.NewWriterF(func(w *binary.Writer) {
|
||||
w.WriteBytesShort(binary.NewWriterF(func(w *binary.Writer) {
|
||||
w.WriteByte(imageType)
|
||||
}))
|
||||
})
|
||||
|
@ -5,6 +5,6 @@ import "github.com/Mrs4s/MiraiGo/binary"
|
||||
func T16A(arr []byte) []byte {
|
||||
return binary.NewWriterF(func(w *binary.Writer) {
|
||||
w.WriteUInt16(0x16A)
|
||||
w.WriteTlv(arr)
|
||||
w.WriteBytesShort(arr)
|
||||
})
|
||||
}
|
||||
|
@ -5,7 +5,7 @@ import "github.com/Mrs4s/MiraiGo/binary"
|
||||
func T16E(buildModel []byte) []byte {
|
||||
return binary.NewWriterF(func(w *binary.Writer) {
|
||||
w.WriteUInt16(0x16e)
|
||||
w.WriteTlv(binary.NewWriterF(func(w *binary.Writer) {
|
||||
w.WriteBytesShort(binary.NewWriterF(func(w *binary.Writer) {
|
||||
w.Write(buildModel)
|
||||
}))
|
||||
})
|
||||
|
@ -5,6 +5,6 @@ import "github.com/Mrs4s/MiraiGo/binary"
|
||||
func T174(data []byte) []byte {
|
||||
return binary.NewWriterF(func(w *binary.Writer) {
|
||||
w.WriteUInt16(0x174)
|
||||
w.WriteTlv(data)
|
||||
w.WriteBytesShort(data)
|
||||
})
|
||||
}
|
||||
|
@ -5,10 +5,10 @@ import "github.com/Mrs4s/MiraiGo/binary"
|
||||
func T177(buildTime uint32, sdkVersion string) []byte {
|
||||
return binary.NewWriterF(func(w *binary.Writer) {
|
||||
w.WriteUInt16(0x177)
|
||||
w.WriteTlv(binary.NewWriterF(func(w *binary.Writer) {
|
||||
w.WriteBytesShort(binary.NewWriterF(func(w *binary.Writer) {
|
||||
w.WriteByte(0x01)
|
||||
w.WriteUInt32(buildTime)
|
||||
w.WriteTlv([]byte(sdkVersion))
|
||||
w.WriteBytesShort([]byte(sdkVersion))
|
||||
}))
|
||||
})
|
||||
}
|
||||
|
@ -5,7 +5,7 @@ import "github.com/Mrs4s/MiraiGo/binary"
|
||||
func T17A(value int32) []byte {
|
||||
return binary.NewWriterF(func(w *binary.Writer) {
|
||||
w.WriteUInt16(0x17a)
|
||||
w.WriteTlv(binary.NewWriterF(func(w *binary.Writer) {
|
||||
w.WriteBytesShort(binary.NewWriterF(func(w *binary.Writer) {
|
||||
w.WriteUInt32(uint32(value))
|
||||
}))
|
||||
})
|
||||
|
@ -5,7 +5,7 @@ import "github.com/Mrs4s/MiraiGo/binary"
|
||||
func T17C(code string) []byte {
|
||||
return binary.NewWriterF(func(w *binary.Writer) {
|
||||
w.WriteUInt16(0x17c)
|
||||
w.WriteTlv(binary.NewWriterF(func(w *binary.Writer) {
|
||||
w.WriteBytesShort(binary.NewWriterF(func(w *binary.Writer) {
|
||||
w.WriteStringShort(code)
|
||||
}))
|
||||
})
|
||||
|
@ -5,7 +5,7 @@ import "github.com/Mrs4s/MiraiGo/binary"
|
||||
func T18(appId uint32, uin uint32) []byte {
|
||||
return binary.NewWriterF(func(w *binary.Writer) {
|
||||
w.WriteUInt16(0x18)
|
||||
w.WriteTlv(binary.NewWriterF(func(w *binary.Writer) {
|
||||
w.WriteBytesShort(binary.NewWriterF(func(w *binary.Writer) {
|
||||
w.WriteUInt16(1)
|
||||
w.WriteUInt32(1536)
|
||||
w.WriteUInt32(appId)
|
||||
|
@ -9,7 +9,7 @@ import (
|
||||
func T187(macAddress []byte) []byte {
|
||||
return binary.NewWriterF(func(w *binary.Writer) {
|
||||
w.WriteUInt16(0x187)
|
||||
w.WriteTlv(binary.NewWriterF(func(w *binary.Writer) {
|
||||
w.WriteBytesShort(binary.NewWriterF(func(w *binary.Writer) {
|
||||
h := md5.Sum(macAddress)
|
||||
w.Write(h[:])
|
||||
}))
|
||||
|
@ -9,7 +9,7 @@ import (
|
||||
func T188(androidId []byte) []byte {
|
||||
return binary.NewWriterF(func(w *binary.Writer) {
|
||||
w.WriteUInt16(0x188)
|
||||
w.WriteTlv(binary.NewWriterF(func(w *binary.Writer) {
|
||||
w.WriteBytesShort(binary.NewWriterF(func(w *binary.Writer) {
|
||||
h := md5.Sum(androidId)
|
||||
w.Write(h[:])
|
||||
}))
|
||||
|
@ -5,7 +5,7 @@ import "github.com/Mrs4s/MiraiGo/binary"
|
||||
func T191(k byte) []byte {
|
||||
return binary.NewWriterF(func(w *binary.Writer) {
|
||||
w.WriteUInt16(0x191)
|
||||
w.WriteTlv(binary.NewWriterF(func(w *binary.Writer) {
|
||||
w.WriteBytesShort(binary.NewWriterF(func(w *binary.Writer) {
|
||||
w.WriteByte(k)
|
||||
}))
|
||||
})
|
||||
|
@ -5,7 +5,7 @@ import "github.com/Mrs4s/MiraiGo/binary"
|
||||
func T193(ticket string) []byte {
|
||||
return binary.NewWriterF(func(w *binary.Writer) {
|
||||
w.WriteUInt16(0x193)
|
||||
w.WriteTlv(binary.NewWriterF(func(w *binary.Writer) {
|
||||
w.WriteBytesShort(binary.NewWriterF(func(w *binary.Writer) {
|
||||
w.Write([]byte(ticket))
|
||||
}))
|
||||
})
|
||||
|
@ -5,7 +5,7 @@ import "github.com/Mrs4s/MiraiGo/binary"
|
||||
func T194(imsiMd5 []byte) []byte {
|
||||
return binary.NewWriterF(func(w *binary.Writer) {
|
||||
w.WriteUInt16(0x194)
|
||||
w.WriteTlv(binary.NewWriterF(func(w *binary.Writer) {
|
||||
w.WriteBytesShort(binary.NewWriterF(func(w *binary.Writer) {
|
||||
w.Write(imsiMd5)
|
||||
}))
|
||||
})
|
||||
|
@ -5,6 +5,6 @@ import "github.com/Mrs4s/MiraiGo/binary"
|
||||
func T197() []byte {
|
||||
return binary.NewWriterF(func(w *binary.Writer) {
|
||||
w.WriteUInt16(0x197)
|
||||
w.WriteTlv([]byte{0})
|
||||
w.WriteBytesShort([]byte{0})
|
||||
})
|
||||
}
|
||||
|
@ -5,6 +5,6 @@ import "github.com/Mrs4s/MiraiGo/binary"
|
||||
func T198() []byte {
|
||||
return binary.NewWriterF(func(w *binary.Writer) {
|
||||
w.WriteUInt16(0x198)
|
||||
w.WriteTlv([]byte{0})
|
||||
w.WriteBytesShort([]byte{0})
|
||||
})
|
||||
}
|
||||
|
@ -5,7 +5,7 @@ import "github.com/Mrs4s/MiraiGo/binary"
|
||||
func T1B(micro, version, size, margin, dpi, ecLevel, hint uint32) []byte {
|
||||
return binary.NewWriterF(func(w *binary.Writer) {
|
||||
w.WriteUInt16(0x1B)
|
||||
w.WriteTlv(binary.NewWriterF(func(w *binary.Writer) {
|
||||
w.WriteBytesShort(binary.NewWriterF(func(w *binary.Writer) {
|
||||
w.WriteUInt32(micro)
|
||||
w.WriteUInt32(version)
|
||||
w.WriteUInt32(size)
|
||||
|
@ -5,7 +5,7 @@ import "github.com/Mrs4s/MiraiGo/binary"
|
||||
func T1D(miscBitmap uint32) []byte {
|
||||
return binary.NewWriterF(func(w *binary.Writer) {
|
||||
w.WriteUInt16(0x1D)
|
||||
w.WriteTlv(binary.NewWriterF(func(w *binary.Writer) {
|
||||
w.WriteBytesShort(binary.NewWriterF(func(w *binary.Writer) {
|
||||
w.WriteByte(1)
|
||||
w.WriteUInt32(miscBitmap)
|
||||
w.WriteUInt32(0)
|
||||
|
@ -5,7 +5,7 @@ import "github.com/Mrs4s/MiraiGo/binary"
|
||||
func T1F(isRoot bool, osName, osVersion, simOperatorName, apn []byte, networkType uint16) []byte {
|
||||
return binary.NewWriterF(func(w *binary.Writer) {
|
||||
w.WriteUInt16(0x1F)
|
||||
w.WriteTlv(binary.NewWriterF(func(w *binary.Writer) {
|
||||
w.WriteBytesShort(binary.NewWriterF(func(w *binary.Writer) {
|
||||
w.WriteByte(func() byte {
|
||||
if isRoot {
|
||||
return 1
|
||||
@ -13,12 +13,12 @@ func T1F(isRoot bool, osName, osVersion, simOperatorName, apn []byte, networkTyp
|
||||
return 0
|
||||
}
|
||||
}())
|
||||
w.WriteTlv(osName)
|
||||
w.WriteTlv(osVersion)
|
||||
w.WriteBytesShort(osName)
|
||||
w.WriteBytesShort(osVersion)
|
||||
w.WriteUInt16(networkType)
|
||||
w.WriteTlv(simOperatorName)
|
||||
w.WriteTlv([]byte{})
|
||||
w.WriteTlv(apn)
|
||||
w.WriteBytesShort(simOperatorName)
|
||||
w.WriteBytesShort([]byte{})
|
||||
w.WriteBytesShort(apn)
|
||||
}))
|
||||
})
|
||||
}
|
||||
|
@ -5,10 +5,10 @@ import "github.com/Mrs4s/MiraiGo/binary"
|
||||
func T2(result string, sign []byte) []byte {
|
||||
return binary.NewWriterF(func(w *binary.Writer) {
|
||||
w.WriteUInt16(0x02)
|
||||
w.WriteTlv(binary.NewWriterF(func(w *binary.Writer) {
|
||||
w.WriteBytesShort(binary.NewWriterF(func(w *binary.Writer) {
|
||||
w.WriteUInt16(0)
|
||||
w.WriteStringShort(result)
|
||||
w.WriteTlv(sign)
|
||||
w.WriteBytesShort(sign)
|
||||
}))
|
||||
})
|
||||
}
|
||||
|
@ -5,7 +5,7 @@ import "github.com/Mrs4s/MiraiGo/binary"
|
||||
func T202(wifiBSSID, wifiSSID []byte) []byte {
|
||||
return binary.NewWriterF(func(w *binary.Writer) {
|
||||
w.WriteUInt16(0x202)
|
||||
w.WriteTlv(binary.NewWriterF(func(w *binary.Writer) {
|
||||
w.WriteBytesShort(binary.NewWriterF(func(w *binary.Writer) {
|
||||
w.WriteTlvLimitedSize(wifiBSSID, 16)
|
||||
w.WriteTlvLimitedSize(wifiSSID, 32)
|
||||
}))
|
||||
|
@ -5,6 +5,6 @@ import "github.com/Mrs4s/MiraiGo/binary"
|
||||
func T33(guid []byte) []byte {
|
||||
return binary.NewWriterF(func(w *binary.Writer) {
|
||||
w.WriteUInt16(0x33)
|
||||
w.WriteTlv(guid)
|
||||
w.WriteBytesShort(guid)
|
||||
})
|
||||
}
|
||||
|
@ -5,7 +5,7 @@ import "github.com/Mrs4s/MiraiGo/binary"
|
||||
func T35(productType uint32) []byte {
|
||||
return binary.NewWriterF(func(w *binary.Writer) {
|
||||
w.WriteUInt16(0x35)
|
||||
w.WriteTlv(binary.NewWriterF(func(w *binary.Writer) {
|
||||
w.WriteBytesShort(binary.NewWriterF(func(w *binary.Writer) {
|
||||
w.WriteUInt32(productType)
|
||||
}))
|
||||
})
|
||||
|
@ -9,7 +9,7 @@ import (
|
||||
func T400(g []byte, uin int64, guid, dpwd []byte, j2, j3 int64, randSeed []byte) []byte {
|
||||
return binary.NewWriterF(func(w *binary.Writer) {
|
||||
w.WriteUInt16(0x400)
|
||||
w.WriteTlv(binary.NewWriterF(func(w *binary.Writer) {
|
||||
w.WriteBytesShort(binary.NewWriterF(func(w *binary.Writer) {
|
||||
w.EncryptAndWrite(g, binary.NewWriterF(func(w *binary.Writer) {
|
||||
w.WriteUInt16(1) // version
|
||||
w.WriteUInt64(uint64(uin))
|
||||
|
@ -5,6 +5,6 @@ import "github.com/Mrs4s/MiraiGo/binary"
|
||||
func T401(d []byte) []byte {
|
||||
return binary.NewWriterF(func(w *binary.Writer) {
|
||||
w.WriteUInt16(0x401)
|
||||
w.WriteTlv(d)
|
||||
w.WriteBytesShort(d)
|
||||
})
|
||||
}
|
||||
|
@ -16,14 +16,14 @@ func T511(domains []string) []byte {
|
||||
}
|
||||
return binary.NewWriterF(func(w *binary.Writer) {
|
||||
w.WriteUInt16(0x511)
|
||||
w.WriteTlv(binary.NewWriterF(func(w *binary.Writer) {
|
||||
w.WriteBytesShort(binary.NewWriterF(func(w *binary.Writer) {
|
||||
w.WriteUInt16(uint16(len(arr2)))
|
||||
for _, d := range arr2 {
|
||||
indexOf := strings.Index(d, "(")
|
||||
indexOf2 := strings.Index(d, ")")
|
||||
if indexOf != 0 || indexOf2 <= 0 {
|
||||
w.WriteByte(0x01)
|
||||
w.WriteTlv([]byte(d))
|
||||
w.WriteBytesShort([]byte(d))
|
||||
} else {
|
||||
var b byte
|
||||
var z bool
|
||||
@ -44,7 +44,7 @@ func T511(domains []string) []byte {
|
||||
b |= 2
|
||||
}
|
||||
w.WriteByte(b)
|
||||
w.WriteTlv([]byte(d[indexOf2+1:]))
|
||||
w.WriteBytesShort([]byte(d[indexOf2+1:]))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -5,7 +5,7 @@ import "github.com/Mrs4s/MiraiGo/binary"
|
||||
func T516() []byte {
|
||||
return binary.NewWriterF(func(w *binary.Writer) {
|
||||
w.WriteUInt16(0x516)
|
||||
w.WriteTlv(binary.NewWriterF(func(w *binary.Writer) {
|
||||
w.WriteBytesShort(binary.NewWriterF(func(w *binary.Writer) {
|
||||
w.WriteUInt32(0)
|
||||
}))
|
||||
})
|
||||
|
@ -2,11 +2,11 @@ package tlv
|
||||
|
||||
import "github.com/Mrs4s/MiraiGo/binary"
|
||||
|
||||
func T521() []byte {
|
||||
func T521(i uint32) []byte {
|
||||
return binary.NewWriterF(func(w *binary.Writer) {
|
||||
w.WriteUInt16(0x521)
|
||||
w.WriteTlv(binary.NewWriterF(func(w *binary.Writer) {
|
||||
w.WriteUInt32(0)
|
||||
w.WriteBytesShort(binary.NewWriterF(func(w *binary.Writer) {
|
||||
w.WriteUInt32(i)
|
||||
w.WriteUInt16(0)
|
||||
}))
|
||||
})
|
||||
|
@ -5,7 +5,7 @@ import "github.com/Mrs4s/MiraiGo/binary"
|
||||
func T525(t536 []byte) []byte {
|
||||
return binary.NewWriterF(func(w *binary.Writer) {
|
||||
w.WriteUInt16(0x525)
|
||||
w.WriteTlv(binary.NewWriterF(func(w *binary.Writer) {
|
||||
w.WriteBytesShort(binary.NewWriterF(func(w *binary.Writer) {
|
||||
w.WriteUInt16(1)
|
||||
w.Write(t536)
|
||||
}))
|
||||
|
@ -5,7 +5,7 @@ import "github.com/Mrs4s/MiraiGo/binary"
|
||||
func T52D(devInfo []byte) []byte {
|
||||
return binary.NewWriterF(func(w *binary.Writer) {
|
||||
w.WriteUInt16(0x52d)
|
||||
w.WriteTlv(binary.NewWriterF(func(w *binary.Writer) {
|
||||
w.WriteBytesShort(binary.NewWriterF(func(w *binary.Writer) {
|
||||
w.Write(devInfo)
|
||||
}))
|
||||
})
|
||||
|
@ -5,7 +5,7 @@ import "github.com/Mrs4s/MiraiGo/binary"
|
||||
func T536(loginExtraData []byte) []byte {
|
||||
return binary.NewWriterF(func(w *binary.Writer) {
|
||||
w.WriteUInt16(0x536)
|
||||
w.WriteTlv(binary.NewWriterF(func(w *binary.Writer) {
|
||||
w.WriteBytesShort(binary.NewWriterF(func(w *binary.Writer) {
|
||||
w.Write(loginExtraData)
|
||||
}))
|
||||
})
|
||||
|
@ -5,7 +5,7 @@ import "github.com/Mrs4s/MiraiGo/binary"
|
||||
func T8(localId uint32) []byte {
|
||||
return binary.NewWriterF(func(w *binary.Writer) {
|
||||
w.WriteUInt16(0x8)
|
||||
w.WriteTlv(binary.NewWriterF(func(w *binary.Writer) {
|
||||
w.WriteBytesShort(binary.NewWriterF(func(w *binary.Writer) {
|
||||
w.WriteUInt16(0)
|
||||
w.WriteUInt32(localId)
|
||||
w.WriteUInt16(0)
|
||||
|
Loading…
x
Reference in New Issue
Block a user