From f0b3896cd7f221b8731659013a5b4a19e8c7e12d Mon Sep 17 00:00:00 2001 From: smallwhite Date: Mon, 1 Jul 2024 16:27:34 +0800 Subject: [PATCH] examples: wowjump remove stat --- examples/wowjump/logout.go | 3 -- examples/wowjump/main.go | 7 --- examples/wowjump/utils.go | 108 ------------------------------------- 3 files changed, 118 deletions(-) diff --git a/examples/wowjump/logout.go b/examples/wowjump/logout.go index d4a4712..4d4fe70 100644 --- a/examples/wowjump/logout.go +++ b/examples/wowjump/logout.go @@ -4,7 +4,6 @@ import ( "github.com/whtiehack/wingui/winapi" "log" "math/rand" - "strconv" "time" "github.com/lxn/win" @@ -82,8 +81,6 @@ func (l *Logout) input() { log.Println(l.hwnd, "小退中。。。", l.subTime) if !l.logout() { l.subTime = 0 - } else { - stat.Stat("/logout/"+strconv.Itoa(l.count), "wowjump-logout") } return } diff --git a/examples/wowjump/main.go b/examples/wowjump/main.go index 08f5175..85cf22b 100644 --- a/examples/wowjump/main.go +++ b/examples/wowjump/main.go @@ -3,7 +3,6 @@ package main import ( "log" "os" - "strconv" "syscall" "github.com/lxn/win" @@ -13,7 +12,6 @@ import ( var dlg *wingui.Dialog var out *wingui.Edit -var stat *Statistics // ProcessMutex 防止进程多开,返回 true 表示进程已经开启 func ProcessMutex(name string) bool { @@ -34,7 +32,6 @@ func init() { win.MessageBox(0, &syscall.StringToUTF16("进程已经开启了,不可以多开")[0], nil, 0) os.Exit(-1) } - stat = NewStatistics("https://smallwhite.ml/wingui/wowjump", "d36d3fe91a80f7e10b5757b91896bc98") // control go process() } @@ -66,7 +63,6 @@ func main() { config.editInputTime, config.editCharWaitTime, config.btnCheckChangeChar, config.btnCheckLogoutFlash) config.flashHwnd = dlg.Handle() config.InitVal() - go stat.Stat("/main", "wowjump-main") dlg.Show() setLogOutput(editLog) // Make sure Tabstop can work. @@ -112,7 +108,6 @@ func btnClick() { if len(logouts) == 0 { running = !running log.Println("没有找到WOW窗口,如果确认已经开启了wow窗口\n可以使用管理员身份运行程序试试") - go stat.Stat("/cancel", "wowjump-cancel") return } out.SetText("") @@ -122,10 +117,8 @@ func btnClick() { //config.SkillKey = str //randomSkill.ParseSkillKey(str) log.Println("开始运行") - go stat.Stat("/start", "wowjump-start:"+strconv.Itoa(len(logouts))) } else { log.Println("已经停止运行") - go stat.Stat("/stop", "wowjump-stop") } config.EditEnable(!running) btn.SetText(text) diff --git a/examples/wowjump/utils.go b/examples/wowjump/utils.go index 1d37d60..feaab1e 100644 --- a/examples/wowjump/utils.go +++ b/examples/wowjump/utils.go @@ -1,12 +1,8 @@ package main import ( - "github.com/whtiehack/wingui/winapi" "log" "math/rand" - "net" - "net/url" - "strconv" "time" "unsafe" @@ -114,107 +110,3 @@ func randomMoveMouse() { //mouse_move(x, y, 0, win.MOUSEEVENTF_LEFTUP) } - -type Statistics struct { - prevTime time.Time - si string - curPath string - params url.Values - baseUrl string - lt int -} - -func NewStatistics(baseUrl string, si string) *Statistics { - params := url.Values{} - params.Add("cc", "1") - params.Add("ck", "1") - params.Add("cl", "24-bit") - params.Add("ds", strconv.Itoa(int(win.GetSystemMetrics(win.SM_CXSCREEN)))+"x"+strconv.Itoa(int(win.GetSystemMetrics(win.SM_CYSCREEN)))) - params.Add("vl", "797") - params.Add("et", "0") - params.Add("ja", "0") - params.Add("ln", "zh-cn") - lang := winapi.GetSystemDefaultLocaleName() - if lang != "" { - params.Set("ln", lang) - } - params.Add("lo", "0") - // params.Add("rnd", "0") - params.Add("si", si) - params.Add("v", "1.2.61") - params.Add("lv", "2") - // params.Add("sn", "30541") - return &Statistics{baseUrl: baseUrl, lt: 0, si: si, params: params} -} - -func (s *Statistics) Stat(path string, title string) { - // tt title - // ep 停留时间,活跃时间 - // et 初始进入页面 0, 当前页面有时间 3 - // rnd 随机数 - // su 前一个页面 离开页面时 - // ct 新的一个页面开始 !! - val, _ := url.ParseQuery(s.params.Encode()) - val.Set("rnd", strconv.Itoa(int(rand.Int31()))) - val.Set("sn", strconv.Itoa(int(time.Now().Unix()%65535))) - if s.lt != 0 && int(time.Now().Unix())-s.lt > 2592e3 { - s.lt = int(time.Now().Unix()) - } - if s.lt != 0 { - val.Set("lt", strconv.Itoa(s.lt)) - } - if s.curPath == "" { - // 第一次打开 - val.Set("ct", "!!") - val.Set("tt", title) - val.Set("et", "0") - s.get(val.Encode(), s.baseUrl+path) - } else { - // 离开页面 - val.Set("et", "3") - t := time.Now().Sub(s.prevTime).Milliseconds() - ep := strconv.Itoa(int(t)) + "," + strconv.Itoa(int(t)) - val.Set("ep", ep) - prevPath := s.baseUrl + s.curPath - s.get(val.Encode(), prevPath) - val.Set("rnd", strconv.Itoa(int(rand.Int31()))) - // 进入新页面 - val.Set("u", prevPath) - s.get(val.Encode(), s.baseUrl+path) - val.Set("rnd", strconv.Itoa(int(rand.Int31()))) - val.Del("u") - val.Set("su", prevPath) - val.Set("tt", title) - val.Del("ep") - val.Set("et", "0") - val.Set("ct", "!!") - - if int(time.Now().Unix())-s.lt > 2592e3 { - s.lt = int(time.Now().Unix()) - } - val.Set("lt", strconv.Itoa(s.lt)) - s.get(val.Encode(), s.baseUrl+path) - } - s.prevTime = time.Now() - s.curPath = path -} - -func (s *Statistics) get(params string, referer string) error { - conn, err := net.Dial("tcp", "hm.baidu.com:80") - if err != nil { - print("what err:", err, "\n") - return err - } - defer conn.Close() - _, err = conn.Write([]byte("GET /hm.gif?" + params + " HTTP/1.1\r\n" + - "User-Agent: Wingui\r\n" + - "Referer: " + referer + "\r\n" + - "Host: hm.baidu.com\r\n" + - "Connection: close\r\n" + - "\r\n\r\n")) - if err != nil { - print("write err:", err, "\n") - return err - } - return nil -}