2018-07-17 15:15:58 +02:00
|
|
|
#ifndef _MACSNIFF_H
|
|
|
|
#define _MACSNIFF_H
|
2018-06-09 22:28:20 +02:00
|
|
|
|
2018-04-02 01:30:24 +02:00
|
|
|
// ESP32 Functions
|
|
|
|
#include <esp_wifi.h>
|
|
|
|
|
2018-07-15 23:40:42 +02:00
|
|
|
// Hash function for scrambling MAC addresses
|
2018-07-15 14:28:05 +02:00
|
|
|
#include "hash.h"
|
2018-07-17 11:53:43 +02:00
|
|
|
#include "led.h"
|
|
|
|
|
2018-04-02 01:30:24 +02:00
|
|
|
#define MAC_SNIFF_WIFI 0
|
2018-06-12 19:55:31 +02:00
|
|
|
#define MAC_SNIFF_BLE 1
|
2018-04-02 01:30:24 +02:00
|
|
|
|
|
|
|
typedef struct {
|
2018-06-12 19:55:31 +02:00
|
|
|
unsigned frame_ctrl : 16;
|
|
|
|
unsigned duration_id : 16;
|
|
|
|
uint8_t addr1[6]; /* receiver address */
|
|
|
|
uint8_t addr2[6]; /* sender address */
|
|
|
|
uint8_t addr3[6]; /* filtering address */
|
|
|
|
unsigned sequence_ctrl : 16;
|
|
|
|
uint8_t addr4[6]; /* optional */
|
2018-04-02 01:30:24 +02:00
|
|
|
} wifi_ieee80211_mac_hdr_t;
|
|
|
|
|
|
|
|
typedef struct {
|
2018-06-12 19:55:31 +02:00
|
|
|
wifi_ieee80211_mac_hdr_t hdr;
|
|
|
|
uint8_t payload[0]; /* network data ended with 4 bytes csum (CRC32) */
|
2018-04-02 01:30:24 +02:00
|
|
|
} wifi_ieee80211_packet_t;
|
|
|
|
|
2018-04-19 15:17:23 +02:00
|
|
|
uint16_t reset_salt(void);
|
2018-04-02 01:30:24 +02:00
|
|
|
void wifi_sniffer_init(void);
|
|
|
|
void wifi_sniffer_set_channel(uint8_t channel);
|
|
|
|
void wifi_sniffer_packet_handler(void *buff, wifi_promiscuous_pkt_type_t type);
|
2018-07-22 12:11:13 +02:00
|
|
|
bool mac_add(uint8_t *paddr, int8_t rssi, bool sniff_type);
|
2018-07-23 08:25:23 +02:00
|
|
|
void ChannelSwitchIRQ(void);
|
2018-06-09 22:28:20 +02:00
|
|
|
|
|
|
|
#endif
|