64 lines
1.9 KiB
C
64 lines
1.9 KiB
C
/**
|
|
* @file hccapx_serializer.h
|
|
* @brief HCCAPX file serializer for Hashcat compatibility
|
|
*
|
|
* Reference: https://hashcat.net/wiki/doku.php?id=hccapx
|
|
*/
|
|
#ifndef HCCAPX_SERIALIZER_H
|
|
#define HCCAPX_SERIALIZER_H
|
|
|
|
#include <stdint.h>
|
|
#include "frame_analyzer_types.h"
|
|
|
|
// HCCAPX structure (393 bytes per record)
|
|
typedef struct __attribute__((packed)) {
|
|
uint32_t signature; // "HCPX" = 0x58504348
|
|
uint32_t version; // Version 4
|
|
uint8_t message_pair; // Message pair bitmask
|
|
uint8_t essid_len; // SSID length
|
|
uint8_t essid[32]; // SSID
|
|
uint8_t keyver; // WPA/WPA2 key version
|
|
uint8_t keymic[16]; // Key MIC
|
|
uint8_t mac_ap[6]; // AP MAC address
|
|
uint8_t nonce_ap[32]; // ANonce
|
|
uint8_t mac_sta[6]; // Station MAC address
|
|
uint8_t nonce_sta[32]; // SNonce
|
|
uint16_t eapol_len; // EAPOL length
|
|
uint8_t eapol[256]; // EAPOL packet
|
|
} hccapx_t;
|
|
|
|
// Message Pair Values:
|
|
// 0 = M1+M2, first, only good if PMK == 0
|
|
// 1 = M1+M4 (real)
|
|
// 2 = M2+M3, first, only good if PMK == 0
|
|
// 3 = M2+M3
|
|
// 4 = M3+M4, first
|
|
// 5 = M3+M4
|
|
|
|
// Key version
|
|
#define HCCAPX_KEYVER_WPA 1
|
|
#define HCCAPX_KEYVER_WPA2 2
|
|
|
|
// Initialize HCCAPX serializer with SSID
|
|
void hccapx_serializer_init(const uint8_t *ssid, unsigned ssid_len);
|
|
|
|
// Add frame to HCCAPX (processes handshake messages)
|
|
void hccapx_serializer_add_frame(data_frame_t *frame);
|
|
|
|
// Build HCCAPX from captured handshake data
|
|
void hccapx_serializer_build(const handshake_data_t *handshake);
|
|
|
|
// Get HCCAPX structure (NULL if not complete)
|
|
hccapx_t* hccapx_serializer_get(void);
|
|
|
|
// Get HCCAPX buffer size
|
|
unsigned hccapx_serializer_get_size(void);
|
|
|
|
// Check if HCCAPX is valid/complete
|
|
bool hccapx_serializer_is_valid(void);
|
|
|
|
// Reset HCCAPX serializer
|
|
void hccapx_serializer_reset(void);
|
|
|
|
#endif // HCCAPX_SERIALIZER_H
|