6#include <spdlog/logger.h>
7#include <tins/crypto.h>
10#include <tins/hw_address.h>
11#include <tins/packet.h>
14#include <tins/timestamp.h>
72 bool decrypt(Tins::Packet *pkt);
113 std::optional<client_window>
122 std::optional<std::vector<client_window>>
153 static std::string
readable_hex(
const std::vector<uint8_t> &vec);
162 bool decrypt_unicast(Tins::Packet *pkt,
const MACAddress &client);
170 bool handle_pairwise_eapol(Tins::Packet *pkt,
const MACAddress &client);
178 bool handle_group_eapol(Tins::Packet *pkt,
const MACAddress &client);
194 bool decrypt_group(Tins::Packet *pkt);
202 void try_insert_gtk(
const gtk_type >k,
const Tins::Timestamp &ts);
211 Tins::SNAP *decrypt_group_data(
const Tins::Dot11Data &data, Tins::RawPDU &raw,
222 std::optional<gtk_type> exctract_key_data(
const Tins::RSNEAPOL &eapol,
230 static std::optional<uint8_t>
231 eapol_pairwise_hs_num(
const Tins::RSNEAPOL &eapol);
238 static std::optional<uint8_t> eapol_group_hs_num(
const Tins::RSNEAPOL &eapol);
240 std::shared_ptr<spdlog::logger> logger;
241 std::unordered_map<MACAddress, Tins::Packet *> group_rekey_first_messages;
242 std::unordered_map<MACAddress, std::vector<Tins::Packet *>> client_handshakes;
245 std::string psk =
"";
246 bool working_psk =
false;
247 std::unordered_map<MACAddress, std::vector<client_window>> client_windows;
248 std::vector<group_window> group_windows;
249 Tins::Crypto::WPA2Decrypter unicast_decrypter;
Decrypts unicast, multicast and broadcast WPA2 packets.
Definition decrypter.h:25
WPA2Decrypter(const MACAddress &bssid, const SSID &ssid)
Definition decrypter.cpp:16
void add_password(const std::string &psk)
Definition decrypter.cpp:52
std::optional< std::string > extract_hc22000(const client_window &client)
Definition decrypter.cpp:110
std::optional< std::string > get_password() const
Definition decrypter.cpp:70
bool can_generate_keys() const
Definition decrypter.cpp:43
std::optional< std::vector< client_window > > get_all_client_windows(const MACAddress &client)
Definition decrypter.cpp:91
std::vector< uint8_t > gtk_type
Definition decrypter.h:28
group_window get_current_group_window() const
Definition decrypter.cpp:97
bool decrypt(Tins::Packet *pkt)
Definition decrypter.cpp:21
std::vector< group_window > get_all_group_windows() const
Definition decrypter.cpp:101
uint32_t count_all_group_windows() const
Definition decrypter.cpp:105
bool has_working_password() const
Definition decrypter.cpp:68
static std::string readable_hex(const std::vector< uint8_t > &vec)
Definition decrypter.cpp:179
std::vector< uint8_t > ptk_type
Definition decrypter.h:27
std::set< MACAddress > get_clients() const
Definition decrypter.cpp:76
std::optional< client_window > get_current_client_window(const MACAddress &client)
Definition decrypter.cpp:84
Definition access_point.cpp:22
std::string SSID
Definition decrypter.h:19
Tins::HWAddress< 6 > MACAddress
Definition decrypter.h:20
Represents a client window for tracking packet data within an encryption window. This window is defin...
Definition decrypter.h:35
std::vector< Tins::Packet * > auth_packets
Definition decrypter.h:42
std::vector< Tins::Packet * > packets
Definition decrypter.h:41
MACAddress client
Definition decrypter.h:40
bool ended
Definition decrypter.h:38
bool decrypted
Definition decrypter.h:39
ptk_type ptk
Definition decrypter.h:43
Tins::Timestamp start
Definition decrypter.h:36
Tins::Timestamp end
Definition decrypter.h:37
Represents a group window for tracking multicast packet data. This window is defined as the state bet...
Definition decrypter.h:50
std::vector< Tins::Packet * > packets
Definition decrypter.h:55
Tins::Timestamp start
Definition decrypter.h:51
gtk_type gtk
Definition decrypter.h:57
bool ended
Definition decrypter.h:53
Tins::Timestamp end
Definition decrypter.h:52
std::vector< Tins::Packet * > auth_packets
Definition decrypter.h:56
bool decrypted
Definition decrypter.h:54