Skip to content

Instantly share code, notes, and snippets.

@smirn0v
Created September 8, 2014 16:58
Show Gist options
  • Save smirn0v/d2f70ee1e6092d4c9f01 to your computer and use it in GitHub Desktop.
Save smirn0v/d2f70ee1e6092d4c9f01 to your computer and use it in GitHub Desktop.
Inject from Mike Ash
#include <stdio.h>
void inject_init(void) __attribute__((constructor));
void inject_init(void)
{
fprintf(stderr, "Here's your injected code!\n");
}
gcc -c injectlib.c
gcc -dynamiclib -current_version 1.0 injectlib.o -o injectlib.dylib
DYLD_INSERT_LIBRARIES=./injectlib.dylib date
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment