github.com/HXSecurity/DongTai-agent-go@v0.4.2/core/gin/ginContextShouldBindBodyWith/install.go (about) 1 package ginContextShouldBindBodyWith 2 3 import ( 4 "fmt" 5 "github.com/HXSecurity/DongTai-agent-go/model" 6 "github.com/brahma-adshonor/gohook" 7 "github.com/gin-gonic/gin" 8 ) 9 10 func init() { 11 model.HookMap["ginContextShouldBindBodyWith"] = new(GinContextShouldBindBodyWith) 12 } 13 14 type GinContextShouldBindBodyWith struct { 15 } 16 17 func (h *GinContextShouldBindBodyWith) Hook() { 18 context := &gin.Context{} 19 err := gohook.HookMethod(context, "ShouldBindBodyWith", ShouldBindBodyWith, ShouldBindBodyWithT) 20 if err != nil { 21 fmt.Println(err, "GinContextShouldBindBodyWith") 22 } else { 23 fmt.Println("GinContextShouldBindBodyWith") 24 } 25 } 26 27 func (h *GinContextShouldBindBodyWith) UnHook() { 28 context := &gin.Context{} 29 gohook.UnHookMethod(context, "ShouldBindBodyWith") 30 }