Completed configuration module which enables to change the running ebpf modules in the rootkit at runtime. Minor changes and updated code structure

This commit is contained in:
h3xduck
2022-01-04 13:26:13 -05:00
parent 40da6b300b
commit 74873dbca5
10 changed files with 150 additions and 40 deletions

View File

@@ -2,11 +2,16 @@
#define __MOD_MANAGER_H
#include <stdint.h>
#include <unistd.h>
#include <linux/types.h>
#define ON 1
#define OFF 0
//Centralized configutation struct
//Centralized configutation struct.
//Used by the module manager to decide which modules to load
//If <all> is set in a module, the other configurations are ignored
typedef struct module_config_t{
struct xdp_module {
char all;
@@ -20,6 +25,30 @@ typedef struct module_config_t{
} module_config_t;
//Configuration struct. Used by the module manager to
//correctly attach the needed modules, providing necessary params
typedef struct module_config_attr_t{
struct xdp_filter_bpf *skel;
struct xdp_module_attr {
__u32 ifindex;
__u32 flags;
} xdp_module;
struct sched_module_attr {
void* __empty;
}sched_module;
} module_config_attr_t;
//An unique module configutation struct and attr
extern module_config_t module_config;
extern module_config_attr_t module_config_attr;
/**
* @brief Installs the ebpf modules according to the module_config
*
* @return 0 if ok, -1 if error
*/
int setup_all_modules();
#endif