Politician 1.0.0
WiFi Auditing Library for ESP32
Loading...
Searching...
No Matches
politician::Politician Class Reference

The core WiFi handshake capturing engine. More...

#include <Politician.h>

Public Types

using EapolCb = void(*)(const HandshakeRecord &rec)
 
using ApFoundCb = void(*)(const ApRecord &ap)
 
using FilterCb = bool(*)(const ApRecord &ap)
 
using PacketCb = void(*)(const uint8_t *payload, uint16_t len, int8_t rssi, uint32_t ts_usec)
 
using IdentityCb = void(*)(const EapIdentityRecord &rec)
 

Public Member Functions

 Politician ()
 
Error begin (const Config &cfg=Config())
 Initializes the WiFi driver in promiscuous mode.
 
void setLogger (LogCb cb)
 Sets a custom logging callback to intercept library output.
 
void markCaptured (const uint8_t *bssid)
 Manually adds a BSSID to the "already captured" list to skip it.
 
void clearCapturedList ()
 Clears the captured BSSID list.
 
void setIgnoreList (const uint8_t(*bssids)[6], uint8_t count)
 Sets a list of BSSIDs that should always be ignored by the engine.
 
void setActive (bool active)
 Enables or disables frame processing.
 
Error setChannel (uint8_t ch)
 Manually sets the WiFi radio to a specific channel.
 
void startHopping (uint16_t dwellMs=0)
 Starts autonomous channel hopping.
 
void stopHopping ()
 Stops autonomous channel hopping and goes idle.
 
Error lockChannel (uint8_t ch)
 Stops hopping and locks the radio to a specific channel.
 
void setChannelList (const uint8_t *channels, uint8_t count)
 Restricts hopping to a specific list of channels.
 
void tick ()
 Main worker method.
 
void setAttackMask (uint8_t mask)
 Configures which attack techniques are enabled.
 
Error setTarget (const uint8_t *bssid, uint8_t channel)
 Focuses the engine on a single BSSID.
 
void clearTarget ()
 Clears the specific target and resumes autonomous wardriving.
 
bool hasTarget () const
 
uint8_t getChannel () const
 
bool isActive () const
 
int8_t getLastRssi () const
 
StatsgetStats ()
 
ConfiggetConfig ()
 
void setEapolCallback (EapolCb cb)
 Sets the callback for when a handshake (EAPOL or PMKID) is captured.
 
void setApFoundCallback (ApFoundCb cb)
 Sets the callback for when a new Access Point is discovered.
 
void setTargetFilter (FilterCb cb)
 Sets an early filter callback.
 
void setPacketLogger (PacketCb cb)
 Sets the callback for raw promiscuous mode packets.
 
void setIdentityCallback (IdentityCb cb)
 Sets the callback for passive 802.1X Enterprise Identity harvesting.
 

Detailed Description

The core WiFi handshake capturing engine.

Definition at line 89 of file Politician.h.

Member Typedef Documentation

◆ ApFoundCb

using politician::Politician::ApFoundCb = void (*)(const ApRecord &ap)

Definition at line 196 of file Politician.h.

◆ EapolCb

using politician::Politician::EapolCb = void (*)(const HandshakeRecord &rec)

Definition at line 195 of file Politician.h.

◆ FilterCb

using politician::Politician::FilterCb = bool (*)(const ApRecord &ap)

Definition at line 197 of file Politician.h.

◆ IdentityCb

Definition at line 199 of file Politician.h.

◆ PacketCb

using politician::Politician::PacketCb = void (*)(const uint8_t *payload, uint16_t len, int8_t rssi, uint32_t ts_usec)

Definition at line 198 of file Politician.h.

Constructor & Destructor Documentation

◆ Politician()

politician::Politician::Politician ( )

Definition at line 37 of file Politician.cpp.

Member Function Documentation

◆ begin()

Error politician::Politician::begin ( const Config cfg = Config())

Initializes the WiFi driver in promiscuous mode.

Parameters
cfgOptional configuration struct.
Returns
OK on success, or an error code.

Definition at line 82 of file Politician.cpp.

References politician::ERR_WIFI_INIT, and politician::OK.

Referenced by setup().

◆ clearCapturedList()

void politician::Politician::clearCapturedList ( )

Clears the captured BSSID list.

Definition at line 149 of file Politician.cpp.

◆ clearTarget()

void politician::Politician::clearTarget ( )

Clears the specific target and resumes autonomous wardriving.

Definition at line 213 of file Politician.cpp.

◆ getChannel()

uint8_t politician::Politician::getChannel ( ) const
inline
Returns
The current operating channel.

Definition at line 181 of file Politician.h.

◆ getConfig()

Config & politician::Politician::getConfig ( )
inline
Returns
Reference to the internal configuration struct for runtime mutations.

Definition at line 193 of file Politician.h.

◆ getLastRssi()

int8_t politician::Politician::getLastRssi ( ) const
inline
Returns
Signal strength (RSSI) of the last received frame.

