github.com/HXSecurity/DongTai-agent-go@v0.4.2/core/http/httpServeHTTP/install.go (about) 1 package httpServeHTTP 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["httpServeHTTP"] = new(HttpServeHTTP) 12 } 13 14 type HttpServeHTTP struct { 15 } 16 17 func (h *HttpServeHTTP) Hook() { 18 mux := &http.ServeMux{} 19 err := gohook.HookMethod(mux, "ServeHTTP", MyServer, MyServerTemp) 20 if err != nil { 21 fmt.Println(err, "HttpServeHTTP") 22 } else { 23 fmt.Println("HttpServeHTTP") 24 } 25 } 26 27 func (h *HttpServeHTTP) UnHook() { 28 mux := &http.ServeMux{} 29 gohook.UnHookMethod(mux, "ServeHTTP") 30 }