compel hgen [option ...]
compel plugins [PLUGIN_NAME ...]
compel [--compat] includes | cflags | ldflags
compel [--compat] [--static] libs
compel is a utility to execute arbitrary code, also called parasite code, in the context of a foreign process. The parasitic code, once compiled with compel flags and packed, can be executed in the context of other tasks. Currently there is only one way to load the parasitic blob into victim task using libcompel.a, called c-header.
hgen
plugins
ldflags
cflags
includes
libs
-f, --file FILE
-o, --output FILE
-p, --prefix NAME
-l, --log-level NUM
-h, --help
-V, --version
#include <compel/plugins/std.h>
int parasite_trap_cmd(int cmd, void *args); //gets called by compel_run_in_thread()
int parasite_daemon_cmd(int cmd, void *arg); // gets called by compel_rpc_call() and compel_rpc_call_sync()
void parasite_cleanup(void); //gets called on parasite unload by compel_cure()
The parasitic code is compiled and converted to a header using compel, and included here.
#include <compel/infect.h>
#include "parasite.h"
Following steps are perfomed to infect the victim process:
ctl must be configured with blob information by calling PREFIX_setup_c_header(), with ctl as its argument. PREFIX is the argument given to -p when calling hgen, else it is deduced from file name.
To generate a header file(.h) from a parasite binary file(.po) use:
compel hgen -f parasite.po -o parasite.h
parasite.po file is obtained by compiling the parasite source with compel flags and linking it with the compel plugins.
The CRIU team.