github.com/HXSecurity/DongTai-agent-go@v0.4.2/core/gorm/gormDBRaw/install.go (about) 1 package gormDBRaw 2 3 import ( 4 "fmt" 5 "github.com/HXSecurity/DongTai-agent-go/model" 6 "github.com/brahma-adshonor/gohook" 7 "gorm.io/gorm" 8 ) 9 10 func init() { 11 model.HookMap["gormDBRaw"] = new(GormDBRaw) 12 } 13 14 type GormDBRaw struct { 15 } 16 17 func (h *GormDBRaw) Hook() { 18 db := &gorm.DB{} 19 err := gohook.HookMethod(db, "Raw", Raw, RawT) 20 if err != nil { 21 fmt.Println(err, "gormRaw") 22 } else { 23 fmt.Println("gormRaw") 24 } 25 } 26 27 func (h *GormDBRaw) UnHook() { 28 db := &gorm.DB{} 29 gohook.UnHookMethod(db, "Raw") 30 }