Politician 1.0.0
WiFi Auditing Library for ESP32
Loading...
Searching...
No Matches
PoliticianFormat.h
Go to the documentation of this file.
1#pragma once
2#include <string>
3#include "politician_compat.h"
4#include "PoliticianTypes.h"
5
6namespace politician {
7namespace format {
8
9/**
10 * @brief Converts a captured HandshakeRecord into the Hashcat 22000 (hc22000) text format.
11 *
12 * The hc22000 format is an easily copyable string compatible with Hashcat and other modern cracking tools.
13 *
14 * @param rec The handshake record.
15 * @return String containing the HC22000 line, or an empty string if unsupported.
16 */
17std::string toHC22000(const HandshakeRecord& rec);
18
19/**
20 * @brief Writes a PCAPNG Global Header (SHB + IDB).
21 *
22 * This must be written exactly once at the beginning of a `.pcapng` file.
23 *
24 * @param buffer Output buffer (must be at least 48 bytes).
25 * @return Number of bytes written (always 48).
26 */
27size_t writePcapngGlobalHeader(uint8_t* buffer);
28
29/**
30 * @brief Serializes a HandshakeRecord into PCAPNG Enhanced Packet Blocks.
31 *
32 * @param rec The handshake record.
33 * @param buffer Output buffer.
34 * @param max_len Maximum length of the buffer. Recommended: 1024 bytes.
35 * @return Number of bytes written, or 0 if buffer is too small.
36 */
37size_t writePcapngRecord(const HandshakeRecord& rec, uint8_t* buffer, size_t max_len);
38
39/**
40 * @brief Serializes a Raw 802.11 Frame into a PCAPNG Enhanced Packet Block.
41 *
42 * @param payload Raw 802.11 frame.
43 * @param payload_len Length of the raw frame.
44 * @param rssi Signal strength.
45 * @param channel WiFi channel.
46 * @param ts_usec Hardware microsecond timestamp.
47 * @param buffer Output buffer.
48 * @param max_len Maximum length of the buffer.
49 * @return Number of bytes written, or 0 if buffer is too small.
50 */
51size_t writePcapngPacket(const uint8_t* payload, size_t payload_len, int8_t rssi, uint8_t channel, uint64_t ts_usec, uint8_t* buffer, size_t max_len);
52
53} // namespace format
54} // namespace politician
size_t writePcapngPacket(const uint8_t *payload, size_t payload_len, int8_t rssi, uint8_t channel, uint64_t ts_usec, uint8_t *buffer, size_t max_len)
Serializes a Raw 802.11 Frame into a PCAPNG Enhanced Packet Block.
std::string toHC22000(const HandshakeRecord &rec)
Converts a captured HandshakeRecord into the Hashcat 22000 (hc22000) text format.
size_t writePcapngRecord(const HandshakeRecord &rec, uint8_t *buffer, size_t max_len)
Serializes a HandshakeRecord into PCAPNG Enhanced Packet Blocks.
size_t writePcapngGlobalHeader(uint8_t *buffer)
Writes a PCAPNG Global Header (SHB + IDB).