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