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

     1  package jsonNewDecoder
     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["jsonNewDecoder"] = new(JsonNewDecoder)
    12  }
    13  
    14  type JsonNewDecoder struct {
    15  }
    16  
    17  func (h *JsonNewDecoder) Hook() {
    18  	err := gohook.Hook(json.NewDecoder, NewDecoder, NewDecoderT)
    19  	if err != nil {
    20  		fmt.Println(err, "JsonNewDecoder")
    21  	} else {
    22  		fmt.Println("JsonNewDecoder")
    23  	}
    24  }
    25  
    26  func (h *JsonNewDecoder) UnHook() {
    27  	gohook.UnHook(json.NewDecoder)
    28  }