Politician 1.0.0
WiFi Auditing Library for ESP32
Loading...
Searching...
No Matches
PoliticianTypes.h File Reference
#include <stdint.h>
#include "politician_compat.h"
#include <functional>
+ Include dependency graph for PoliticianTypes.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  politician::Config
 Configuration for the Politician engine. More...
 
struct  politician::ApRecord
 Snapshot of a discovered Access Point from the internal cache. More...
 
struct  politician::Stats
 Cumulative frame and capture counters for the engine session. More...
 
struct  politician::HandshakeRecord
 A captured handshake or PMKID record delivered to the EapolCb callback. More...
 
struct  politician::AttackResultRecord
 Identifies the AP and failure reason for a failed attack, delivered to the AttackResultCb callback. More...
 
struct  politician::ClientRecord
 Snapshot of a client station observed associated with an AP. More...
 
struct  politician::RogueApRecord
 Fired when a second BSSID advertising the same SSID is observed on the same channel. More...
 
struct  politician::KarmaRecord
 Delivered to the KarmaCb callback when the KARMA responder replies to a named probe request. More...
 
struct  politician::EapIdentityRecord
 A harvested 802.1X Enterprise plaintext identity, delivered to the IdentityCb callback. More...
 
struct  politician::ProbeRequestRecord
 A probe request frame observed on the air, delivered to the ProbeRequestCb callback. More...
 
struct  politician::DisruptRecord
 A deauthentication or disassociation frame observed on the air, delivered to the DisruptCb callback. More...
 
struct  politician::WpsRecord
 WPS M1 device attributes harvested from an EAP-WSC exchange. More...
 
struct  politician::MsChapRecord
 Bare EAP-MSCHAPv2 challenge/response pair harvested passively. More...
 
struct  politician::DeviceFingerprint
 One fingerprint entry in the built-in or user-defined database. More...
 
struct  politician::DeviceRecord
 A matched device, delivered to the DeviceFoundCb callback. More...
 
union  politician::HandshakeRecord.__unnamed3__
 
union  politician::HandshakeRecord.__unnamed5__
 

Namespaces

namespace  politician
 

Macros

#define CAP_PMKID   0x01
 
#define CAP_EAPOL   0x02
 
#define CAP_EAPOL_CSA   0x03
 
#define CAP_EAPOL_HALF   0x04
 
#define CAP_EAPOL_GROUP   0x05
 
#define CAP_SAE   0x06
 
#define ENC_OPEN   0
 
#define ENC_WEP   1
 
#define ENC_WPA   2
 
#define ENC_WPA2   3
 
#define ENC_ENT   4
 
#define ENC_OWE   5
 
#define ATTACK_PMKID   0x01
 
#define ATTACK_CSA   0x02
 
#define ATTACK_PASSIVE   0x04
 
#define ATTACK_DEAUTH   0x08
 
#define ATTACK_STIMULATE   0x10
 
#define ATTACK_BTM   0x20
 
#define ATTACK_ALL   0x3F
 
#define LOG_FILTER_HANDSHAKES   0x01
 
#define LOG_FILTER_PROBES   0x02
 
#define LOG_FILTER_BEACONS   0x04
 
#define LOG_FILTER_PROBE_REQ   0x08
 
#define LOG_FILTER_MGMT_DISRUPT   0x10
 
#define LOG_FILTER_ALL   0xFF
 
#define FP_MATCH_OUI   0x01
 
#define FP_MATCH_PROBE_SSID   0x02
 
#define FP_MATCH_HT_CAP   0x04
 
#define FP_MATCH_RATES   0x08
 
#define FP_MATCH_IE_FLAGS   0x10
 
#define FP_IEF_NO_HT   0x01
 
#define FP_IEF_NO_EXT_CAP   0x02
 
#define FP_IEF_HAS_WMM   0x04
 
#define FP_IEF_HAS_WPS   0x08
 

Typedefs

using politician::LogCb = std::function< void(const char *msg)>
 
typedef void(* politician::ApFoundCb) (const ApRecord &ap)
 
typedef int(* politician::TargetScoreCb) (const ApRecord &ap, const char *vendor)
 
typedef void(* politician::PacketCb) (const uint8_t *payload, uint16_t len, int8_t rssi, uint8_t channel, uint32_t ts_usec)
 
typedef void(* politician::EapolCb) (const HandshakeRecord &rec)
 
typedef void(* politician::IdentityCb) (const EapIdentityRecord &rec)
 
typedef void(* politician::ProbeRequestCb) (const ProbeRequestRecord &rec)
 
