Skip to content

Instantly share code, notes, and snippets.

@tailriver
Last active June 15, 2020 11:14
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 tailriver/08218bc6da7af6da8c01 to your computer and use it in GitHub Desktop.
Save tailriver/08218bc6da7af6da8c01 to your computer and use it in GitHub Desktop.
A sample to hook an applocation.
#include <stdio.h>
#include <unistd.h>
void hook_start() __attribute__((constructor));
void hook_end() __attribute__((destructor));
void hook_start()
{
printf("hook_start. PID=%d, PPID=%d\n", getpid(), getppid());
}
void hook_end()
{
printf("hook_end. PID=%d, PPID=%d\n", getpid(), getppid());
}
#include <stdio.h>
int main()
{
printf("Hello world.\n");
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment