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

     1  package runtimeConcatstrings
     2  
     3  import (
     4  	"github.com/HXSecurity/DongTai-agent-go/model/request"
     5  	"github.com/HXSecurity/DongTai-agent-go/utils"
     6  	_ "unsafe"
     7  )
     8  
     9  const tmpStringBufSize = 32
    10  
    11  type tmpBuf [tmpStringBufSize]byte
    12  
    13  //go:linkname concatstrings runtime.concatstrings
    14  func concatstrings(buf *tmpBuf, a []string) string
    15  
    16  func concatstringsR(buf *tmpBuf, a []string) string {
    17  	e := concatstringsT(buf, a)
    18  	var WriteMap = make(map[string]bool)
    19  	WriteMap["github.com/HXSecurity/DongTai-agent-go/core/httpRouter/httpRouter.MyHttpRouterServer.func1"] = true
    20  	WriteMap["os.openDir"] = true
    21  	WriteMap["io/fs.(*PathError).Error"] = true
    22  	WriteMap["syscall.UTF16FromString"] = true
    23  	WriteMap["os/exec.findExecutable"] = true
    24  	if !WriteMap[utils.LoadFunc(3)] {
    25  		var ArgStr = "["
    26  		for k, v := range a {
    27  			ArgStr = utils.StringAdd(ArgStr, v)
    28  			if k != len(a)-1 {
    29  				ArgStr = utils.StringAdd(ArgStr, ",")
    30  			} else {
    31  				ArgStr = utils.StringAdd(ArgStr, "]")
    32  			}
    33  		}
    34  		NeedHook := make([]interface{}, len(a))
    35  		for i, v := range a {
    36  			NeedHook[i] = v
    37  		}
    38  		request.FmtHookPool(request.PoolReq{
    39  			Args:            request.Collect(a),
    40  			ArgsStr:         ArgStr,
    41  			Reqs:            request.Collect(e),
    42  			NeedHook:        NeedHook,
    43  			NeedCatch:       request.Collect(e),
    44  			Source:          false,
    45  			OriginClassName: "runtime",
    46  			MethodName:      "concatstrings",
    47  			ClassName:       "runtime",
    48  		})
    49  	}
    50  	return e
    51  }
    52  
    53  func concatstringsT(buf *tmpBuf, a []string) string {
    54  	return ""
    55  }