-
-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathloader.c
More file actions
30 lines (23 loc) · 579 Bytes
/
loader.c
File metadata and controls
30 lines (23 loc) · 579 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
/* by Dreg */
#include <stdio.h>
#include <dlfcn.h>
int main(int argc, const char *argv[])
{
void* handle = NULL;
void (*func)() = NULL;
printf("Hello from loader by Dreg\n");
handle = dlopen("./sharedlib.so", RTLD_NOW | RTLD_GLOBAL);
if (handle == NULL)
{
fprintf(stderr, "Unable to open lib: %s\n", dlerror());
return -1;
}
func = dlsym(handle, "ReflectiveLoader");
if (func == NULL) {
fprintf(stderr, "Unable to get symbol\n");
return -1;
}
puts("calling to ReflectiveLoader....");
func();
return 0;
}