-
Notifications
You must be signed in to change notification settings - Fork 0
/
inject.c
47 lines (36 loc) · 797 Bytes
/
inject.c
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#include <frida-core.h>
#include <stdio.h>
#include <stdlib.h>
int
main (int argc, char * argv[])
{
int result = 0;
FridaInjector * injector;
int pid;
GError * error;
guint id;
if (argc != 2)
goto bad_usage;
pid = atoi (argv[1]);
if (pid <= 0)
goto bad_usage;
frida_init ();
injector = frida_injector_new ();
error = NULL;
id = frida_injector_inject_library_file_sync (injector, pid, "./agent.so", "example_agent_main", "example data", &error);
if (error != NULL)
{
fprintf (stderr, "%s\n", error->message);
g_error_free (error);
result = 1;
}
frida_injector_close_sync (injector);
g_object_unref (injector);
frida_deinit ();
return result;
bad_usage:
{
fprintf (stderr, "Usage: %s <pid>\n", argv[0]);
return 1;
}
}