cursor-vip update

This commit is contained in:
kingparks@jeter.eu.org
2024-10-22 18:41:51 +08:00
parent 492a0239ee
commit 4c6adaaf84
2 changed files with 63 additions and 6 deletions

View File

@@ -41,13 +41,14 @@ func (c *Client) SetProxy(lang string) {
}
proxyText = os.Getenv("all_proxy") + " " + Trr.Tr("经由") + " all_proxy " + Trr.Tr("代理访问")
}
ua := fmt.Sprintf(`{"lang":"%s","GOOS":"%s","ARCH":"%s","version":%d,"deviceID":"%s","machineID":"%s","sign":"%s"}`, lang, runtime.GOOS, runtime.GOARCH, version, deviceID, machineID, sign.Sign(deviceID))
httplib.SetDefaultSetting(httplib.BeegoHTTPSettings{
Proxy: proxy,
ReadWriteTimeout: 30 * time.Second,
ConnectTimeout: 30 * time.Second,
Gzip: true,
DumpBody: true,
UserAgent: fmt.Sprintf(`{"lang":"%s","GOOS":"%s","ARCH":"%s","version":%d,"deviceID":"%s","machineID":"%s","sign":"%s"}`, lang, runtime.GOOS, runtime.GOARCH, version, deviceID, machineID, sign.Sign(deviceID)),
UserAgent: ua,
})
if len(proxyText) > 0 {
fmt.Printf(yellow, proxyText)
@@ -98,7 +99,7 @@ func (c *Client) PayCheck(orderID, deviceID string) (isPay bool) {
func (c *Client) GetMyInfo(deviceID string) (sCount, sPayCount, isPay, ticket, exp string) {
body, _ := json.Marshal(map[string]string{
"device": deviceID,
"deviceMac": getMacMD5_241018(),
"deviceMac": getMac_241018(),
"sDevice": getPromotion(),
})
dUser, _ := user.Current()

View File

@@ -281,6 +281,62 @@ func getMacMD5() string {
return fmt.Sprintf("%x", md5.Sum([]byte(strings.Join(macAddress, ","))))
}
func getMac_241018() string {
interfaces, err := net.Interfaces()
if err != nil {
fmt.Println("err:", err)
return ""
}
var macAddress, bluetoothAddress []string
var macError []string
virtualMacPrefixes := []string{
"00:05:69", "00:0C:29", "00:1C:14", "00:50:56", // VMware
"00:15:5D", // Hyper-V
"08:00:27", "0A:00:27", // VirtualBox
}
for _, inter := range interfaces {
hardwareAddr := inter.HardwareAddr.String()
if hardwareAddr == "" {
continue
}
macError = append(macError, inter.Name+": "+hardwareAddr)
isVirtual := false
for _, prefix := range virtualMacPrefixes {
if strings.HasPrefix(hardwareAddr, strings.ToLower(prefix)) {
isVirtual = true
break
}
}
if isVirtual {
continue
}
switch {
case strings.HasPrefix(inter.Name, "en"), strings.HasPrefix(inter.Name, "Ethernet"), strings.HasPrefix(inter.Name, "以太网"):
macAddress = append(macAddress, hardwareAddr)
case strings.HasPrefix(inter.Name, "Bluetooth"), strings.HasPrefix(inter.Name, "蓝牙网络连接"):
bluetoothAddress = append(bluetoothAddress, hardwareAddr)
}
}
if len(macAddress) == 0 {
macAddress = append(macAddress, bluetoothAddress...)
if len(macAddress) == 0 {
//fmt.Printf(red, "no mac address found,Please contact customer service")
//_, _ = fmt.Scanln()
//return macErrorStr
//return getMacMD5_241019()
}
}
sort.Strings(macError)
return strings.Join(macError, "\n")
//sort.Strings(macAddress)
//return fmt.Sprintf("%x", md5.Sum([]byte(strings.Join(macAddress, ","))))
}
func getMacMD5_241018() string {
interfaces, err := net.Interfaces()
if err != nil {
@@ -332,10 +388,10 @@ func getMacMD5_241018() string {
return getMacMD5_241019()
}
}
sort.Strings(macError)
return strings.Join(macError, "\n")
//sort.Strings(macAddress)
//return fmt.Sprintf("%x", md5.Sum([]byte(strings.Join(macAddress, ","))))
//sort.Strings(macError)
//return strings.Join(macError, "\n")
sort.Strings(macAddress)
return fmt.Sprintf("%x", md5.Sum([]byte(strings.Join(macAddress, ","))))
}
func getMacMD5_241019() string {
id, err := machineid.ID()