-
Notifications
You must be signed in to change notification settings - Fork 3
/
libmonkey.h
45 lines (35 loc) · 1.11 KB
/
libmonkey.h
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
#ifndef MONKEY_H_
#define MONKEY_H_
#include <sys/types.h>
int some_function(int,int,int);
int libmonkey_override_by_ptr(void *orig, const void *target);
struct libmonkey_st {
void *addr;
size_t maplen;
int fd;
};
typedef struct libmonkey_st* libmonkey_t;
/**
* These functions will replace a non-static symbol with anything you want,
* provided the symbol can be located by its name AND you are using the ELF
* format.
*/
/* This returns a handle based on the current running executable */
libmonkey_t libmonkey_new_from_exe(void);
/* Returns a new handle based on the path */
libmonkey_t libmonkey_new_from_path(const char *path);
/* Replaces the global symbol victim with the function
* found at injection.
* If old is not-null, the raw code previously beloning to the victim
* function will be placed there.
*/
int libmonkey_patch(libmonkey_t monkey,
const char *victim,
const void *injection,
void **old,
size_t *nold);
/*
* Free the libmonkey structure
*/
void libmonkey_free(libmonkey_t monkey);
#endif /* MONKEY_H_ */