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