Yarilo v0.9.9
WPA2 Decrypter & Packet Analyzer
Loading...
Searching...
No Matches
yarilo::Sniffer Class Reference

Packet sniffer and handler in charge of tracking, information gathering and decrypting passing data. More...

#include <sniffer.h>

Public Types

typedef std::pair< MACAddress, SSIDnetwork_name
 

Public Member Functions

 Sniffer (std::unique_ptr< Tins::FileSniffer > sniffer, const std::filesystem::path &filepath, Database &db)
 
 Sniffer (std::unique_ptr< Tins::Sniffer > sniffer, const Tins::NetworkInterface &iface, Database &db)
 
void start ()
 
std::set< network_nameall_networks ()
 
std::optional< MACAddressget_bssid (const SSID &ssid)
 
std::optional< std::shared_ptr< AccessPoint > > get_network (const SSID &ssid)
 
std::optional< std::shared_ptr< AccessPoint > > get_network (const MACAddress &bssid)
 
void add_ignored_network (const SSID &ssid)
 
void add_ignored_network (const MACAddress &bssid)
 
std::unordered_map< MACAddress, SSIDignored_networks ()
 
void shutdown ()
 
std::optional< std::string > iface ()
 
std::optional< std::filesystem::path > file ()
 
std::optional< uint32_t > focus_network (const SSID &ssid)
 
std::optional< uint32_t > focus_network (const MACAddress &bssid)
 
std::optional< std::shared_ptr< AccessPoint > > focused_network ()
 
void stop_focus ()
 
std::optional< Recording::infosave_traffic (const std::filesystem::path &saves_path, const std::string &name)
 
std::optional< Recording::infosave_decrypted_traffic (const std::filesystem::path &save_path, const std::string &name)
 
 ~Sniffer ()
 

Static Public Member Functions

static std::vector< Recording::infoavailable_recordings (const std::filesystem::path &save_path)
 
static std::optional< std::string > detect_interface (std::shared_ptr< spdlog::logger > log, const std::string &ifname)
 

Static Public Attributes

static MACAddress NoAddress
 

Detailed Description

Packet sniffer and handler in charge of tracking, information gathering and decrypting passing data.

Member Typedef Documentation

◆ network_name

Constructor & Destructor Documentation

◆ Sniffer() [1/2]

yarilo::Sniffer::Sniffer ( std::unique_ptr< Tins::FileSniffer > sniffer,
const std::filesystem::path & filepath,
Database & db )

A constructor to create the Sniffer without network card support

Parameters
[in]snifferTins::FileSniffer instance

◆ Sniffer() [2/2]

yarilo::Sniffer::Sniffer ( std::unique_ptr< Tins::Sniffer > sniffer,
const Tins::NetworkInterface & iface,
Database & db )

A constructor to create the Sniffer with network card support

Parameters
[in]snifferTins::Sniffer instance
[in]ifaceNetwork interface to use

◆ ~Sniffer()

yarilo::Sniffer::~Sniffer ( )
inline

Member Function Documentation

◆ add_ignored_network() [1/2]

void yarilo::Sniffer::add_ignored_network ( const MACAddress & bssid)

Ignore network and delete any access point with this address

Parameters
[in]bssidAddress of the network to ignore

◆ add_ignored_network() [2/2]

void yarilo::Sniffer::add_ignored_network ( const SSID & ssid)

Ignore network and delete any access point with this SSID

Parameters
[in]ssidSSID of the network to ignore

◆ all_networks()

std::set< Sniffer::network_name > yarilo::Sniffer::all_networks ( )

Get the available networks, use get_network to get a specific network

Returns
names of available networks along with their BSSID

◆ available_recordings()

static std::vector< Recording::info > yarilo::Sniffer::available_recordings ( const std::filesystem::path & save_path)
static

Get the recordings available in the saves directory

Parameters
[in]save_pathPath where the recordings are stored
Returns
Recording filenames to choose from

◆ detect_interface()

std::optional< std::string > yarilo::Sniffer::detect_interface ( std::shared_ptr< spdlog::logger > log,
const std::string & ifname )
static

Try to detect if a logical interface is suitable for sniffing. If the supplied logical interface fails, searching in the same phy might yield a suitable interface

Parameters
[in]logLogger to use
[in]ifnameLogical interface name
Returns
Logical interface to sniff on if available, nullopt otherwise

◆ file()

std::optional< std::filesystem::path > yarilo::Sniffer::file ( )

Get the used filepath (if applicable)

Returns
Used filepath

◆ focus_network() [1/2]

std::optional< uint32_t > yarilo::Sniffer::focus_network ( const MACAddress & bssid)

Focus a specific network by BSSID

Parameters
[in]bssidBasic sevice set identifier of the network to be focused (network addr)
Returns
Optionally return the channel that the network is on

◆ focus_network() [2/2]

std::optional< uint32_t > yarilo::Sniffer::focus_network ( const SSID & ssid)

Focus a specific network by SSID

Parameters
[in]ssidSevice set identifier of the network to be focused (network name)
Returns
Optionally return the channel that the network is on

◆ focused_network()

std::optional< std::shared_ptr< AccessPoint > > yarilo::Sniffer::focused_network ( )

Get the focused network

Returns
Focused network if focusing is enabled, nullopt otherwise

◆ get_bssid()

std::optional< MACAddress > yarilo::Sniffer::get_bssid ( const SSID & ssid)

Find the first network with the given SSID

Parameters
[in]ssidSSID of the searched network
Returns
BSSID of the taget network

◆ get_network() [1/2]

std::optional< std::shared_ptr< AccessPoint > > yarilo::Sniffer::get_network ( const MACAddress & bssid)

Get the details of a network by BSSID, use all_networks to get all the network names

Parameters
[in]bssidof the network
Returns
AccessPoint information if the BSSID exists, nullopt otherwise

◆ get_network() [2/2]

std::optional< std::shared_ptr< AccessPoint > > yarilo::Sniffer::get_network ( const SSID & ssid)

Get the details of a network by SSID, use all_networks to get all the network names. In the case of multiple APs with the same SSID, the first one is chosen

Parameters
[in]ssidof the network
Returns
AccessPoint information if the SSID exists, nullopt otherwise

◆ iface()

std::optional< std::string > yarilo::Sniffer::iface ( )

Get the used interface (if applicable)

Returns
Used net logical interface

◆ ignored_networks()

std::unordered_map< MACAddress, SSID > yarilo::Sniffer::ignored_networks ( )

Get the ignored networks

Returns
ssids of ignored networks

◆ save_decrypted_traffic()

std::optional< recording_info > yarilo::Sniffer::save_decrypted_traffic ( const std::filesystem::path & save_path,
const std::string & name )

Save decrypted traffic

Parameters
[in]directoryin which the recording should live
[in]nameof the recording
Returns
An optional containing some info about the recording.

◆ save_traffic()

std::optional< recording_info > yarilo::Sniffer::save_traffic ( const std::filesystem::path & saves_path,
const std::string & name )

Save all traffic (in 802.11 data link)

Parameters
[in]directoryin which the recording should live
[in]nameof the recording
Returns
An optional containing some info about the recording.

◆ shutdown()

void yarilo::Sniffer::shutdown ( )

Stop the sniffer

◆ start()

void yarilo::Sniffer::start ( )

Run the sniffer

◆ stop_focus()

void yarilo::Sniffer::stop_focus ( )

Stop focusing the current focused network

Member Data Documentation

◆ NoAddress

MACAddress yarilo::Sniffer::NoAddress
static

The documentation for this class was generated from the following files: