github.com/HXSecurity/DongTai-agent-go@v0.4.2/core/base/jsonNewDecoder/replacement.go (about) 1 package jsonNewDecoder 2 3 import ( 4 "encoding/json" 5 "github.com/HXSecurity/DongTai-agent-go/model" 6 "github.com/HXSecurity/DongTai-agent-go/model/request" 7 "io" 8 "reflect" 9 ) 10 11 func NewDecoder(r io.Reader) *json.Decoder { 12 v := reflect.ValueOf(r) 13 d := NewDecoderT(r) 14 var u uintptr 15 value := reflect.ValueOf(d) 16 u = value.Pointer() 17 request.FmtHookPool(request.PoolReq{ 18 Args: request.Collect(r), 19 Reqs: request.Collect(d), 20 NeedCatch: request.Collect(u), 21 Source: v.Type().String() == "*http.body" && model.HookMap["ginEngineServerHTTP"] == nil, 22 OriginClassName: "json", 23 MethodName: "NewDecoder", 24 ClassName: "json", 25 }) 26 return d 27 } 28 29 func NewDecoderT(r io.Reader) (d *json.Decoder) { 30 return 31 }