Skip to content

Instantly share code, notes, and snippets.

@n00neimp0rtant
Last active January 4, 2016 01:09
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save n00neimp0rtant/8546721 to your computer and use it in GitHub Desktop.
Save n00neimp0rtant/8546721 to your computer and use it in GitHub Desktop.
this is untested and might not even compile. if that's the case tell me whats wrong with it and i'll fix
// declaring the function pointer
int *(*cool_function_pointer)(int, char, float);
// ^ ^ ^ ^
// function's retval function parameters
// getting a pointer to the function
*(void **)(&cool_function_pointer) = dlsym(RTLD_DEFAULT, "cool_function_name");
// ^ ^ ^
// always void means "get func from hooked process" name of function in the binary (should appear as string in dasm)
// call the function
(*cool_function_pointer)(1234, 'a', 56.78f);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment