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

     1  package fmtSprintf
     2  
     3  import (
     4  	"fmt"
     5  	"github.com/HXSecurity/DongTai-agent-go/model"
     6  	"github.com/brahma-adshonor/gohook"
     7  )
     8  
     9  func init() {
    10  	model.HookMap["fmtSprintf"] = new(FmtSprintf)
    11  }
    12  
    13  type FmtSprintf struct {
    14  }
    15  
    16  func (h *FmtSprintf) Hook() {
    17  	err := gohook.Hook(fmt.Sprintf, Sprintf, SprintfT)
    18  	if err != nil {
    19  		fmt.Println(err, "Sprintf")
    20  	} else {
    21  		fmt.Println("Sprintf")
    22  	}
    23  }
    24  
    25  func (h *FmtSprintf) UnHook() {
    26  	gohook.UnHook(fmt.Sprintf)
    27  }