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

     1  package runtimesSringtoslicebyte
     2  
     3  import (
     4  	"github.com/HXSecurity/DongTai-agent-go/model/request"
     5  	"reflect"
     6  	_ "unsafe"
     7  )
     8  
     9  const tmpStringBufSize = 32
    10  
    11  type tmpBuf [tmpStringBufSize]byte
    12  
    13  //go:linkname stringtoslicebyte runtime.stringtoslicebyte
    14  func stringtoslicebyte(buf *tmpBuf, s string) []byte
    15  
    16  func stringtoslicebyteR(buf *tmpBuf, s string) []byte {
    17  	b := stringtoslicebyteT(buf, s)
    18  
    19  	var u uintptr
    20  	value := reflect.ValueOf(b)
    21  	u = value.Pointer()
    22  	request.FmtHookPool(request.PoolReq{
    23  		Args:            request.Collect(s),
    24  		Reqs:            request.Collect(b),
    25  		NeedCatch:       request.Collect(u),
    26  		Source:          false,
    27  		OriginClassName: "runtime",
    28  		MethodName:      "stringtoslicebyte",
    29  		ClassName:       "runtime",
    30  	})
    31  	return b
    32  }
    33  
    34  func stringtoslicebyteT(buf *tmpBuf, s string) []byte {
    35  	return []byte{}
    36  }