typedef void(* politician::DisruptCb) (const DisruptRecord &rec)
 
typedef void(* politician::WpsCb) (const WpsRecord &rec)
 
typedef void(* politician::MsChapCb) (const MsChapRecord &rec)
 
typedef void(* politician::AttackResultCb) (const AttackResultRecord &rec)
 
typedef void(* politician::ClientFoundCb) (const ClientRecord &rec)
 
using politician::RogueApCb = std::function< void(const RogueApRecord &rec)>
 
using politician::KarmaCb = std::function< void(const KarmaRecord &rec)>
 

Enumerations

enum  politician::Error {
  politician::OK = 0 ,
  politician::ERR_WIFI_INIT = 1 ,
  politician::ERR_INVALID_CH = 2 ,
  politician::ERR_NOT_ACTIVE = 3 ,
  politician::ERR_ALREADY_CAPTURED = 4 ,
  politician::ERR_NOT_FOUND = 5 ,
  politician::ERR_MAX_INSTANCES = 6 ,
  politician::ERR_INVALID_ARG = 7 ,
  politician::ERR_QUEUE_FULL = 8
}
 
enum  politician::DisconnectStrategy : uint8_t {
  politician::STRATEGY_AUTO_FALLBACK = 0 ,
  politician::STRATEGY_SIMULTANEOUS = 1
}
 
enum  politician::AttackResult : uint8_t {
  politician::RESULT_PMKID_EXHAUSTED = 1 ,
  politician::RESULT_CSA_EXPIRED = 2
}
 

Functions

int politician::validateConfig (const Config &cfg, const char **out, uint8_t maxOut)
 Validates a Config struct and returns human-readable warning strings for values that will be silently clamped or that may cause unexpected behavior.
 

Variables

static const uint8_t politician::CIPHER_UNKNOWN = 0
 
static const uint8_t politician::CIPHER_TKIP = 1
 TKIP (00-0F-AC:2) — legacy, crackable offline.
 
static const uint8_t politician::CIPHER_CCMP = 2
 CCMP/AES (00-0F-AC:4) — current standard.
 
static const uint8_t politician::EAP_METHOD_IDENTITY = 0x01
 EAP Identity (always 0x01 for harvested records)
 
static const uint8_t politician::EAP_METHOD_TLS = 0x0D
 EAP-TLS (RFC 5216) — mutual cert auth.
 
static const uint8_t politician::EAP_METHOD_TTLS = 0x15
 EAP-TTLS (RFC 5281) — outer tunnel, inner MSCHAPv2.
 
static const uint8_t politician::EAP_METHOD_PEAP = 0x19
 PEAP (draft-josefsson-pppext-eap-tls-eap) — outer tunnel.
 
static const uint8_t politician::EAP_METHOD_MSCHAPV2 = 0x1A
 Bare EAP-MSCHAPv2 (no tunnel — crackable)
 

Class Documentation

◆ politician::Config

struct politician::Config

Configuration for the Politician engine.

Definition at line 106 of file PoliticianTypes.h.

Class Members
uint32_t ap_expiry_ms = 300000
uint8_t btm_burst_count = 8
uint16_t btm_disassoc_timer = 3
uint8_t capture_filter = LOG_FILTER_HANDSHAKES | LOG_FILTER_PROBES
bool capture_group_keys = false
bool capture_half_handshakes = false
uint8_t csa_beacon_count = 8
uint8_t csa_deauth_count = 15
uint32_t csa_wait_ms = 4000
uint8_t deauth_burst_count = 16
uint8_t deauth_reason = 7
bool deauth_reason_cycling = true
uint8_t enc_filter_mask = 0xFF
uint8_t fish_max_retries = 2
uint32_t fish_timeout_ms = 2000
uint16_t hop_dwell_ms = 200
uint16_t hop_max_dwell_ms = 400
uint16_t hop_min_dwell_ms = 50
bool karma_enabled = false
uint8_t karma_max_ssids = 16
bool karma_open_only = true
uint32_t m1_lock_ms = 800
uint8_t max_total_attempts = 0
uint8_t min_beacon_count = 0
int8_t min_rssi = -100
uint16_t probe_aggr_interval_s = 30
uint32_t probe_hidden_interval_ms = 0
bool require_active_clients = false
uint32_t session_timeout_ms = 60000
bool skip_immune_networks = true
bool smart_hopping = true
const char * soft_ap_ssid = nullptr
char ssid_filter[33] = {}
bool ssid_filter_exact = true
uint8_t sta_filter[6] = {}
bool unicast_deauth = true

◆ politician::ApRecord

