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