mirror of
https://github.com/justcallmekoko/ESP32Marauder.git
synced 2025-12-22 23:26:45 -08:00
Fix open files when SD disable
This commit is contained in:
@@ -76,9 +76,11 @@ void SDInterface::addPacket(uint8_t* buf, uint32_t len) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void SDInterface::openCapture(String file_name) {
|
void SDInterface::openCapture(String file_name) {
|
||||||
if (this->supported)
|
bool save_pcap = settings_obj.loadSetting<bool>("SavePCAP");
|
||||||
|
if ((this->supported) && (save_pcap)) {
|
||||||
buffer_obj.createPcapFile(&SD, file_name);
|
buffer_obj.createPcapFile(&SD, file_name);
|
||||||
buffer_obj.open();
|
buffer_obj.open();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SDInterface::runUpdate() {
|
void SDInterface::runUpdate() {
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
#include "configs.h"
|
#include "configs.h"
|
||||||
|
|
||||||
|
#include "settings.h"
|
||||||
#include "SD.h"
|
#include "SD.h"
|
||||||
#include "Buffer.h"
|
#include "Buffer.h"
|
||||||
#ifdef HAS_SCREEN
|
#ifdef HAS_SCREEN
|
||||||
@@ -11,6 +12,7 @@
|
|||||||
#include <Update.h>
|
#include <Update.h>
|
||||||
|
|
||||||
extern Buffer buffer_obj;
|
extern Buffer buffer_obj;
|
||||||
|
extern Settings settings_obj;
|
||||||
#ifdef HAS_SCREEN
|
#ifdef HAS_SCREEN
|
||||||
extern Display display_obj;
|
extern Display display_obj;
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -301,7 +301,7 @@ void WiFiScan::StartScan(uint8_t scan_mode, uint16_t color)
|
|||||||
else if (scan_mode == WIFI_SCAN_AP)
|
else if (scan_mode == WIFI_SCAN_AP)
|
||||||
RunBeaconScan(scan_mode, color);
|
RunBeaconScan(scan_mode, color);
|
||||||
else if (scan_mode == WIFI_SCAN_SIG_STREN)
|
else if (scan_mode == WIFI_SCAN_SIG_STREN)
|
||||||
RunBeaconScan(scan_mode, color);
|
RunRawScan(scan_mode, color);
|
||||||
else if (scan_mode == WIFI_SCAN_RAW_CAPTURE)
|
else if (scan_mode == WIFI_SCAN_RAW_CAPTURE)
|
||||||
RunRawScan(scan_mode, color);
|
RunRawScan(scan_mode, color);
|
||||||
else if (scan_mode == WIFI_SCAN_STATION)
|
else if (scan_mode == WIFI_SCAN_STATION)
|
||||||
@@ -2162,6 +2162,8 @@ void WiFiScan::stationSnifferCallback(void* buf, wifi_promiscuous_pkt_type_t typ
|
|||||||
|
|
||||||
void WiFiScan::rawSnifferCallback(void* buf, wifi_promiscuous_pkt_type_t type)
|
void WiFiScan::rawSnifferCallback(void* buf, wifi_promiscuous_pkt_type_t type)
|
||||||
{
|
{
|
||||||
|
extern WiFiScan wifi_scan_obj;
|
||||||
|
|
||||||
wifi_promiscuous_pkt_t *snifferPacket = (wifi_promiscuous_pkt_t*)buf;
|
wifi_promiscuous_pkt_t *snifferPacket = (wifi_promiscuous_pkt_t*)buf;
|
||||||
WifiMgmtHdr *frameControl = (WifiMgmtHdr*)snifferPacket->payload;
|
WifiMgmtHdr *frameControl = (WifiMgmtHdr*)snifferPacket->payload;
|
||||||
wifi_pkt_rx_ctrl_t ctrl = (wifi_pkt_rx_ctrl_t)snifferPacket->rx_ctrl;
|
wifi_pkt_rx_ctrl_t ctrl = (wifi_pkt_rx_ctrl_t)snifferPacket->rx_ctrl;
|
||||||
@@ -2177,41 +2179,85 @@ void WiFiScan::rawSnifferCallback(void* buf, wifi_promiscuous_pkt_type_t type)
|
|||||||
const WifiMgmtHdr *hdr = &ipkt->hdr;
|
const WifiMgmtHdr *hdr = &ipkt->hdr;
|
||||||
}
|
}
|
||||||
|
|
||||||
Serial.print("RSSI: ");
|
if (wifi_scan_obj.currentScanMode == WIFI_SCAN_SIG_STREN) {
|
||||||
Serial.print(snifferPacket->rx_ctrl.rssi);
|
bool found = false;
|
||||||
Serial.print(" Ch: ");
|
uint8_t targ_index = 0;
|
||||||
Serial.print(snifferPacket->rx_ctrl.channel);
|
AccessPoint targ_ap;
|
||||||
Serial.print(" BSSID: ");
|
|
||||||
char addr[] = "00:00:00:00:00:00";
|
|
||||||
getMAC(addr, snifferPacket->payload, 10);
|
|
||||||
Serial.print(addr);
|
|
||||||
display_string.concat(text_table4[0]);
|
|
||||||
display_string.concat(snifferPacket->rx_ctrl.rssi);
|
|
||||||
|
|
||||||
display_string.concat(" ");
|
// Check list of APs
|
||||||
display_string.concat(addr);
|
for (int i = 0; i < access_points->size(); i++) {
|
||||||
|
if (access_points->get(i).selected) {
|
||||||
int temp_len = display_string.length();
|
uint8_t addr[] = {snifferPacket->payload[10],
|
||||||
|
snifferPacket->payload[11],
|
||||||
#ifdef HAS_SCREEN
|
snifferPacket->payload[12],
|
||||||
for (int i = 0; i < 40 - temp_len; i++)
|
snifferPacket->payload[13],
|
||||||
{
|
snifferPacket->payload[14],
|
||||||
display_string.concat(" ");
|
snifferPacket->payload[15]};
|
||||||
|
// Compare AP bssid to ssid of recvd packet
|
||||||
|
for (int x = 0; x < 6; x++) {
|
||||||
|
if (addr[x] != access_points->get(i).bssid[x]) {
|
||||||
|
found = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
found = true;
|
||||||
|
}
|
||||||
|
if (found) {
|
||||||
|
//Serial.println("Received beacon from " + access_points->get(i).essid + ". Checking RSSI...");
|
||||||
|
targ_ap = access_points->get(i);
|
||||||
|
targ_index = i;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
if (!found)
|
||||||
|
return;
|
||||||
|
|
||||||
Serial.print(" ");
|
if ((targ_ap.rssi + 5 < snifferPacket->rx_ctrl.rssi) || (snifferPacket->rx_ctrl.rssi + 5 < targ_ap.rssi)) {
|
||||||
|
targ_ap.rssi = snifferPacket->rx_ctrl.rssi;
|
||||||
if (display_obj.display_buffer->size() == 0)
|
access_points->set(targ_index, targ_ap);
|
||||||
{
|
Serial.println((String)access_points->get(targ_index).essid + " RSSI: " + (String)access_points->get(targ_index).rssi);
|
||||||
display_obj.loading = true;
|
return;
|
||||||
display_obj.display_buffer->add(display_string);
|
|
||||||
display_obj.loading = false;
|
|
||||||
}
|
}
|
||||||
#endif
|
}
|
||||||
|
|
||||||
Serial.println();
|
else {
|
||||||
|
Serial.print("RSSI: ");
|
||||||
|
Serial.print(snifferPacket->rx_ctrl.rssi);
|
||||||
|
Serial.print(" Ch: ");
|
||||||
|
Serial.print(snifferPacket->rx_ctrl.channel);
|
||||||
|
Serial.print(" BSSID: ");
|
||||||
|
char addr[] = "00:00:00:00:00:00";
|
||||||
|
getMAC(addr, snifferPacket->payload, 10);
|
||||||
|
Serial.print(addr);
|
||||||
|
display_string.concat(text_table4[0]);
|
||||||
|
display_string.concat(snifferPacket->rx_ctrl.rssi);
|
||||||
|
|
||||||
addPacket(snifferPacket, len);
|
display_string.concat(" ");
|
||||||
|
display_string.concat(addr);
|
||||||
|
|
||||||
|
int temp_len = display_string.length();
|
||||||
|
|
||||||
|
#ifdef HAS_SCREEN
|
||||||
|
for (int i = 0; i < 40 - temp_len; i++)
|
||||||
|
{
|
||||||
|
display_string.concat(" ");
|
||||||
|
}
|
||||||
|
|
||||||
|
Serial.print(" ");
|
||||||
|
|
||||||
|
if (display_obj.display_buffer->size() == 0)
|
||||||
|
{
|
||||||
|
display_obj.loading = true;
|
||||||
|
display_obj.display_buffer->add(display_string);
|
||||||
|
display_obj.loading = false;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
Serial.println();
|
||||||
|
|
||||||
|
addPacket(snifferPacket, len);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void WiFiScan::deauthSnifferCallback(void* buf, wifi_promiscuous_pkt_type_t type)
|
void WiFiScan::deauthSnifferCallback(void* buf, wifi_promiscuous_pkt_type_t type)
|
||||||
|
|||||||
Reference in New Issue
Block a user