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

client: don't use math/rand.Read

This function has been deprecated.
This commit is contained in:
wdvxdr 2023-02-10 21:03:21 +08:00
parent f56bcbe326
commit e9f4d33002
9 changed files with 123 additions and 125 deletions

View File

@ -33,26 +33,26 @@ func (c *QQClient) buildLoginPacket() (uint16, []byte) {
Command: 9,
List: [][]byte{
tlv.T18(16, uint32(c.Uin)),
tlv.T1(uint32(c.Uin), c.deviceInfo.IpAddress),
tlv.T106(uint32(c.Uin), 0, c.version.AppId, c.version.SSOVersion, c.PasswordMd5, true, c.deviceInfo.Guid, c.deviceInfo.TgtgtKey, 0),
tlv.T1(uint32(c.Uin), c.device.IpAddress),
tlv.T106(uint32(c.Uin), 0, c.version.AppId, c.version.SSOVersion, c.PasswordMd5, true, c.device.Guid, c.device.TgtgtKey, 0),
tlv.T116(c.version.MiscBitmap, c.version.SubSigmap),
tlv.T100(c.version.SSOVersion, c.version.SubAppId, c.version.MainSigMap),
tlv.T107(0),
tlv.T142(c.version.ApkId),
tlv.T144(
[]byte(c.deviceInfo.IMEI),
c.deviceInfo.GenDeviceInfoData(),
c.deviceInfo.OSType,
c.deviceInfo.Version.Release,
c.deviceInfo.SimInfo,
c.deviceInfo.APN,
[]byte(c.device.IMEI),
c.device.GenDeviceInfoData(),
c.device.OSType,
c.device.Version.Release,
c.device.SimInfo,
c.device.APN,
false, true, false, tlv.GuidFlag(),
c.deviceInfo.Model,
c.deviceInfo.Guid,
c.deviceInfo.Brand,
c.deviceInfo.TgtgtKey,
c.device.Model,
c.device.Guid,
c.device.Brand,
c.device.TgtgtKey,
),
tlv.T145(c.deviceInfo.Guid),
tlv.T145(c.device.Guid),
tlv.T147(16, []byte(c.version.SortVersionName), c.version.ApkSign),
/*
if (miscBitMap & 0x80) != 0{
@ -60,25 +60,25 @@ func (c *QQClient) buildLoginPacket() (uint16, []byte) {
}
*/
tlv.T154(seq),
tlv.T141(c.deviceInfo.SimInfo, c.deviceInfo.APN),
tlv.T141(c.device.SimInfo, c.device.APN),
tlv.T8(2052),
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",
}),
tlv.T187(c.deviceInfo.MacAddress),
tlv.T188(c.deviceInfo.AndroidId),
tlv.T187(c.device.MacAddress),
tlv.T188(c.device.AndroidId),
},
}
if len(c.deviceInfo.IMSIMd5) != 0 {
t.Append(tlv.T194(c.deviceInfo.IMSIMd5))
if len(c.device.IMSIMd5) != 0 {
t.Append(tlv.T194(c.device.IMSIMd5))
}
if c.AllowSlider {
t.Append(tlv.T191(0x82))
}
if len(c.deviceInfo.WifiBSSID) != 0 && len(c.deviceInfo.WifiSSID) != 0 {
t.Append(tlv.T202(c.deviceInfo.WifiBSSID, c.deviceInfo.WifiSSID))
if len(c.device.WifiBSSID) != 0 && len(c.device.WifiSSID) != 0 {
t.Append(tlv.T202(c.device.WifiBSSID, c.device.WifiSSID))
}
t.Append(
tlv.T177(c.version.BuildTime, c.version.SdkVersion),
@ -139,11 +139,11 @@ func (c *QQClient) buildQRCodeFetchRequestPacket(size, margin, ecLevel uint32) (
w.WriteBytesShort(EmptyBytes)
w.WriteUInt16(6)
w.Write(tlv.T16(watch.SSOVersion, 16, watch.AppId, c.deviceInfo.Guid, []byte(watch.ApkId), []byte(watch.SortVersionName), watch.ApkSign))
w.Write(tlv.T16(watch.SSOVersion, 16, watch.AppId, c.device.Guid, []byte(watch.ApkId), []byte(watch.SortVersionName), watch.ApkSign))
w.Write(tlv.T1B(0, 0, size, margin, 72, ecLevel, 2))
w.Write(tlv.T1D(watch.MiscBitmap))
w.Write(tlv.T1F(false, c.deviceInfo.OSType, []byte("7.1.2"), []byte("China Mobile GSM"), c.deviceInfo.APN, 2))
w.Write(tlv.T33(c.deviceInfo.Guid))
w.Write(tlv.T1F(false, c.device.OSType, []byte("7.1.2"), []byte("China Mobile GSM"), c.device.APN, 2))
w.Write(tlv.T33(c.device.Guid))
w.Write(tlv.T35(8))
}))
}),
@ -203,42 +203,42 @@ func (c *QQClient) buildQRCodeLoginPacket(t106, t16a, t318 []byte) (uint16, []by
Command: 9,
List: [][]byte{
tlv.T18(16, uint32(c.Uin)),
tlv.T1(uint32(c.Uin), c.deviceInfo.IpAddress),
tlv.T1(uint32(c.Uin), c.device.IpAddress),
tlv.T(0x106, t106),
// tlv.T106(uint32(c.Uin), 0, c.version.AppId, c.version.SSOVersion, c.PasswordMd5, true, c.deviceInfo.Guid, c.deviceInfo.TgtgtKey, 0),
// tlv.T106(uint32(c.Uin), 0, c.version.AppId, c.version.SSOVersion, c.PasswordMd5, true, c.device.Guid, c.device.TgtgtKey, 0),
tlv.T116(c.version.MiscBitmap, c.version.SubSigmap),
tlv.T100(c.version.SSOVersion, c.version.SubAppId, c.version.MainSigMap),
tlv.T107(0),
tlv.T142(c.version.ApkId),
tlv.T144(
[]byte(c.deviceInfo.IMEI),
c.deviceInfo.GenDeviceInfoData(),
c.deviceInfo.OSType,
c.deviceInfo.Version.Release,
c.deviceInfo.SimInfo,
c.deviceInfo.APN,
[]byte(c.device.IMEI),
c.device.GenDeviceInfoData(),
c.device.OSType,
c.device.Version.Release,
c.device.SimInfo,
c.device.APN,
false, true, false, tlv.GuidFlag(),
c.deviceInfo.Model,
c.deviceInfo.Guid,
c.deviceInfo.Brand,
c.deviceInfo.TgtgtKey,
c.device.Model,
c.device.Guid,
c.device.Brand,
c.device.TgtgtKey,
),
tlv.T145(c.deviceInfo.Guid),
tlv.T145(c.device.Guid),
tlv.T147(16, []byte(c.version.SortVersionName), c.version.ApkSign),
tlv.T(0x16a, t16a),
tlv.T154(seq),
tlv.T141(c.deviceInfo.SimInfo, c.deviceInfo.APN),
tlv.T141(c.device.SimInfo, c.device.APN),
tlv.T8(2052),
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",
}),
tlv.T187(c.deviceInfo.MacAddress),
tlv.T188(c.deviceInfo.AndroidId),
tlv.T194(c.deviceInfo.IMSIMd5),
tlv.T187(c.device.MacAddress),
tlv.T188(c.device.AndroidId),
tlv.T194(c.device.IMSIMd5),
tlv.T191(0x00),
tlv.T202(c.deviceInfo.WifiBSSID, c.deviceInfo.WifiSSID),
tlv.T202(c.device.WifiBSSID, c.device.WifiSSID),
tlv.T177(c.version.BuildTime, c.version.SdkVersion),
tlv.T516(),
tlv.T521(8),
@ -365,30 +365,30 @@ func (c *QQClient) buildRequestTgtgtNopicsigPacket() (uint16, []byte) {
Command: 15,
List: [][]byte{
tlv.T18(16, uint32(c.Uin)),
tlv.T1(uint32(c.Uin), c.deviceInfo.IpAddress),
tlv.T1(uint32(c.Uin), c.device.IpAddress),
tlv.T(0x106, c.sig.EncryptedA1),
tlv.T116(c.version.MiscBitmap, c.version.SubSigmap),
tlv.T100(c.version.SSOVersion, 2, c.version.MainSigMap),
tlv.T107(0),
tlv.T108(c.sig.Ksid),
tlv.T144(
c.deviceInfo.AndroidId,
c.deviceInfo.GenDeviceInfoData(),
c.deviceInfo.OSType,
c.deviceInfo.Version.Release,
c.deviceInfo.SimInfo,
c.deviceInfo.APN,
c.device.AndroidId,
c.device.GenDeviceInfoData(),
c.device.OSType,
c.device.Version.Release,
c.device.SimInfo,
c.device.APN,
false, true, false, tlv.GuidFlag(),
c.deviceInfo.Model,
c.deviceInfo.Guid,
c.deviceInfo.Brand,
c.deviceInfo.TgtgtKey,
c.device.Model,
c.device.Guid,
c.device.Brand,
c.device.TgtgtKey,
),
tlv.T142(c.version.ApkId),
tlv.T145(c.deviceInfo.Guid),
tlv.T145(c.device.Guid),
tlv.T16A(c.sig.SrmToken),
tlv.T154(seq),
tlv.T141(c.deviceInfo.SimInfo, c.deviceInfo.APN),
tlv.T141(c.device.SimInfo, c.device.APN),
tlv.T8(2052),
tlv.T511([]string{
"tenpay.com", "openmobile.qq.com", "docs.qq.com", "connect.qq.com",
@ -397,15 +397,15 @@ func (c *QQClient) buildRequestTgtgtNopicsigPacket() (uint16, []byte) {
}),
tlv.T147(16, []byte(c.version.SortVersionName), c.version.ApkSign),
tlv.T177(c.version.BuildTime, c.version.SdkVersion),
tlv.T400(c.sig.G, c.Uin, c.deviceInfo.Guid, c.sig.Dpwd, 1, 16, c.sig.RandSeed),
tlv.T187(c.deviceInfo.MacAddress),
tlv.T188(c.deviceInfo.AndroidId),
tlv.T194(c.deviceInfo.IMSIMd5),
tlv.T202(c.deviceInfo.WifiBSSID, c.deviceInfo.WifiSSID),
tlv.T400(c.sig.G, c.Uin, c.device.Guid, c.sig.Dpwd, 1, 16, c.sig.RandSeed),
tlv.T187(c.device.MacAddress),
tlv.T188(c.device.AndroidId),
tlv.T194(c.device.IMSIMd5),
tlv.T202(c.device.WifiBSSID, c.device.WifiSSID),
tlv.T516(),
tlv.T521(0),
tlv.T525(tlv.T536([]byte{0x01, 0x00})),
tlv.T545([]byte(c.deviceInfo.IMEI)),
tlv.T545([]byte(c.device.IMEI)),
},
}
m := oicq.Message{
@ -448,16 +448,16 @@ func (c *QQClient) buildRequestChangeSigPacket(changeD2 bool) (uint16, []byte) {
}
t.Append(
tlv.T144(
c.deviceInfo.AndroidId,
c.deviceInfo.GenDeviceInfoData(),
c.deviceInfo.OSType,
c.deviceInfo.Version.Release,
c.deviceInfo.SimInfo,
c.deviceInfo.APN,
c.device.AndroidId,
c.device.GenDeviceInfoData(),
c.device.OSType,
c.device.Version.Release,
c.device.SimInfo,
c.device.APN,
false, true, false, tlv.GuidFlag(),
c.deviceInfo.Model,
c.deviceInfo.Guid,
c.deviceInfo.Brand,
c.device.Model,
c.device.Guid,
c.device.Brand,
key,
),
tlv.T112(c.Uin),
@ -465,25 +465,25 @@ func (c *QQClient) buildRequestChangeSigPacket(changeD2 bool) (uint16, []byte) {
if changeD2 {
t.Append(tlv.T143(c.sig.D2))
} else {
t.Append(tlv.T145(c.deviceInfo.Guid))
t.Append(tlv.T145(c.device.Guid))
}
t.Append(
tlv.T142(c.version.ApkId),
tlv.T154(seq),
tlv.T18(16, uint32(c.Uin)),
tlv.T141(c.deviceInfo.SimInfo, c.deviceInfo.APN),
tlv.T141(c.device.SimInfo, c.device.APN),
tlv.T8(2052),
tlv.T147(16, []byte(c.version.SortVersionName), c.version.ApkSign),
tlv.T177(c.version.BuildTime, c.version.SdkVersion),
tlv.T187(c.deviceInfo.MacAddress),
tlv.T188(c.deviceInfo.AndroidId),
tlv.T194(c.deviceInfo.IMSIMd5),
tlv.T187(c.device.MacAddress),
tlv.T188(c.device.AndroidId),
tlv.T194(c.device.IMSIMd5),
tlv.T511([]string{
"tenpay.com", "openmobile.qq.com", "docs.qq.com", "connect.qq.com",
"qzone.qq.com", "vip.qq.com", "qun.qq.com", "game.qq.com", "qqweb.qq.com",
"office.qq.com", "ti.qq.com", "mail.qq.com", "qzone.com", "mma.qq.com",
}),
tlv.T202(c.deviceInfo.WifiBSSID, c.deviceInfo.WifiSSID),
tlv.T202(c.device.WifiBSSID, c.device.WifiSSID),
)
req := c.buildOicqRequestPacket(c.Uin, 0x0810, t)
req2 := network.Request{
@ -507,23 +507,23 @@ func (c *QQClient) buildClientRegisterPacket() (uint16, []byte) {
Status: 11,
KickPC: 0,
KickWeak: 0,
IOSVersion: int64(c.deviceInfo.Version.SDK),
IOSVersion: int64(c.device.Version.SDK),
NetType: 1,
RegType: 0,
Guid: c.deviceInfo.Guid,
Guid: c.device.Guid,
IsSetStatus: 0,
LocaleId: 2052,
DevName: string(c.deviceInfo.Model),
DevType: string(c.deviceInfo.Model),
OSVer: string(c.deviceInfo.Version.Release),
DevName: string(c.device.Model),
DevType: string(c.device.Model),
OSVer: string(c.device.Version.Release),
OpenPush: 1,
LargeSeq: 1551,
OldSSOIp: 0,
NewSSOIp: 31806887127679168,
ChannelNo: "",
CPID: 0,
VendorName: string(c.deviceInfo.VendorName),
VendorOSName: string(c.deviceInfo.VendorOSName),
VendorName: string(c.device.VendorName),
VendorOSName: string(c.device.VendorOSName),
B769: []byte{0x0A, 0x04, 0x08, 0x2E, 0x10, 0x00, 0x0A, 0x05, 0x08, 0x9B, 0x02, 0x10, 0x00},
SetMute: 0,
}
@ -561,15 +561,15 @@ func (c *QQClient) buildStatusSetPacket(status, extStatus int32) (uint16, []byte
KickPC: 0,
KickWeak: 0,
Timestamp: time.Now().Unix(),
IOSVersion: int64(c.deviceInfo.Version.SDK),
IOSVersion: int64(c.device.Version.SDK),
NetType: 1,
RegType: 0,
Guid: c.deviceInfo.Guid,
Guid: c.device.Guid,
IsSetStatus: 1,
LocaleId: 2052,
DevName: string(c.deviceInfo.Model),
DevType: string(c.deviceInfo.Model),
OSVer: string(c.deviceInfo.Version.Release),
DevName: string(c.device.Model),
DevType: string(c.device.Model),
OSVer: string(c.device.Version.Release),
OpenPush: 1,
LargeSeq: 1551,
ExtOnlineStatus: int64(extStatus),

View File

@ -67,7 +67,7 @@ type QQClient struct {
currServerIndex int
retryTimes int
version *auth.AppVersion
deviceInfo *auth.Device
device *auth.Device
alive bool
// session info
@ -200,13 +200,13 @@ func NewClientMd5(uin int64, passwordMd5 [16]byte) *QQClient {
highwaySession: new(highway.Session),
version: new(auth.AppVersion),
deviceInfo: new(auth.Device),
device: new(auth.Device),
}
cli.transport = &network.Transport{
Sig: cli.sig,
Version: cli.version,
Device: cli.deviceInfo,
Device: cli.device,
}
cli.oicq = oicq.NewCodec(cli.Uin)
{ // init atomic values
@ -273,7 +273,7 @@ func NewClientMd5(uin int64, passwordMd5 [16]byte) *QQClient {
func (c *QQClient) UseDevice(info *auth.Device) {
*c.version = *info.Protocol.Version()
*c.deviceInfo = *info
*c.device = *info
c.highwaySession.AppID = int32(c.version.AppId)
c.sig.Ksid = []byte(fmt.Sprintf("|%s|A8.2.7.27f6ea96", info.IMEI))
}
@ -326,7 +326,7 @@ func (c *QQClient) TokenLogin(token []byte) error {
c.oicq.WtSessionTicketKey = r.ReadBytesShort()
c.sig.OutPacketSessionID = r.ReadBytesShort()
// SystemDeviceInfo.TgtgtKey = r.ReadBytesShort()
c.deviceInfo.TgtgtKey = r.ReadBytesShort()
c.device.TgtgtKey = r.ReadBytesShort()
}
_, err = c.sendAndWait(c.buildRequestChangeSigPacket(true))
if err != nil {
@ -477,7 +477,7 @@ func (c *QQClient) GenToken() []byte {
w.WriteBytesShort(c.sig.EncryptedA1)
w.WriteBytesShort(c.oicq.WtSessionTicketKey)
w.WriteBytesShort(c.sig.OutPacketSessionID)
w.WriteBytesShort(c.deviceInfo.TgtgtKey)
w.WriteBytesShort(c.device.TgtgtKey)
})
}

View File

@ -45,7 +45,7 @@ func decodeLoginResponse(c *QQClient, _ *network.IncomingPacketInfo, payload []b
if m.Exists(0x402) {
c.sig.Dpwd = []byte(utils.RandomString(16))
c.sig.T402 = m[0x402]
h := md5.Sum(append(append(c.deviceInfo.Guid, c.sig.Dpwd...), c.sig.T402...))
h := md5.Sum(append(append(c.device.Guid, c.sig.Dpwd...), c.sig.T402...))
c.sig.G = h[:]
}
if m.Exists(0x546) {
@ -61,7 +61,7 @@ func decodeLoginResponse(c *QQClient, _ *network.IncomingPacketInfo, payload []b
if m.Exists(0x403) {
c.sig.RandSeed = m[0x403]
}
c.decodeT119(m[0x119], c.deviceInfo.TgtgtKey)
c.decodeT119(m[0x119], c.device.TgtgtKey)
return LoginResponse{
Success: true,
}, nil
@ -306,7 +306,7 @@ func decodeTransEmpResponse(c *QQClient, _ *network.IncomingPacketInfo, payload
if !m.Exists(0x18) || !m.Exists(0x1e) || !m.Exists(0x19) {
return nil, errors.New("wtlogin.trans_emp sub cmd 0x12 error: tlv error")
}
c.deviceInfo.TgtgtKey = m[0x1e]
c.device.TgtgtKey = m[0x1e]
return &QRCodeLoginResponse{State: QRCodeConfirmed, LoginInfo: &QRCodeLoginInfo{
tmpPwd: m[0x18],
tmpNoPicSig: m[0x19],

View File

@ -31,7 +31,7 @@ func (c *QQClient) buildFaceroamRequestPacket() (uint16, []byte) {
payload, _ := proto.Marshal(&faceroam.FaceroamReqBody{
Comm: &faceroam.PlatInfo{
Implat: proto.Int64(109),
Osver: proto.String(string(c.deviceInfo.Version.Release)),
Osver: proto.String(string(c.device.Version.Release)),
Mqqver: proto.Some(c.version.SortVersionName),
},
Uin: proto.Uint64(uint64(c.Uin)),

View File

@ -2,6 +2,7 @@ package client
import (
"crypto/md5"
crand "crypto/rand"
"encoding/hex"
"fmt"
"math/rand"
@ -65,9 +66,8 @@ var SystemDeviceInfo = &DeviceInfo{
var EmptyBytes = make([]byte, 0)
func init() {
rand.Seed(time.Now().UnixNano())
r := make([]byte, 16)
rand.Read(r)
crand.Read(r)
t := md5.Sum(r)
SystemDeviceInfo.IMSIMd5 = t[:]
SystemDeviceInfo.GenNewGuid()
@ -76,18 +76,18 @@ func init() {
func GenRandomDevice() {
r := make([]byte, 16)
rand.Read(r)
crand.Read(r)
const numberRange = "0123456789"
SystemDeviceInfo.Display = []byte("MIRAI." + utils.RandomStringRange(6, numberRange) + ".001")
SystemDeviceInfo.FingerPrint = []byte("mamoe/mirai/mirai:10/MIRAI.200122.001/" + utils.RandomStringRange(7, numberRange) + ":user/release-keys")
SystemDeviceInfo.BootId = binary.GenUUID(r)
SystemDeviceInfo.ProcVersion = []byte("Linux version 3.0.31-" + utils.RandomString(8) + " (android-build@xxx.xxx.xxx.xxx.com)")
rand.Read(r)
crand.Read(r)
t := md5.Sum(r)
SystemDeviceInfo.IMSIMd5 = t[:]
SystemDeviceInfo.IMEI = GenIMEI()
r = make([]byte, 8)
rand.Read(r)
crand.Read(r)
hex.Encode(SystemDeviceInfo.AndroidId, r)
SystemDeviceInfo.GenNewGuid()
SystemDeviceInfo.GenNewTgtgtKey()
@ -97,9 +97,7 @@ func GenIMEI() string {
sum := 0 // the control sum of digits
var final strings.Builder
randSrc := rand.NewSource(time.Now().UnixNano())
randGen := rand.New(randSrc)
randGen := rand.New(rand.NewSource(time.Now().UnixNano()))
for i := 0; i < 14; i++ { // generating all the base digits
toAdd := randGen.Intn(10)
if (i+1)%2 == 0 { // special proc for every 2nd one
@ -109,10 +107,10 @@ func GenIMEI() string {
}
}
sum += toAdd
final.WriteString(fmt.Sprintf("%d", toAdd)) // and even printing them here!
fmt.Fprintf(&final, "%d", toAdd) // and even printing them here!
}
ctrlDigit := (sum * 9) % 10 // calculating the control digit
final.WriteString(fmt.Sprintf("%d", ctrlDigit))
fmt.Fprintf(&final, "%d", ctrlDigit)
return final.String()
}
@ -179,17 +177,17 @@ func qualityTest(addr string) (int64, error) {
func (c *QQClient) parsePrivateMessage(msg *msg.Message) *message.PrivateMessage {
friend := c.FindFriend(msg.Head.FromUin.Unwrap())
var sender *message.Sender
if friend == nil {
sender = &message.Sender{
Uin: msg.Head.FromUin.Unwrap(),
Nickname: msg.Head.FromNick.Unwrap(),
}
} else {
if friend != nil {
sender = &message.Sender{
Uin: friend.Uin,
Nickname: friend.Nickname,
IsFriend: true,
}
} else {
sender = &message.Sender{
Uin: msg.Head.FromUin.Unwrap(),
Nickname: msg.Head.FromNick.Unwrap(),
}
}
ret := &message.PrivateMessage{
Id: msg.Head.MsgSeq.Unwrap(),
@ -326,9 +324,9 @@ func genLongTemplate(resID, brief string, ts int64) *message.ServiceElement {
func (c *QQClient) getWebDeviceInfo() (i string) {
qimei := strings.ToLower(utils.RandomString(36))
i += fmt.Sprintf("i=%v&imsi=&mac=%v&m=%v&o=%v&", c.deviceInfo.IMEI, utils.B2S(c.deviceInfo.MacAddress), utils.B2S(c.deviceInfo.Device), utils.B2S(c.deviceInfo.Version.Release))
i += fmt.Sprintf("a=%v&sd=0&c64=0&sc=1&p=1080*2210&aid=%v&", c.deviceInfo.Version.SDK, c.deviceInfo.IMEI)
i += fmt.Sprintf("f=%v&mm=%v&cf=%v&cc=%v&", c.deviceInfo.Brand, 5629 /* Total Memory*/, 1725 /* CPU Frequency */, 8 /* CPU Core Count */)
i += fmt.Sprintf("i=%v&imsi=&mac=%v&m=%v&o=%v&", c.device.IMEI, utils.B2S(c.device.MacAddress), utils.B2S(c.device.Device), utils.B2S(c.device.Version.Release))
i += fmt.Sprintf("a=%v&sd=0&c64=0&sc=1&p=1080*2210&aid=%v&", c.device.Version.SDK, c.device.IMEI)
i += fmt.Sprintf("f=%v&mm=%v&cf=%v&cc=%v&", c.device.Brand, 5629 /* Total Memory*/, 1725 /* CPU Frequency */, 8 /* CPU Core Count */)
i += fmt.Sprintf("qimei=%v&qimei36=%v&", qimei, qimei)
i += "sharpP=1&n=wifi&support_xsj_live=true&client_mod=default&timezone=Asia/Shanghai&material_sdk_version=2.9.0&vh265=null&refreshrate=60"
return

View File

@ -59,7 +59,7 @@ func (c *QQClient) GetModelShow(modelName string) ([]*ModelVariant, error) {
Uin: c.Uin,
Model: strings.ReplaceAll(url.QueryEscape(modelName), "+", "%20"),
AppType: 0,
IMei: c.deviceInfo.IMEI,
IMei: c.device.IMEI,
ShowInfo: true,
ModelShow: "",
RecoverDefault: false,
@ -96,7 +96,7 @@ func (c *QQClient) SetModelShow(modelName string, modelShow string) error {
Uin: c.Uin,
Model: strings.ReplaceAll(url.QueryEscape(modelName), "+", "%20"),
AppType: 0,
IMei: c.deviceInfo.IMEI,
IMei: c.device.IMEI,
ShowInfo: true,
ModelShow: strings.ReplaceAll(url.QueryEscape(modelShow), "+", "%20"),
RecoverDefault: modelShow == "",

View File

@ -78,9 +78,9 @@ func (c *QQClient) buildLoginExtraPacket() (uint16, []byte) {
TerminalType: proto.Uint32(2),
Status: proto.Uint32(10),
LoginTime: proto.Uint32(5),
HardwareInfo: proto.String(string(c.deviceInfo.Model)),
SoftwareInfo: proto.String(string(c.deviceInfo.Version.Release)),
Guid: c.deviceInfo.Guid,
HardwareInfo: proto.String(string(c.device.Model)),
SoftwareInfo: proto.String(string(c.device.Version.Release)),
Guid: c.device.Guid,
AppName: proto.Some(c.version.ApkId),
SubAppId: proto.Some(c.version.AppId),
},

View File

@ -121,7 +121,7 @@ func (c *QQClient) MarkPrivateMessageReaded(uin, time int64) {
// StatSvc.GetDevLoginInfo
func (c *QQClient) buildDeviceListRequestPacket() (uint16, []byte) {
req := &jce.SvcReqGetDevLoginInfo{
Guid: c.deviceInfo.Guid,
Guid: c.device.Guid,
LoginType: 1,
AppName: "com.tencent.mobileqq",
RequireMax: 20,

View File

@ -121,7 +121,7 @@ func (c *QQClient) decodeT119(data, ek []byte) {
if len(decrypted) > 51+16 {
dr := binary.NewReader(decrypted)
dr.ReadBytes(51)
c.deviceInfo.TgtgtKey = dr.ReadBytes(16)
c.device.TgtgtKey = dr.ReadBytes(16)
}
}
c.Nickname = nick
@ -131,7 +131,7 @@ func (c *QQClient) decodeT119(data, ek []byte) {
// wtlogin.exchange_emp
func (c *QQClient) decodeT119R(data []byte) {
tea := binary.NewTeaCipher(c.deviceInfo.TgtgtKey)
tea := binary.NewTeaCipher(c.device.TgtgtKey)
m, _ := tlv.NewDecoder(2, 2).DecodeRecordMap(tea.Decrypt(data)[2:])
if t120, ok := m[0x120]; ok {
c.sig.SKey = t120