[Agent] [Executor] 优化Functional Executor
This commit is contained in:
@@ -1,53 +1,53 @@
|
||||
package executor
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os/exec"
|
||||
"strings"
|
||||
"syscall"
|
||||
"unsafe"
|
||||
)
|
||||
|
||||
var (
|
||||
user32DLL = syscall.NewLazyDLL("user32.dll")
|
||||
|
||||
messageBox = user32DLL.NewProc("MessageBoxW")
|
||||
)
|
||||
|
||||
func FindPublicIpAddress() {
|
||||
|
||||
cmd := exec.Command("curl", "ifconfig.io")
|
||||
output, err := cmd.Output()
|
||||
if err != nil {
|
||||
fmt.Println("无法获取公网IP地址:", err)
|
||||
return
|
||||
}
|
||||
|
||||
ip := strings.TrimSpace(string(output))
|
||||
fmt.Println("公网IP地址:", ip)
|
||||
|
||||
fmt.Println("")
|
||||
}
|
||||
|
||||
func CallAgent() {
|
||||
var (
|
||||
hWnd uintptr
|
||||
text = "Hello, World!"
|
||||
caption = "Golang Win32API"
|
||||
flags = uint(0x00000001) // MB_OK
|
||||
)
|
||||
|
||||
ret, _, err := messageBox.Call(
|
||||
hWnd,
|
||||
uintptr(unsafe.Pointer(syscall.StringToUTF16Ptr(text))),
|
||||
uintptr(unsafe.Pointer(syscall.StringToUTF16Ptr(caption))),
|
||||
uintptr(flags),
|
||||
)
|
||||
if ret == 0 {
|
||||
fmt.Println("MessageBox failed:", err)
|
||||
return
|
||||
}
|
||||
|
||||
fmt.Println("MessageBox returned:", ret)
|
||||
|
||||
}
|
||||
//import (
|
||||
// "fmt"
|
||||
// "os/exec"
|
||||
// "strings"
|
||||
// "syscall"
|
||||
// "unsafe"
|
||||
//)
|
||||
//
|
||||
//var (
|
||||
// user32DLL = syscall.NewLazyDLL("user32.dll")
|
||||
//
|
||||
// messageBox = user32DLL.NewProc("MessageBoxW")
|
||||
//)
|
||||
//
|
||||
//func FindPublicIpAddress() {
|
||||
//
|
||||
// cmd := exec.Command("curl", "ifconfig.io")
|
||||
// output, err := cmd.Output()
|
||||
// if err != nil {
|
||||
// fmt.Println("无法获取公网IP地址:", err)
|
||||
// return
|
||||
// }
|
||||
//
|
||||
// ip := strings.TrimSpace(string(output))
|
||||
// fmt.Println("公网IP地址:", ip)
|
||||
//
|
||||
// fmt.Println("")
|
||||
//}
|
||||
//
|
||||
//func CallAgent() {
|
||||
// var (
|
||||
// hWnd uintptr
|
||||
// text = "Hello, World!"
|
||||
// caption = "Golang Win32API"
|
||||
// flags = uint(0x00000001) // MB_OK
|
||||
// )
|
||||
//
|
||||
// ret, _, err := messageBox.Call(
|
||||
// hWnd,
|
||||
// uintptr(unsafe.Pointer(syscall.StringToUTF16Ptr(text))),
|
||||
// uintptr(unsafe.Pointer(syscall.StringToUTF16Ptr(caption))),
|
||||
// uintptr(flags),
|
||||
// )
|
||||
// if ret == 0 {
|
||||
// fmt.Println("MessageBox failed:", err)
|
||||
// return
|
||||
// }
|
||||
//
|
||||
// fmt.Println("MessageBox returned:", ret)
|
||||
//
|
||||
//}
|
||||
|
||||
Reference in New Issue
Block a user