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

     1  package httpRequestFormValue
     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["httpRequestFormValue"] = new(HttpRequestFormValue)
    12  }
    13  
    14  type HttpRequestFormValue struct {
    15  }
    16  
    17  func (h *HttpRequestFormValue) Hook() {
    18  	var r *http.Request
    19  	err := gohook.HookMethod(r, "FormValue", FormValue, FormValueT)
    20  	if err != nil {
    21  		fmt.Println(err, "FormValue")
    22  	} else {
    23  		fmt.Println("FormValue")
    24  	}
    25  }
    26  
    27  func (h *HttpRequestFormValue) UnHook() {
    28  	var r *http.Request
    29  	gohook.UnHookMethod(r, "FormValue")
    30  }