espilon-source/espilon_bot/components/core/process.c
Eun0us 6d45770d98 epsilon: merge command system into core + add 5 new modules
Move command registry from components/command/ into components/core/.
New modules: mod_canbus, mod_honeypot, mod_fallback, mod_redteam, mod_ota.
Replace mod_proxy with tun_core (multiplexed SOCKS5 tunnel).
Kconfig extended with per-module settings and async worker config.
2026-02-28 20:07:59 +01:00

48 lines
1.4 KiB
C

#include <string.h>
#include "c2.pb.h"
#include "utils.h"
#include "esp_log.h"
static const char *TAG = "PROCESS";
/* =========================================================
* UNIQUE ENTRY POINT — C2 → ESP
* ========================================================= */
void process_command(const c2_Command *cmd)
{
if (!cmd) {
ESP_LOGE(TAG, "NULL command");
return;
}
/* -----------------------------------------------------
* Device ID check — allow broadcast (empty device_id)
* ----------------------------------------------------- */
if (cmd->device_id[0] != '\0' &&
strcmp(CONFIG_DEVICE_ID, cmd->device_id) != 0) {
ESP_LOGW(TAG,
"Command not for this device (target=%s, self=%s)",
cmd->device_id, CONFIG_DEVICE_ID);
return;
}
/* -----------------------------------------------------
* Basic validation
* ----------------------------------------------------- */
if (cmd->command_name[0] == '\0') {
msg_error(TAG, "Empty command name", cmd->request_id);
return;
}
ESP_LOGI(TAG,
"CMD received: %s (argc=%d)",
cmd->command_name,
cmd->argv_count);
/* -----------------------------------------------------
* Dispatch to command engine
* ----------------------------------------------------- */
command_process_pb(cmd);
}