github.com/HXSecurity/DongTai-agent-go@v0.4.2/core/base/bufioWriterWriteString/replacement.go (about) 1 package bufioWriterWriteString 2 3 import ( 4 "bufio" 5 "github.com/HXSecurity/DongTai-agent-go/global" 6 "github.com/HXSecurity/DongTai-agent-go/utils" 7 ) 8 9 func WriteString(b *bufio.Writer, v string) (n int, err error) { 10 if utils.IsHook("net/http.extraHeader.Write", 6) { 11 value, ok := global.ResponseHeaderMap.Load(utils.CatGoroutineID()) 12 if ok { 13 str := utils.StringAdd(value.(string), string(v)) 14 global.ResponseHeaderMap.Store(utils.CatGoroutineID(), str) 15 } else { 16 global.ResponseHeaderMap.Store(utils.CatGoroutineID(), string(v)) 17 } 18 } 19 //request.FmtHookPool(request.PoolReq{ 20 // Args: request.Collect(argStr, s), 21 // Reqs: request.Collect(b.String()), 22 // NeedHook: request.Collect(argStr, s), 23 // NeedCatch: request.Collect(b.String()), 24 // Source: false, 25 // OriginClassName: "bytes.(*Buffer)", 26 // MethodName: "WriteString", 27 // ClassName: "bytes.(*Buffer)", 28 //}) 29 return WriteStringT(b, v) 30 } 31 32 func WriteStringT(b *bufio.Writer, v string) (n int, err error) { 33 return n, err 34 }