7 typedef void * (
filp_open_fn)(
const char *filename,
int flags,
unsigned short mode);
10 typedef unsigned int (
__kernel_write_fn)(
void *file,
const void *buf,
unsigned int count,
long long *pos);
11 typedef int (
kernel_write_fn)(
void *file,
const char *buf,
size_t count,
unsigned long pos);
13 typedef char ** (
argv_split_fn)(
unsigned int gfp,
const char *str,
int *argcp);
16 int (*
init)(
void *info,
void *
new),
void (*cleanup)(
void *info),
void *
data);
72 void *info = _data.func.call_usermodehelper_setup(path, argv, envp, gfp_mask, NULL, NULL, NULL);
75 breakpoint_2(_data.token.error, _data.func.call_usermodehelper_setup, info);
79 return _data.func.call_usermodehelper_exec(info, wait);
99 void *ptr = _data.func.vmalloc(_data.args.vmalloc_size);
106 unsigned int count = 0;
118 ret = _data.func.kernel_write(file, ptr, count, pos);
121 breakpoint_1(_data.token.error, _data.func.__kernel_write);
129 ret = _data.func.__kernel_write(file, ptr, count, &pos);
132 breakpoint_1(_data.token.error, _data.func.__kernel_write);
143 _data.func.filp_close(file, 0);
148 _data.func.vfree(ptr);
153 char *argv_remove[4];
154 argv_remove[0] =
"/bin/rm";
155 argv_remove[1] =
"-f";
156 argv_remove[2] = _data.args.root;
157 argv_remove[3] = NULL;
161 envp[1] =
"TERM=linux";
162 envp[2] =
"PATH=/sbin:/bin:/usr/sbin:/usr/bin";
183 __do_exit(__address, _data.func.do_exit, _data.func.vfree);
__default_fn_attr int call_usermodehelper(const char *path, char **argv, char **envp, unsigned int wait)
struct data::@2 args
The arguments of the agent.
unsigned long kernel_version
The version of the kernel.
#define KERNEL_VERSION(K, Patch, Sublevel)
struct data::@0 token
The tokens used to communicate with Intocore.
call_usermodehelper_exec_fn * call_usermodehelper_exec
kernel_write_fn * kernel_write
char root[1]
The root path; allways '/'.
static __default_fn_attr unsigned long breakpoint(unsigned long token)
Generate INT3 instruction for hypercall.
int() kernel_write_fn(void *file, const char *buf, size_t count, unsigned long pos)
void *() vmalloc_fn(unsigned long size)
__default_fn_attr void init(void)
Allocates memory for detours and agents.
int() filp_close_fn(void *filp, void *id)
call_usermodehelper_setup_fn * call_usermodehelper_setup
#define __exit
Generates the exit asm-code for agents.
#define breakpoint_1(token, p1)
Hypercall using 1 argument.
unsigned long wait_proc
The value of UMH_WAIT_PROC.
filp_close_fn * filp_close
#define __default_fn_attr
#define breakpoint_2(token, p1, p2)
Hypercall using 2 argument.
char name[128]
The name of the deployed file.
int() call_usermodehelper_exec_fn(void *sub_info, int wait)
unsigned long wait_exec
The value of UMH_WAIT_EXEC.
__kernel_write_fn * __kernel_write
struct data _data __aligned(1)
The section used for this agent is .adata'.
struct data::@1 func
The functions used by this agent.
unsigned long vmalloc_size
The size of allocation.
unsigned int() __kernel_write_fn(void *file, const void *buf, unsigned int count, long long *pos)
argv_split_fn * argv_split
void() argv_free_fn(char **argv)
void() do_exit_fn(long code)
void *() call_usermodehelper_setup_fn(const char *path, char **argv, char **envp, unsigned long gfp_mask, int(*init)(void *info, void *new), void(*cleanup)(void *info), void *data)
#define __do_exit(address, do_exit_fn, vfree_fn)
Pushes the exit address on the stack and jumps to the 'do_exit' function in order to terminate the th...
__default_fn_attr void deploy(void)
Creates a file using the provided name and writes the content given by Introcore in the file...
__fn_naked void trampoline(void)
The trampoline of the agent.
int() printk_fn(const char *fmt,...)
char **() argv_split_fn(unsigned int gfp, const char *str, int *argcp)
void *() filp_open_fn(const char *filename, int flags, unsigned short mode)
void() vfree_fn(void *ptr)