struct politician::ApRecord

Snapshot of a discovered Access Point from the internal cache.

Populated by getAp(), getApByBssid(), and the ApFoundCb callback.

Definition at line 189 of file PoliticianTypes.h.

Class Members
uint16_t beacon_count Number of beacons observed from this AP in the current session.
uint16_t beacon_interval
uint8_t bssid[6]
uint8_t capture_count Number of successful handshake/PMKID captures for this BSSID.
bool captured
uint8_t chan_util
uint8_t chan_width
uint8_t channel
char country[3]
uint8_t enc
uint32_t first_seen_ms
bool ft_capable
bool is_he
bool is_hidden
bool is_vht
uint32_t last_attack_ms millis() of the most recent attack initiation (0 = never attacked)
uint32_t last_seen_ms
uint8_t max_rate_mbps
uint8_t network_type
bool pmf_capable
bool pmf_required
int8_t rssi
char ssid[33]
uint8_t ssid_len
uint16_t sta_count
uint8_t total_attempts
uint8_t venue_group
uint8_t venue_type
bool wps_enabled

◆ politician::Stats

struct politician::Stats

Cumulative frame and capture counters for the engine session.

Accessible via getStats(), reset with resetStats().

Definition at line 223 of file PoliticianTypes.h.

Class Members
uint32_t beacons
uint32_t captures
uint16_t channel_frames[200]
uint32_t ctrl
uint32_t data
volatile uint32_t dropped
uint32_t eapol
uint32_t failed_csa
uint32_t failed_pmkid
uint32_t mgmt
uint32_t pmkid_found
uint32_t rb_max
uint32_t sae_found
uint32_t total

◆ politician::HandshakeRecord

struct politician::HandshakeRecord

A captured handshake or PMKID record delivered to the EapolCb callback.

The type field identifies the capture path; fields not relevant to that path are zeroed.

Definition at line 247 of file PoliticianTypes.h.

Class Members
union HandshakeRecord.__unnamed3__ __unnamed__
union HandshakeRecord.__unnamed5__ __unnamed__
uint8_t anonce[32]
uint8_t bssid[6]
uint8_t channel
uint8_t cipher Pairwise cipher suite: CIPHER_TKIP / CIPHER_CCMP / CIPHER_UNKNOWN.
uint8_t eapol_m3[256]
uint16_t eapol_m3_len
uint8_t eapol_m4[256]
uint16_t eapol_m4_len
uint8_t enc
bool has_anonce
bool has_m3
bool has_m4
bool has_mic
bool has_snonce
bool is_full
uint8_t mic[16]
uint8_t pmkid[16]
int8_t rssi
uint8_t sae_seq
uint8_t snonce[32]
char ssid[33]
uint8_t ssid_len
uint8_t sta[6]
uint8_t type

◆ politician::AttackResultRecord

struct politician::AttackResultRecord

Identifies the AP and failure reason for a failed attack, delivered to the AttackResultCb callback.

Definition at line 297 of file PoliticianTypes.h.

Class Members
uint8_t bssid[6]
AttackResult result
char ssid[33]
uint8_t ssid_len

◆ politician::ClientRecord

struct politician::ClientRecord

Snapshot of a client station observed associated with an AP.

Delivered to the ClientFoundCb callback and enriched with vendor lookup, timing, and MAC-randomization detection.

Definition at line 311 of file PoliticianTypes.h.

Class Members
uint8_t bssid[6] BSSID of the AP this client is associated with.
uint32_t first_seen_ms millis() when this client was first seen on this BSSID
uint32_t last_seen_ms millis() of the most recent frame from this client
bool rand_mac True if the locally administered bit is set (MAC randomization)
int8_t rssi Signal strength at time of observation (dBm)
uint8_t sta[6] Client (station) MAC address.
char vendor[32] OUI vendor string; empty if POLITICIAN_NO_DB is defined.

◆ politician::RogueApRecord

struct politician::RogueApRecord

Fired when a second BSSID advertising the same SSID is observed on the same channel.

This indicates a potential evil twin or rogue AP. Both the known AP and the newcomer are included.

Definition at line 327 of file PoliticianTypes.h.

Class Members
uint8_t channel
uint8_t known_bssid[6]
uint8_t rogue_bssid[6]
int8_t rssi
char ssid[33]
uint8_t ssid_len

◆ politician::KarmaRecord

struct politician::KarmaRecord

Delivered to the KarmaCb callback when the KARMA responder replies to a named probe request.

Contains the client that probed and the SSID that was echoed.

