github.com/HXSecurity/DongTai-agent-go@v0.4.2/core/http/urlURLQuery/install.go (about)

     1  package urlURLQuery
     2  
     3  import (
     4  	"fmt"
     5  	"github.com/HXSecurity/DongTai-agent-go/model"
     6  	"github.com/brahma-adshonor/gohook"
     7  	"net/http"
     8  	"net/url"
     9  )
    10  
    11  func init() {
    12  	model.HookMap["urlURLQuery"] = new(UrlURLQuery)
    13  }
    14  
    15  type UrlURLQuery struct {
    16  }
    17  
    18  func (h *UrlURLQuery) Hook() {
    19  	var URL *url.URL
    20  	err := gohook.HookMethod(URL, "Query", Query, QueryT)
    21  	if err != nil {
    22  		fmt.Println(err, "UrlURLQuery")
    23  	} else {
    24  		fmt.Println("UrlURLQuery")
    25  	}
    26  }
    27  
    28  func (h *UrlURLQuery) UnHook() {
    29  	var r *http.Request
    30  	gohook.UnHookMethod(r, "UrlURLQuery")
    31  }