10#include <tins/network_interface.h>
11#include <tins/sniffer.h>
12#include <unordered_map>
33 Sniffer(std::unique_ptr<Tins::FileSniffer> sniffer,
34 const std::filesystem::path &filepath,
Database &db);
41 Sniffer(std::unique_ptr<Tins::Sniffer> sniffer,
69 std::optional<std::shared_ptr<AccessPoint>>
get_network(
const SSID &ssid);
77 std::optional<std::shared_ptr<AccessPoint>>
107 std::optional<std::string>
iface();
113 std::optional<std::filesystem::path>
file();
148 std::optional<Recording::info>
150 const std::string &name);
158 std::optional<Recording::info>
160 const std::string &name);
167 static std::vector<Recording::info>
178 static std::optional<std::string>
180 const std::string &ifname);
193 bool handle_pkt(Tins::Packet &pkt);
200 bool handle_data(Tins::Packet &pkt);
207 bool handle_management(Tins::Packet &pkt);
215 Tins::Packet *save_pkt(Tins::Packet &pkt);
223 void hopper(
int phy_idx,
const std::vector<uint32_t> &channels);
225 std::shared_ptr<spdlog::logger> logger;
226 std::list<Tins::Packet> packets;
227 std::atomic<ScanMode> scan_mode =
GENERAL;
231 bool filemode =
true;
233 int current_channel = 1;
234 std::unique_ptr<Tins::Crypto::WPA2Decrypter> decrypter;
235 std::unordered_map<MACAddress, std::shared_ptr<AccessPoint>> aps;
236 Tins::NetworkInterface send_iface;
237 std::string iface_name =
"";
238 std::filesystem::path filepath;
239 std::unordered_map<MACAddress, SSID> ignored_nets;
240 std::set<MACAddress> ignored_nets_bssid_only;
241 std::set<SSID> ignored_nets_ssid_only;
242 std::unique_ptr<Tins::BaseSniffer> sniffer;
243 std::atomic<bool> finished;
Manager for network card information gathering and state control.
Definition net_card_manager.h:58
void disconnect()
Definition net_card_manager.cpp:88
Packet sniffer and handler in charge of tracking, information gathering and decrypting passing data.
Definition sniffer.h:24
std::optional< Recording::info > save_decrypted_traffic(const std::filesystem::path &save_path, const std::string &name)
Definition sniffer.cpp:277
std::optional< std::shared_ptr< AccessPoint > > get_network(const SSID &ssid)
Definition sniffer.cpp:122
std::optional< Recording::info > save_traffic(const std::filesystem::path &saves_path, const std::string &name)
Definition sniffer.cpp:215
void stop_focus()
Definition sniffer.cpp:207
std::set< network_name > all_networks()
Definition sniffer.cpp:107
std::optional< std::shared_ptr< AccessPoint > > focused_network()
Definition sniffer.cpp:199
~Sniffer()
Definition sniffer.h:182
std::optional< uint32_t > focus_network(const SSID &ssid)
Definition sniffer.cpp:182
Sniffer(std::unique_ptr< Tins::FileSniffer > sniffer, const std::filesystem::path &filepath, Database &db)
Definition sniffer.cpp:25
std::optional< MACAddress > get_bssid(const SSID &ssid)
Definition sniffer.cpp:114
static std::vector< Recording::info > available_recordings(const std::filesystem::path &save_path)
void add_ignored_network(const SSID &ssid)
Definition sniffer.cpp:136
std::optional< std::filesystem::path > file()
Definition sniffer.cpp:176
std::unordered_map< MACAddress, SSID > ignored_networks()
Definition sniffer.cpp:160
std::pair< MACAddress, SSID > network_name
Definition sniffer.h:26
static MACAddress NoAddress
Definition sniffer.h:27
static std::optional< std::string > detect_interface(std::shared_ptr< spdlog::logger > log, const std::string &ifname)
Definition sniffer.cpp:462
std::optional< std::string > iface()
Definition sniffer.cpp:170
void shutdown()
Definition sniffer.cpp:164
void start()
Definition sniffer.cpp:46
Definition access_point.cpp:22
std::string SSID
Definition decrypter.h:19
ScanMode
Definition sniffer.h:15
@ GENERAL
Definition sniffer.h:17
@ FOCUSED
Definition sniffer.h:16
Tins::HWAddress< 6 > MACAddress
Definition decrypter.h:20