github.com/Rookout/GoSDK@v0.1.48/pkg/services/safe_hook_installer/hook_manager.go (about) 1 package safe_hook_installer 2 3 import "github.com/Rookout/GoSDK/pkg/services/safe_hook_validator" 4 5 6 type hookManager struct { 7 8 getFunctionType func(functionEntry uint64, functionEnd uint64) (safe_hook_validator.FunctionType, error) 9 hookAddr uintptr 10 hook []byte 11 } 12 13 func NewHookManager(hookAddr uintptr, hook []byte, getFunctionType func(functionEntry uint64, functionEnd uint64) (safe_hook_validator.FunctionType, error)) *hookManager { 14 return &hookManager{ 15 hookAddr: hookAddr, 16 hook: hook, 17 getFunctionType: getFunctionType, 18 } 19 } 20 21 func (h *hookManager) GetFunctionType(functionEntry uint64, functionEnd uint64) (safe_hook_validator.FunctionType, error) { 22 return h.getFunctionType(functionEntry, functionEnd) 23 } 24 25 func (h *hookManager) GetDangerZoneStartAddress() uint64 { 26 27 return uint64(h.hookAddr + 1) 28 } 29 30 func (h *hookManager) GetDangerZoneEndAddress() uint64 { 31 return uint64(h.hookAddr + uintptr(len(h.hook))) 32 }