Files
c5-project/ESP32-C5-Toolkit/main/handshake_capture.h
2026-05-03 23:19:51 -07:00

86 lines
2.5 KiB
C

/**
* @file handshake_capture.h
* @brief WPA/WPA2 Handshake and PMKID capture with dual-radio support
*
* ESP32-C5 Dual Radio Enhancement:
* - Radio 1 (2.4GHz): Dedicated to sniffing/capturing
* - Radio 2 (5GHz or same band): Deauth attacks to force reconnection
*
* This allows simultaneous capture and attack for maximum efficiency
*/
#ifndef HANDSHAKE_CAPTURE_H
#define HANDSHAKE_CAPTURE_H
#include <stdint.h>
#include <stdbool.h>
#include "esp_wifi.h"
#include "frame_analyzer_types.h"
// Capture configuration
typedef struct {
uint8_t bssid[6]; // Target AP BSSID
uint8_t ssid[33]; // Target AP SSID
uint8_t ssid_len; // SSID length
uint8_t channel; // Target channel
uint32_t timeout_sec; // Capture timeout in seconds
capture_method_t method; // Capture method
bool use_dual_radio; // Use both radios (if available)
uint8_t deauth_interval_ms; // Deauth packet interval (default 100ms)
uint8_t deauth_count; // Deauth packets per burst (default 5)
} capture_config_t;
// Capture status
typedef struct {
attack_state_t state;
handshake_state_t handshake_state;
bool handshake_captured;
bool pmkid_captured;
uint32_t packets_captured;
uint32_t eapol_packets;
uint32_t deauth_sent;
uint32_t elapsed_sec;
char target_ssid[33];
uint8_t target_bssid[6];
} capture_status_t;
// Initialize handshake capture module
void handshake_capture_init(void);
// Start handshake capture
bool handshake_capture_start(const capture_config_t *config);
// Start PMKID capture
bool pmkid_capture_start(const capture_config_t *config);
// Stop capture
bool handshake_capture_stop(void);
// Check if capture is running
bool handshake_capture_is_running(void);
// Get capture status
const capture_status_t* handshake_capture_get_status(void);
// Get captured handshake data
const handshake_data_t* handshake_capture_get_handshake(void);
// Get captured PMKIDs
pmkid_item_t* handshake_capture_get_pmkids(void);
// Get PCAP buffer for download
uint8_t* handshake_capture_get_pcap(unsigned *size);
// Get HCCAPX buffer for download
uint8_t* handshake_capture_get_hccapx(unsigned *size);
// Reset capture state
void handshake_capture_reset(void);
// Utility: Get AP record by SSID
const wifi_ap_record_t* handshake_capture_find_ap(const char *ssid);
// Utility: Scan and get AP list for target selection
int handshake_capture_scan_targets(void);
#endif // HANDSHAKE_CAPTURE_H