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

     1  package jsonDecoderDecode
     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["jsonDecoderDecode"] = new(JsonDecoderDecode)
    12  }
    13  
    14  type JsonDecoderDecode struct {
    15  }
    16  
    17  func (h *JsonDecoderDecode) Hook() {
    18  	d := &json.Decoder{}
    19  	err := gohook.HookMethod(d, "Decode", Decode, DecodeT)
    20  	if err != nil {
    21  		fmt.Println(err, "JsonDecoderDecode")
    22  	} else {
    23  		fmt.Println("JsonDecoderDecode")
    24  	}
    25  }
    26  
    27  func (h *JsonDecoderDecode) UnHook() {
    28  	d := &json.Decoder{}
    29  	gohook.UnHookMethod(d, "JsonDecoderDecode")
    30  }