espilon-source/espilon_bot/components/mod_redteam/rt_promisc.h
Eun0us 2315979db0
Some checks failed
Discord Push Notification / notify (push) Has been cancelled
ε - Add WiFi offensive capabilities to mod_redteam
Phase 1 of v0.4.0 offensive modules:

- Promiscuous dispatcher (rt_promisc): shared IRAM callback multiplexer
  for stealth scan, karma, capture — solves single-callback ESP-IDF limit
- Attack manager (rt_attack): mutual exclusion ensuring only one
  offensive operation runs at a time
- Deauth refactored to use shared promisc dispatcher + attack lock
- Stealth passive scan migrated to promisc dispatcher
- Karma attack (rt_karma): probe request listener + probe response
  injection + rogue SoftAP with most-requested SSID + DNS responder
- WPA handshake capture (rt_capture): EAPOL frame capture via
  promiscuous DATA filter, 4-way handshake identification, optional
  deauth burst to trigger reconnection
- Kconfig: RT_BEACON, RT_KARMA, RT_CAPTURE toggle options
- 5 new C2 commands: rt_karma, rt_karma_stop, rt_karma_clients,
  rt_capture, rt_capture_stop (14 total in mod_redteam)
2026-03-01 02:08:28 +01:00

54 lines
1.5 KiB
C

/*
* rt_promisc.h
* Shared promiscuous mode dispatcher.
*
* ESP32 supports only one promiscuous RX callback at a time. This module
* multiplexes multiple consumers (stealth scan, karma, capture, ...) behind
* a single IRAM callback and manages channel / enable state.
*/
#pragma once
#include <stdbool.h>
#include <stdint.h>
#include "esp_err.h"
#include "esp_wifi_types.h"
#ifdef __cplusplus
extern "C" {
#endif
#define RT_PROMISC_MAX_HANDLERS 4
typedef void (*rt_promisc_cb_t)(void *buf, wifi_promiscuous_pkt_type_t type);
typedef struct {
rt_promisc_cb_t cb; /* callback (should be IRAM-safe) */
uint32_t filter_mask; /* WIFI_PROMIS_FILTER_MASK_* */
const char *tag; /* debug label */
} rt_promisc_handler_t;
/* Initialise the dispatcher (call once, idempotent). */
void rt_promisc_init(void);
/* Register a handler. Returns ESP_ERR_NO_MEM if table is full. */
esp_err_t rt_promisc_register(const rt_promisc_handler_t *h);
/* Unregister a handler (matched by callback pointer). */
esp_err_t rt_promisc_unregister(const rt_promisc_handler_t *h);
/* Enable promiscuous mode with the combined filter of all registered handlers. */
esp_err_t rt_promisc_enable(void);
/* Disable promiscuous mode. */
esp_err_t rt_promisc_disable(void);
/* Switch to a specific WiFi channel (1-14). */
esp_err_t rt_promisc_set_channel(uint8_t channel);
/* True if promiscuous mode is currently active. */
bool rt_promisc_is_enabled(void);
#ifdef __cplusplus
}
#endif