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

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