The engine injects a probe response and one beacon spoofed as an AP with that exact SSID and an open authentication mode, enticing the client to auto-associate.

Definition at line 352 of file PoliticianTypes.h.

Class Members
uint8_t ap_mac[6]
uint8_t channel
uint8_t client[6]
int8_t rssi
char ssid[33]
uint8_t ssid_len

◆ politician::EapIdentityRecord

struct politician::EapIdentityRecord

A harvested 802.1X Enterprise plaintext identity, delivered to the IdentityCb callback.

Definition at line 377 of file PoliticianTypes.h.

Class Members
uint8_t bssid[6]
uint8_t channel
uint8_t client[6]
uint8_t eap_method EAP method negotiated by the AP (EAP_METHOD_* constant); 0 if not yet observed.
char identity[65]
int8_t rssi

◆ politician::ProbeRequestRecord

struct politician::ProbeRequestRecord

A probe request frame observed on the air, delivered to the ProbeRequestCb callback.

Definition at line 388 of file PoliticianTypes.h.

Class Members
uint8_t channel
uint8_t client[6]
bool rand_mac
int8_t rssi
char ssid[33]
uint8_t ssid_len

◆ politician::DisruptRecord

struct politician::DisruptRecord

A deauthentication or disassociation frame observed on the air, delivered to the DisruptCb callback.

Definition at line 399 of file PoliticianTypes.h.

Class Members
uint8_t bssid[6]
uint8_t channel
uint8_t dst[6]
bool rand_mac
uint16_t reason
int8_t rssi
uint8_t src[6]
uint8_t subtype

◆ politician::WpsRecord

struct politician::WpsRecord

WPS M1 device attributes harvested from an EAP-WSC exchange.

Delivered to the WpsCb callback when a WPS Enrollee sends its M1 message. Only M1 (Enrollee → AP) is unencrypted; subsequent messages cannot be parsed passively.

Definition at line 416 of file PoliticianTypes.h.

Class Members
uint16_t auth_type_flags
uint8_t bssid[6]
uint8_t channel
uint16_t config_methods
char device_name[33]
char manufacturer[65]
char model_name[33]
char model_number[33]
uint16_t primary_dev_type_cat
uint8_t rf_bands
int8_t rssi
char serial_number[33]
uint8_t sta[6]

◆ politician::MsChapRecord

struct politician::MsChapRecord

Bare EAP-MSCHAPv2 challenge/response pair harvested passively.

Only available when the AP serves MSCHAPv2 without a TLS tunnel (no PEAP/TTLS). The nt_response can be cracked offline with tools like asleap or hashcat (-m 5500).

Crack with hashcat: echo "username::::peer_challenge_hex:nt_response_hex:server_challenge_hex" | hashcat -m 5500

Definition at line 442 of file PoliticianTypes.h.

Class Members
uint8_t bssid[6]
uint8_t channel
uint8_t nt_response[24]
uint8_t peer_challenge[16]
int8_t rssi
uint8_t server_challenge[16]
uint8_t sta[6]
char username[65]

◆ politician::DeviceFingerprint

struct politician::DeviceFingerprint

One fingerprint entry in the built-in or user-defined database.

Definition at line 470 of file PoliticianTypes.h.

Class Members
uint8_t confidence
uint8_t ht_cap_info[2]
uint8_t ht_cap_mask[2]
uint8_t ie_flags
uint8_t ie_flags_mask
const char * model
uint8_t oui[3]
const char * probeSsid
uint8_t rate_sig[4]
const char * vendor

◆ politician::DeviceRecord

struct politician::DeviceRecord

A matched device, delivered to the DeviceFoundCb callback.

Definition at line 485 of file PoliticianTypes.h.

Class Members
uint8_t channel
uint8_t confidence
uint8_t mac[6]
uint8_t match_flags
char model[32]
int8_t rssi
char vendor[32]

◆ politician::HandshakeRecord.__unnamed3__

union politician::HandshakeRecord.__unnamed3__

Definition at line 263 of file PoliticianTypes.h.

Class Members
uint8_t eapol_m2[256]
uint8_t sae_data[256]

◆ politician::HandshakeRecord.__unnamed5__

union politician::HandshakeRecord.__unnamed5__

Definition at line 269 of file PoliticianTypes.h.

Class Members
uint16_t eapol_m2_len
uint16_t sae_len

Macro Definition Documentation

◆ ATTACK_ALL

#define ATTACK_ALL   0x3F

Definition at line 45 of file PoliticianTypes.h.

◆ ATTACK_BTM

#define ATTACK_BTM   0x20

Definition at line 44 of file PoliticianTypes.h.