Definition at line 187 of file Politician.h.

◆ getStats()

Stats & politician::Politician::getStats ( )
inline
Returns
Reference to the internal statistics counter.

Definition at line 190 of file Politician.h.

Referenced by loop().

◆ hasTarget()

bool politician::Politician::hasTarget ( ) const
inline
Returns
True if currently focusing on a specific target BSSID.

Definition at line 178 of file Politician.h.

◆ isActive()

bool politician::Politician::isActive ( ) const
inline
Returns
True if the engine is currently processing frames.

Definition at line 184 of file Politician.h.

◆ lockChannel()

Error politician::Politician::lockChannel ( uint8_t  ch)

Stops hopping and locks the radio to a specific channel.

Returns
OK on success, or an error code.

Definition at line 136 of file Politician.cpp.

References setChannel().

◆ markCaptured()

void politician::Politician::markCaptured ( const uint8_t *  bssid)

Manually adds a BSSID to the "already captured" list to skip it.

Definition at line 157 of file Politician.cpp.

◆ setActive()

void politician::Politician::setActive ( bool  active)

Enables or disables frame processing.

Definition at line 123 of file Politician.cpp.

Referenced by setup().

◆ setApFoundCallback()

void politician::Politician::setApFoundCallback ( ApFoundCb  cb)
inline

Sets the callback for when a new Access Point is discovered.

Definition at line 209 of file Politician.h.

Referenced by setup().

◆ setAttackMask()

void politician::Politician::setAttackMask ( uint8_t  mask)

Configures which attack techniques are enabled.

Definition at line 181 of file Politician.cpp.

References ATTACK_CSA, ATTACK_PASSIVE, and ATTACK_PMKID.

Referenced by setup().

◆ setChannel()

Error politician::Politician::setChannel ( uint8_t  ch)

Manually sets the WiFi radio to a specific channel.

Parameters
chChannel number (2.4GHz: 1-14, 5GHz: 36-165)
Returns
OK on success, ERR_INVALID_CH if ch is invalid.

Definition at line 129 of file Politician.cpp.

References politician::ERR_INVALID_CH, politician::isValidChannel(), and politician::OK.

Referenced by lockChannel().

◆ setChannelList()

void politician::Politician::setChannelList ( const uint8_t *  channels,
uint8_t  count 
)

Restricts hopping to a specific list of channels.

Parameters
channelsArray of channel numbers (2.4GHz: 1-14, 5GHz: 36-165)
countNumber of channels in array

Definition at line 219 of file Politician.cpp.

References politician::isValidChannel(), and POLITICIAN_MAX_CHANNELS.

◆ setEapolCallback()

void politician::Politician::setEapolCallback ( EapolCb  cb)
inline

Sets the callback for when a handshake (EAPOL or PMKID) is captured.

Definition at line 204 of file Politician.h.

Referenced by setup().

◆ setIdentityCallback()

void politician::Politician::setIdentityCallback ( IdentityCb  cb)
inline

Sets the callback for passive 802.1X Enterprise Identity harvesting.

Definition at line 224 of file Politician.h.

◆ setIgnoreList()

void politician::Politician::setIgnoreList ( const uint8_t(*)  bssids[6],
uint8_t  count 
)

Sets a list of BSSIDs that should always be ignored by the engine.

Definition at line 141 of file Politician.cpp.

◆ setLogger()

void politician::Politician::setLogger ( LogCb  cb)
inline

Sets a custom logging callback to intercept library output.

Definition at line 103 of file Politician.h.

◆ setPacketLogger()

void politician::Politician::setPacketLogger ( PacketCb  cb)
inline

Sets the callback for raw promiscuous mode packets.

Definition at line 219 of file Politician.h.

◆ setTarget()

Error politician::Politician::setTarget ( const uint8_t *  bssid,
uint8_t  channel 
)

Focuses the engine on a single BSSID.

Returns
OK on success, ERR_ALREADY_CAPTURED if BSSID is on the captured/ignore list.

Definition at line 188 of file Politician.cpp.

References politician::ERR_ALREADY_CAPTURED, and politician::OK.

◆ setTargetFilter()

void politician::Politician::setTargetFilter ( FilterCb  cb)
inline

Sets an early filter callback.

If it returns false, the AP is ignored completely.

Definition at line 214 of file Politician.h.

◆ startHopping()

void politician::Politician::startHopping ( uint16_t  dwellMs = 0)

Starts autonomous channel hopping.

Parameters
dwellMsTime in milliseconds to stay on each channel (0 = use config).

Definition at line 167 of file Politician.cpp.

References politician::Config::hop_dwell_ms.

Referenced by setup().

◆ stopHopping()

void politician::Politician::stopHopping ( )

Stops autonomous channel hopping and goes idle.

Definition at line 176 of file Politician.cpp.

◆ tick()

void politician::Politician::tick ( )

The documentation for this class was generated from the following files: