github.com/HXSecurity/DongTai-agent-go@v0.4.2/core/base/stringsBuilderWriteString/replacement.go (about)

     1  package stringsBuilderWriteString
     2  
     3  import (
     4  	"github.com/HXSecurity/DongTai-agent-go/model/request"
     5  	"github.com/HXSecurity/DongTai-agent-go/utils"
     6  	"strings"
     7  )
     8  
     9  func WriteString(b *strings.Builder, s string) (n int, err error) {
    10  	argStr := b.String()
    11  	n, err = WriteStringT(b, s)
    12  	var WriteMap = make(map[string]bool)
    13  	WriteMap["strings.Join"] = true
    14  	WriteMap["strings.Replace"] = true
    15  	WriteMap["net/url.Values.Encode"] = true
    16  	WriteMap["net/url.(*URL).String"] = true
    17  	if !WriteMap[utils.LoadFunc(2)] {
    18  		request.FmtHookPool(request.PoolReq{
    19  			Args:            request.Collect(argStr, s),
    20  			Reqs:            request.Collect(b.String()),
    21  			NeedHook:        request.Collect(argStr, s),
    22  			NeedCatch:       request.Collect(b.String()),
    23  			Source:          false,
    24  			OriginClassName: "strings.(*Builder)",
    25  			MethodName:      "WriteString",
    26  			ClassName:       "strings.(*Builder)",
    27  		})
    28  	}
    29  	return n, err
    30  }
    31  
    32  func WriteStringT(b *strings.Builder, s string) (n int, err error) {
    33  	return n, err
    34  }