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