github.com/HXSecurity/DongTai-agent-go@v0.4.2/core/grpc/newServer/install.go (about) 1 package newServer 2 3 import ( 4 "fmt" 5 "github.com/HXSecurity/DongTai-agent-go/model" 6 "github.com/brahma-adshonor/gohook" 7 "google.golang.org/grpc" 8 ) 9 10 func init() { 11 model.HookMap["grpcNewServer"] = new(GrpcNewServer) 12 } 13 14 type GrpcNewServer struct { 15 } 16 17 func (h *GrpcNewServer) Hook() { 18 err := gohook.Hook(grpc.NewServer, NewServer, NewServerT) 19 if err != nil { 20 fmt.Println(err, "GrpcNewServer") 21 } else { 22 fmt.Println("GrpcNewServer") 23 } 24 } 25 26 func (h *GrpcNewServer) UnHook() { 27 gohook.UnHook(grpc.NewServer) 28 }