mirror of
https://github.com/h3xduck/TripleCross.git
synced 2025-12-24 18:33:08 +08:00
Included a global config struct for controlling which hooks and functions of the rootkit should be active. Still work to be done in the bpf side
This commit is contained in:
14
src/ebpf/include/utils/modules.h
Normal file
14
src/ebpf/include/utils/modules.h
Normal file
@@ -0,0 +1,14 @@
|
||||
#ifndef __MODULES_H
|
||||
#define __MODULES_H
|
||||
|
||||
#define RETURN_VALUE_MODULE_NONACTIVE -1
|
||||
//Access user-defined config
|
||||
#include "../../user/include/modules/module_manager.h"
|
||||
|
||||
|
||||
#define CHECK_MODULE_ACTIVE(module, func)\
|
||||
if( module_config. module##_module.all != ON){\
|
||||
return RETURN_VALUE_MODULE_NONACTIVE;\
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -1,5 +1,5 @@
|
||||
#ifndef __COMMON_UTILS_H__
|
||||
#define __COMMON_UTILS_H__
|
||||
#ifndef __UTILS_STRINGS_H__
|
||||
#define __UTILS_STRINGS_H__
|
||||
|
||||
/**
|
||||
* Compares two strings.
|
||||
@@ -29,10 +29,11 @@
|
||||
#include "packet/packet_manager.h"
|
||||
#include "packet/protocol/tcp_helper.h"
|
||||
#include "xdp/xdp_helper.h"
|
||||
#include "common/common_utils.h"
|
||||
#include "utils/strings.h"
|
||||
|
||||
//BPF modules to load
|
||||
#include "include/bpf/fs.h"
|
||||
#include "include/utils/modules.h" //Config
|
||||
#include "include/bpf/sched.h"
|
||||
|
||||
char LICENSE[] SEC("license") = "Dual BSD/GPL";
|
||||
|
||||
@@ -45,8 +46,8 @@ struct eth_hdr {
|
||||
|
||||
|
||||
SEC("xdp_prog")
|
||||
int xdp_receive(struct xdp_md *ctx)
|
||||
{
|
||||
int xdp_receive(struct xdp_md *ctx){
|
||||
CHECK_MODULE_ACTIVE(xdp, __FUNCTION__);
|
||||
//bpf_printk("BPF triggered\n");
|
||||
|
||||
void *data_end = (void *)(long)ctx->data_end;
|
||||
|
||||
Reference in New Issue
Block a user