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