mirror of
https://github.com/Mrs4s/MiraiGo.git
synced 2025-05-04 19:17:38 +08:00
fix(client): device file struct naming imparity
This commit is contained in:
parent
9f1cf68e0e
commit
551b532206
@ -3,24 +3,23 @@ package client
|
||||
import (
|
||||
"encoding/hex"
|
||||
"fmt"
|
||||
"github.com/Mrs4s/MiraiGo/client/pb/profilecard"
|
||||
"github.com/Mrs4s/MiraiGo/client/pb/qweb"
|
||||
"math/rand"
|
||||
"time"
|
||||
|
||||
"github.com/golang/protobuf/proto"
|
||||
|
||||
"github.com/Mrs4s/MiraiGo/binary"
|
||||
"github.com/Mrs4s/MiraiGo/binary/jce"
|
||||
"github.com/Mrs4s/MiraiGo/client/pb"
|
||||
"github.com/Mrs4s/MiraiGo/client/pb/cmd0x352"
|
||||
"github.com/Mrs4s/MiraiGo/client/pb/msg"
|
||||
"github.com/Mrs4s/MiraiGo/client/pb/oidb"
|
||||
"github.com/Mrs4s/MiraiGo/client/pb/profilecard"
|
||||
"github.com/Mrs4s/MiraiGo/client/pb/qweb"
|
||||
"github.com/Mrs4s/MiraiGo/client/pb/structmsg"
|
||||
"github.com/Mrs4s/MiraiGo/message"
|
||||
"github.com/Mrs4s/MiraiGo/protocol/crypto"
|
||||
"github.com/Mrs4s/MiraiGo/protocol/packets"
|
||||
"github.com/Mrs4s/MiraiGo/protocol/tlv"
|
||||
"github.com/golang/protobuf/proto"
|
||||
)
|
||||
|
||||
var (
|
||||
@ -261,8 +260,8 @@ func (c *QQClient) buildClientRegisterPacket() (uint16, []byte) {
|
||||
NewSSOIp: 31806887127679168,
|
||||
ChannelNo: "",
|
||||
CPID: 0,
|
||||
VendorName: "MIUI",
|
||||
VendorOSName: string(SystemDeviceInfo.Product),
|
||||
VendorName: string(SystemDeviceInfo.VendorName),
|
||||
VendorOSName: string(SystemDeviceInfo.VendorOSName),
|
||||
B769: []byte{0x0A, 0x04, 0x08, 0x2E, 0x10, 0x00, 0x0A, 0x05, 0x08, 0x9B, 0x02, 0x10, 0x00},
|
||||
SetMute: 0,
|
||||
}
|
||||
|
@ -46,6 +46,8 @@ type DeviceInfo struct {
|
||||
IMEI string
|
||||
AndroidId []byte
|
||||
APN []byte
|
||||
VendorName []byte
|
||||
VendorOSName []byte
|
||||
Guid []byte
|
||||
TgtgtKey []byte
|
||||
Protocol ClientProtocol
|
||||
@ -78,11 +80,13 @@ type DeviceInfoFile struct {
|
||||
OsType string `json:"os_type"`
|
||||
MacAddress string `json:"mac_address"`
|
||||
IpAddress []int32 `json:"ip_address"`
|
||||
WifiBSSID string `json:"wifiBSSID"`
|
||||
WifiSSID string `json:"wifiSSID"`
|
||||
ImsiMd5 string `json:"imsiMd5"`
|
||||
WifiBSSID string `json:"wifi_bssid"`
|
||||
WifiSSID string `json:"wifi_ssid"`
|
||||
ImsiMd5 string `json:"imsi_md5"`
|
||||
AndroidId string `json:"android_id"`
|
||||
Apn string `json:"apn"`
|
||||
VendorName string `json:"vendor_name"`
|
||||
VendorOSName string `json:"vendor_os_name"`
|
||||
}
|
||||
|
||||
type VersionFile struct {
|
||||
@ -131,6 +135,8 @@ var SystemDeviceInfo = &DeviceInfo{
|
||||
IMEI: "468356291846738",
|
||||
AndroidId: []byte("MIRAI.123456.001"),
|
||||
APN: []byte("wifi"),
|
||||
VendorName: []byte("MIUI"),
|
||||
VendorOSName: []byte("mirai"),
|
||||
Protocol: IPad,
|
||||
Version: &Version{
|
||||
Incremental: []byte("5891938"),
|
||||
@ -163,7 +169,9 @@ func GenRandomDevice() {
|
||||
t := md5.Sum(r)
|
||||
SystemDeviceInfo.IMSIMd5 = t[:]
|
||||
SystemDeviceInfo.IMEI = GenIMEI()
|
||||
SystemDeviceInfo.AndroidId = SystemDeviceInfo.Display
|
||||
r = make([]byte, 8)
|
||||
rand.Read(r)
|
||||
hex.Encode(SystemDeviceInfo.AndroidId, r)
|
||||
SystemDeviceInfo.GenNewGuid()
|
||||
SystemDeviceInfo.GenNewTgtgtKey()
|
||||
}
|
||||
@ -255,6 +263,8 @@ func (info *DeviceInfo) ToJson() []byte {
|
||||
WifiSSID: string(info.WifiSSID),
|
||||
ImsiMd5: hex.EncodeToString(info.IMSIMd5),
|
||||
Apn: string(info.APN),
|
||||
VendorName: string(info.VendorName),
|
||||
VendorOSName: string(info.VendorOSName),
|
||||
Protocol: func() int {
|
||||
switch info.Protocol {
|
||||
case IPad:
|
||||
@ -311,11 +321,14 @@ func (info *DeviceInfo) ReadJson(d []byte) error {
|
||||
if f.IMEI != "" {
|
||||
info.IMEI = f.IMEI
|
||||
}
|
||||
SetIfNotEmpty(&info.AndroidId, f.AndroidId)
|
||||
SetIfNotEmpty(&info.APN, f.Apn)
|
||||
SetIfNotEmpty(&info.VendorName, f.VendorName)
|
||||
SetIfNotEmpty(&info.VendorOSName, f.VendorOSName)
|
||||
|
||||
info.AndroidId = info.Display // 兼容旧的
|
||||
SetIfNotEmpty(&info.AndroidId, f.Display)
|
||||
SetIfNotEmpty(&info.AndroidId, f.AndroidId)
|
||||
if f.AndroidId == "" {
|
||||
info.AndroidId = info.Display // ?
|
||||
}
|
||||
|
||||
switch f.Protocol {
|
||||
case 1:
|
||||
|
Loading…
x
Reference in New Issue
Block a user