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

     1  package gorillaRpcServerHTTP
     2  
     3  import (
     4  	"fmt"
     5  	"github.com/HXSecurity/DongTai-agent-go/model"
     6  	"github.com/brahma-adshonor/gohook"
     7  	"github.com/gorilla/rpc/v2"
     8  )
     9  
    10  func init() {
    11  	model.HookMap["gorillaRpcServerHTTP"] = new(GorillaRpcServerHTTP)
    12  }
    13  
    14  type GorillaRpcServerHTTP struct {
    15  }
    16  
    17  func (h *GorillaRpcServerHTTP) Hook() {
    18  	mux := &rpc.Server{}
    19  	err := gohook.HookMethod(mux, "ServeHTTP", MyServer, MyServerTemp)
    20  	if err != nil {
    21  		fmt.Println(err, "GorillaRpcServerHTTP")
    22  	} else {
    23  		fmt.Println("GorillaRpcServerHTTP")
    24  	}
    25  }
    26  
    27  func (h *GorillaRpcServerHTTP) UnHook() {
    28  	mux := &rpc.Server{}
    29  	gohook.UnHookMethod(mux, "ServeHTTP")
    30  }