-
Notifications
You must be signed in to change notification settings - Fork 15
Open
Description
var guard_down *sm.PatchGuard
download_hook := "xxx.DownloadPiece"
guard_down = sm.PatchByFullSymbolName(download_hook, func(ctx context.Context, pt peer.Task, request *peer.DownloadPieceRequest) (success bool) {
// do something
// temporary unpatch
guard_down.Unpatch()
defer guard_down.Restore()
// use forceexport to fetch original function
var function func(context.Context, peer.Task, *peer.DownloadPieceRequest) (success bool)
err := forceexport.GetFunc(&function, download_hook)
if err != nil {
log.Panicf("connect target error: %s", err)
}
// call original function
success = function(ctx, pt, request)
return
})
If the original function is unexported, and should be called inside the hooked method as above, is supermonkey provide some way to call it by symbol name rather than use forceexport?
Metadata
Metadata
Assignees
Labels
No labels