◆ ATTACK_CSA

#define ATTACK_CSA   0x02

Definition at line 40 of file PoliticianTypes.h.

◆ ATTACK_DEAUTH

#define ATTACK_DEAUTH   0x08

Definition at line 42 of file PoliticianTypes.h.

◆ ATTACK_PASSIVE

#define ATTACK_PASSIVE   0x04

Definition at line 41 of file PoliticianTypes.h.

◆ ATTACK_PMKID

#define ATTACK_PMKID   0x01

Definition at line 39 of file PoliticianTypes.h.

◆ ATTACK_STIMULATE

#define ATTACK_STIMULATE   0x10

Definition at line 43 of file PoliticianTypes.h.

◆ CAP_EAPOL

#define CAP_EAPOL   0x02

Definition at line 23 of file PoliticianTypes.h.

◆ CAP_EAPOL_CSA

#define CAP_EAPOL_CSA   0x03

Definition at line 24 of file PoliticianTypes.h.

◆ CAP_EAPOL_GROUP

#define CAP_EAPOL_GROUP   0x05

Definition at line 26 of file PoliticianTypes.h.

◆ CAP_EAPOL_HALF

#define CAP_EAPOL_HALF   0x04

Definition at line 25 of file PoliticianTypes.h.

◆ CAP_PMKID

#define CAP_PMKID   0x01

Definition at line 22 of file PoliticianTypes.h.

◆ CAP_SAE

#define CAP_SAE   0x06

Definition at line 27 of file PoliticianTypes.h.

◆ ENC_ENT

#define ENC_ENT   4

Definition at line 35 of file PoliticianTypes.h.

◆ ENC_OPEN

#define ENC_OPEN   0

Definition at line 31 of file PoliticianTypes.h.

◆ ENC_OWE

#define ENC_OWE   5

Definition at line 36 of file PoliticianTypes.h.

◆ ENC_WEP

#define ENC_WEP   1

Definition at line 32 of file PoliticianTypes.h.

◆ ENC_WPA

#define ENC_WPA   2

Definition at line 33 of file PoliticianTypes.h.

◆ ENC_WPA2

#define ENC_WPA2   3

Definition at line 34 of file PoliticianTypes.h.

◆ FP_IEF_HAS_WMM

#define FP_IEF_HAS_WMM   0x04

Definition at line 466 of file PoliticianTypes.h.

◆ FP_IEF_HAS_WPS

#define FP_IEF_HAS_WPS   0x08

Definition at line 467 of file PoliticianTypes.h.

◆ FP_IEF_NO_EXT_CAP

#define FP_IEF_NO_EXT_CAP   0x02

Definition at line 465 of file PoliticianTypes.h.

◆ FP_IEF_NO_HT

#define FP_IEF_NO_HT   0x01

Definition at line 464 of file PoliticianTypes.h.

◆ FP_MATCH_HT_CAP

#define FP_MATCH_HT_CAP   0x04

Definition at line 459 of file PoliticianTypes.h.

◆ FP_MATCH_IE_FLAGS

#define FP_MATCH_IE_FLAGS   0x10

Definition at line 461 of file PoliticianTypes.h.

◆ FP_MATCH_OUI

#define FP_MATCH_OUI   0x01

Definition at line 457 of file PoliticianTypes.h.

◆ FP_MATCH_PROBE_SSID

#define FP_MATCH_PROBE_SSID   0x02

Definition at line 458 of file PoliticianTypes.h.

◆ FP_MATCH_RATES

#define FP_MATCH_RATES   0x08

Definition at line 460 of file PoliticianTypes.h.

◆ LOG_FILTER_ALL

#define LOG_FILTER_ALL   0xFF

Definition at line 57 of file PoliticianTypes.h.

◆ LOG_FILTER_BEACONS

#define LOG_FILTER_BEACONS   0x04

Definition at line 54 of file PoliticianTypes.h.

◆ LOG_FILTER_HANDSHAKES

#define LOG_FILTER_HANDSHAKES   0x01

Definition at line 52 of file PoliticianTypes.h.

◆ LOG_FILTER_MGMT_DISRUPT

#define LOG_FILTER_MGMT_DISRUPT   0x10

Definition at line 56 of file PoliticianTypes.h.

◆ LOG_FILTER_PROBE_REQ

#define LOG_FILTER_PROBE_REQ   0x08

Definition at line 55 of file PoliticianTypes.h.

◆ LOG_FILTER_PROBES

#define LOG_FILTER_PROBES   0x02

Definition at line 53 of file PoliticianTypes.h.