github.com/HXSecurity/DongTai-agent-go@v0.4.2/core/base/execCmdStart/install.go (about) 1 package execCmdStart 2 3 import ( 4 "fmt" 5 "github.com/HXSecurity/DongTai-agent-go/model" 6 "github.com/brahma-adshonor/gohook" 7 "os/exec" 8 ) 9 10 func init() { 11 model.HookMap["execCmdStart"] = new(ExecCmdStart) 12 } 13 14 type ExecCmdStart struct { 15 } 16 17 func (h *ExecCmdStart) Hook() { 18 var cmd *exec.Cmd 19 err := gohook.HookMethod(cmd, "Start", Start, StartT) 20 if err != nil { 21 fmt.Println(err, "execCmdStart") 22 } else { 23 fmt.Println("execCmdStart") 24 } 25 } 26 27 func (h *ExecCmdStart) UnHook() { 28 gohook.UnHook(exec.Command) 29 }