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 (
|
import (
|
||||||
"encoding/hex"
|
"encoding/hex"
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/Mrs4s/MiraiGo/client/pb/profilecard"
|
|
||||||
"github.com/Mrs4s/MiraiGo/client/pb/qweb"
|
|
||||||
"math/rand"
|
"math/rand"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/golang/protobuf/proto"
|
|
||||||
|
|
||||||
"github.com/Mrs4s/MiraiGo/binary"
|
"github.com/Mrs4s/MiraiGo/binary"
|
||||||
"github.com/Mrs4s/MiraiGo/binary/jce"
|
"github.com/Mrs4s/MiraiGo/binary/jce"
|
||||||
"github.com/Mrs4s/MiraiGo/client/pb"
|
"github.com/Mrs4s/MiraiGo/client/pb"
|
||||||
"github.com/Mrs4s/MiraiGo/client/pb/cmd0x352"
|
"github.com/Mrs4s/MiraiGo/client/pb/cmd0x352"
|
||||||
"github.com/Mrs4s/MiraiGo/client/pb/msg"
|
"github.com/Mrs4s/MiraiGo/client/pb/msg"
|
||||||
"github.com/Mrs4s/MiraiGo/client/pb/oidb"
|
"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/client/pb/structmsg"
|
||||||
"github.com/Mrs4s/MiraiGo/message"
|
"github.com/Mrs4s/MiraiGo/message"
|
||||||
"github.com/Mrs4s/MiraiGo/protocol/crypto"
|
"github.com/Mrs4s/MiraiGo/protocol/crypto"
|
||||||
"github.com/Mrs4s/MiraiGo/protocol/packets"
|
"github.com/Mrs4s/MiraiGo/protocol/packets"
|
||||||
"github.com/Mrs4s/MiraiGo/protocol/tlv"
|
"github.com/Mrs4s/MiraiGo/protocol/tlv"
|
||||||
|
"github.com/golang/protobuf/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
@ -261,8 +260,8 @@ func (c *QQClient) buildClientRegisterPacket() (uint16, []byte) {
|
|||||||
NewSSOIp: 31806887127679168,
|
NewSSOIp: 31806887127679168,
|
||||||
ChannelNo: "",
|
ChannelNo: "",
|
||||||
CPID: 0,
|
CPID: 0,
|
||||||
VendorName: "MIUI",
|
VendorName: string(SystemDeviceInfo.VendorName),
|
||||||
VendorOSName: string(SystemDeviceInfo.Product),
|
VendorOSName: string(SystemDeviceInfo.VendorOSName),
|
||||||
B769: []byte{0x0A, 0x04, 0x08, 0x2E, 0x10, 0x00, 0x0A, 0x05, 0x08, 0x9B, 0x02, 0x10, 0x00},
|
B769: []byte{0x0A, 0x04, 0x08, 0x2E, 0x10, 0x00, 0x0A, 0x05, 0x08, 0x9B, 0x02, 0x10, 0x00},
|
||||||
SetMute: 0,
|
SetMute: 0,
|
||||||
}
|
}
|
||||||
|
175
client/global.go
175
client/global.go
@ -25,31 +25,33 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type DeviceInfo struct {
|
type DeviceInfo struct {
|
||||||
Display []byte
|
Display []byte
|
||||||
Product []byte
|
Product []byte
|
||||||
Device []byte
|
Device []byte
|
||||||
Board []byte
|
Board []byte
|
||||||
Brand []byte
|
Brand []byte
|
||||||
Model []byte
|
Model []byte
|
||||||
Bootloader []byte
|
Bootloader []byte
|
||||||
FingerPrint []byte
|
FingerPrint []byte
|
||||||
BootId []byte
|
BootId []byte
|
||||||
ProcVersion []byte
|
ProcVersion []byte
|
||||||
BaseBand []byte
|
BaseBand []byte
|
||||||
SimInfo []byte
|
SimInfo []byte
|
||||||
OSType []byte
|
OSType []byte
|
||||||
MacAddress []byte
|
MacAddress []byte
|
||||||
IpAddress []byte
|
IpAddress []byte
|
||||||
WifiBSSID []byte
|
WifiBSSID []byte
|
||||||
WifiSSID []byte
|
WifiSSID []byte
|
||||||
IMSIMd5 []byte
|
IMSIMd5 []byte
|
||||||
IMEI string
|
IMEI string
|
||||||
AndroidId []byte
|
AndroidId []byte
|
||||||
APN []byte
|
APN []byte
|
||||||
Guid []byte
|
VendorName []byte
|
||||||
TgtgtKey []byte
|
VendorOSName []byte
|
||||||
Protocol ClientProtocol
|
Guid []byte
|
||||||
Version *Version
|
TgtgtKey []byte
|
||||||
|
Protocol ClientProtocol
|
||||||
|
Version *Version
|
||||||
}
|
}
|
||||||
|
|
||||||
type Version struct {
|
type Version struct {
|
||||||
@ -60,29 +62,31 @@ type Version struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type DeviceInfoFile struct {
|
type DeviceInfoFile struct {
|
||||||
Display string `json:"display"`
|
Display string `json:"display"`
|
||||||
Product string `json:"product"`
|
Product string `json:"product"`
|
||||||
Device string `json:"device"`
|
Device string `json:"device"`
|
||||||
Board string `json:"board"`
|
Board string `json:"board"`
|
||||||
Model string `json:"model"`
|
Model string `json:"model"`
|
||||||
FingerPrint string `json:"finger_print"`
|
FingerPrint string `json:"finger_print"`
|
||||||
BootId string `json:"boot_id"`
|
BootId string `json:"boot_id"`
|
||||||
ProcVersion string `json:"proc_version"`
|
ProcVersion string `json:"proc_version"`
|
||||||
Protocol int `json:"protocol"` // 0: Pad 1: Phone 2: Watch
|
Protocol int `json:"protocol"` // 0: Pad 1: Phone 2: Watch
|
||||||
IMEI string `json:"imei"`
|
IMEI string `json:"imei"`
|
||||||
Brand string `json:"brand"`
|
Brand string `json:"brand"`
|
||||||
Bootloader string `json:"bootloader"`
|
Bootloader string `json:"bootloader"`
|
||||||
BaseBand string `json:"base_band"`
|
BaseBand string `json:"base_band"`
|
||||||
Version *VersionFile `json:"version"`
|
Version *VersionFile `json:"version"`
|
||||||
SimInfo string `json:"sim_info"`
|
SimInfo string `json:"sim_info"`
|
||||||
OsType string `json:"os_type"`
|
OsType string `json:"os_type"`
|
||||||
MacAddress string `json:"mac_address"`
|
MacAddress string `json:"mac_address"`
|
||||||
IpAddress []int32 `json:"ip_address"`
|
IpAddress []int32 `json:"ip_address"`
|
||||||
WifiBSSID string `json:"wifiBSSID"`
|
WifiBSSID string `json:"wifi_bssid"`
|
||||||
WifiSSID string `json:"wifiSSID"`
|
WifiSSID string `json:"wifi_ssid"`
|
||||||
ImsiMd5 string `json:"imsiMd5"`
|
ImsiMd5 string `json:"imsi_md5"`
|
||||||
AndroidId string `json:"android_id"`
|
AndroidId string `json:"android_id"`
|
||||||
Apn string `json:"apn"`
|
Apn string `json:"apn"`
|
||||||
|
VendorName string `json:"vendor_name"`
|
||||||
|
VendorOSName string `json:"vendor_os_name"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type VersionFile struct {
|
type VersionFile struct {
|
||||||
@ -111,27 +115,29 @@ type versionInfo struct {
|
|||||||
|
|
||||||
// default
|
// default
|
||||||
var SystemDeviceInfo = &DeviceInfo{
|
var SystemDeviceInfo = &DeviceInfo{
|
||||||
Display: []byte("MIRAI.123456.001"),
|
Display: []byte("MIRAI.123456.001"),
|
||||||
Product: []byte("mirai"),
|
Product: []byte("mirai"),
|
||||||
Device: []byte("mirai"),
|
Device: []byte("mirai"),
|
||||||
Board: []byte("mirai"),
|
Board: []byte("mirai"),
|
||||||
Brand: []byte("mamoe"),
|
Brand: []byte("mamoe"),
|
||||||
Model: []byte("mirai"),
|
Model: []byte("mirai"),
|
||||||
Bootloader: []byte("unknown"),
|
Bootloader: []byte("unknown"),
|
||||||
FingerPrint: []byte("mamoe/mirai/mirai:10/MIRAI.200122.001/1234567:user/release-keys"),
|
FingerPrint: []byte("mamoe/mirai/mirai:10/MIRAI.200122.001/1234567:user/release-keys"),
|
||||||
BootId: []byte("cb886ae2-00b6-4d68-a230-787f111d12c7"),
|
BootId: []byte("cb886ae2-00b6-4d68-a230-787f111d12c7"),
|
||||||
ProcVersion: []byte("Linux version 3.0.31-cb886ae2 (android-build@xxx.xxx.xxx.xxx.com)"),
|
ProcVersion: []byte("Linux version 3.0.31-cb886ae2 (android-build@xxx.xxx.xxx.xxx.com)"),
|
||||||
BaseBand: []byte{},
|
BaseBand: []byte{},
|
||||||
SimInfo: []byte("T-Mobile"),
|
SimInfo: []byte("T-Mobile"),
|
||||||
OSType: []byte("android"),
|
OSType: []byte("android"),
|
||||||
MacAddress: []byte("00:50:56:C0:00:08"),
|
MacAddress: []byte("00:50:56:C0:00:08"),
|
||||||
IpAddress: []byte{10, 0, 1, 3}, // 10.0.1.3
|
IpAddress: []byte{10, 0, 1, 3}, // 10.0.1.3
|
||||||
WifiBSSID: []byte("00:50:56:C0:00:08"),
|
WifiBSSID: []byte("00:50:56:C0:00:08"),
|
||||||
WifiSSID: []byte("<unknown ssid>"),
|
WifiSSID: []byte("<unknown ssid>"),
|
||||||
IMEI: "468356291846738",
|
IMEI: "468356291846738",
|
||||||
AndroidId: []byte("MIRAI.123456.001"),
|
AndroidId: []byte("MIRAI.123456.001"),
|
||||||
APN: []byte("wifi"),
|
APN: []byte("wifi"),
|
||||||
Protocol: IPad,
|
VendorName: []byte("MIUI"),
|
||||||
|
VendorOSName: []byte("mirai"),
|
||||||
|
Protocol: IPad,
|
||||||
Version: &Version{
|
Version: &Version{
|
||||||
Incremental: []byte("5891938"),
|
Incremental: []byte("5891938"),
|
||||||
Release: []byte("10"),
|
Release: []byte("10"),
|
||||||
@ -163,7 +169,9 @@ func GenRandomDevice() {
|
|||||||
t := md5.Sum(r)
|
t := md5.Sum(r)
|
||||||
SystemDeviceInfo.IMSIMd5 = t[:]
|
SystemDeviceInfo.IMSIMd5 = t[:]
|
||||||
SystemDeviceInfo.IMEI = GenIMEI()
|
SystemDeviceInfo.IMEI = GenIMEI()
|
||||||
SystemDeviceInfo.AndroidId = SystemDeviceInfo.Display
|
r = make([]byte, 8)
|
||||||
|
rand.Read(r)
|
||||||
|
hex.Encode(SystemDeviceInfo.AndroidId, r)
|
||||||
SystemDeviceInfo.GenNewGuid()
|
SystemDeviceInfo.GenNewGuid()
|
||||||
SystemDeviceInfo.GenNewTgtgtKey()
|
SystemDeviceInfo.GenNewTgtgtKey()
|
||||||
}
|
}
|
||||||
@ -247,14 +255,16 @@ func (info *DeviceInfo) ToJson() []byte {
|
|||||||
Codename: string(info.Version.CodeName),
|
Codename: string(info.Version.CodeName),
|
||||||
Sdk: info.Version.Sdk,
|
Sdk: info.Version.Sdk,
|
||||||
},
|
},
|
||||||
SimInfo: string(info.SimInfo),
|
SimInfo: string(info.SimInfo),
|
||||||
OsType: string(info.OSType),
|
OsType: string(info.OSType),
|
||||||
MacAddress: string(info.MacAddress),
|
MacAddress: string(info.MacAddress),
|
||||||
IpAddress: []int32{int32(info.IpAddress[0]), int32(info.IpAddress[1]), int32(info.IpAddress[2]), int32(info.IpAddress[3])},
|
IpAddress: []int32{int32(info.IpAddress[0]), int32(info.IpAddress[1]), int32(info.IpAddress[2]), int32(info.IpAddress[3])},
|
||||||
WifiBSSID: string(info.WifiBSSID),
|
WifiBSSID: string(info.WifiBSSID),
|
||||||
WifiSSID: string(info.WifiSSID),
|
WifiSSID: string(info.WifiSSID),
|
||||||
ImsiMd5: hex.EncodeToString(info.IMSIMd5),
|
ImsiMd5: hex.EncodeToString(info.IMSIMd5),
|
||||||
Apn: string(info.APN),
|
Apn: string(info.APN),
|
||||||
|
VendorName: string(info.VendorName),
|
||||||
|
VendorOSName: string(info.VendorOSName),
|
||||||
Protocol: func() int {
|
Protocol: func() int {
|
||||||
switch info.Protocol {
|
switch info.Protocol {
|
||||||
case IPad:
|
case IPad:
|
||||||
@ -311,11 +321,14 @@ func (info *DeviceInfo) ReadJson(d []byte) error {
|
|||||||
if f.IMEI != "" {
|
if f.IMEI != "" {
|
||||||
info.IMEI = f.IMEI
|
info.IMEI = f.IMEI
|
||||||
}
|
}
|
||||||
SetIfNotEmpty(&info.AndroidId, f.AndroidId)
|
|
||||||
SetIfNotEmpty(&info.APN, f.Apn)
|
SetIfNotEmpty(&info.APN, f.Apn)
|
||||||
|
SetIfNotEmpty(&info.VendorName, f.VendorName)
|
||||||
|
SetIfNotEmpty(&info.VendorOSName, f.VendorOSName)
|
||||||
|
|
||||||
info.AndroidId = info.Display // 兼容旧的
|
SetIfNotEmpty(&info.AndroidId, f.AndroidId)
|
||||||
SetIfNotEmpty(&info.AndroidId, f.Display)
|
if f.AndroidId == "" {
|
||||||
|
info.AndroidId = info.Display // ?
|
||||||
|
}
|
||||||
|
|
||||||
switch f.Protocol {
|
switch f.Protocol {
|
||||||
case 1:
|
case 1:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user