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