github.com/HXSecurity/DongTai-agent-go@v0.4.2/core/base/httpNewRequest/install.go (about) 1 package httpNewRequest 2 3 import ( 4 "fmt" 5 "github.com/HXSecurity/DongTai-agent-go/model" 6 "github.com/brahma-adshonor/gohook" 7 "net/http" 8 ) 9 10 func init() { 11 model.HookMap["httpNewRequest"] = new(HttpNewRequest) 12 } 13 14 type HttpNewRequest struct { 15 } 16 17 func (h *HttpNewRequest) Hook() { 18 err := gohook.Hook(http.NewRequest, NewRequest, NewRequestR) 19 if err != nil { 20 fmt.Println(err, "HttpNewRequest") 21 } else { 22 fmt.Println("HttpNewRequest") 23 } 24 } 25 26 func (h *HttpNewRequest) UnHook() { 27 gohook.UnHook(http.NewRequest) 28 }