mirror of
https://github.com/justcallmekoko/ESP32Marauder.git
synced 2025-12-13 00:00:44 -08:00
Memory is shown as percentage
Memory is shown as percentage in status bar. HTML and wardriving MACs are stored in PSRAM for available hardware
This commit is contained in:
@@ -1,5 +1,9 @@
|
||||
#include "EvilPortal.h"
|
||||
|
||||
#ifdef HAS_PSRAM
|
||||
char* index_html = nullptr;
|
||||
#endif
|
||||
|
||||
AsyncWebServer server(80);
|
||||
|
||||
EvilPortal::EvilPortal() {
|
||||
@@ -23,6 +27,11 @@ void EvilPortal::setup() {
|
||||
#endif
|
||||
}
|
||||
|
||||
void EvilPortal::cleanup() {
|
||||
free(index_html);
|
||||
index_html = nullptr;
|
||||
}
|
||||
|
||||
bool EvilPortal::begin(LinkedList<ssid>* ssids, LinkedList<AccessPoint>* access_points) {
|
||||
if (!this->setAP(ssids, access_points))
|
||||
return false;
|
||||
@@ -43,13 +52,23 @@ String EvilPortal::get_password() {
|
||||
}
|
||||
|
||||
void EvilPortal::setupServer() {
|
||||
server.on("/", HTTP_GET, [this](AsyncWebServerRequest *request) {
|
||||
request->send_P(200, "text/html", index_html);
|
||||
Serial.println("client connected");
|
||||
#ifdef HAS_SCREEN
|
||||
this->sendToDisplay("Client connected to server");
|
||||
#endif
|
||||
});
|
||||
#ifndef HAS_PSRAM
|
||||
server.on("/", HTTP_GET, [this](AsyncWebServerRequest *request) {
|
||||
request->send_P(200, "text/html", index_html);
|
||||
Serial.println("client connected");
|
||||
#ifdef HAS_SCREEN
|
||||
this->sendToDisplay("Client connected to server");
|
||||
#endif
|
||||
});
|
||||
#else
|
||||
server.on("/", HTTP_GET, [this](AsyncWebServerRequest *request) {
|
||||
request->send(200, "text/html", index_html);
|
||||
Serial.println("client connected");
|
||||
#ifdef HAS_SCREEN
|
||||
this->sendToDisplay("Client connected to server");
|
||||
#endif
|
||||
});
|
||||
#endif
|
||||
|
||||
server.on("/get-ap-name", HTTP_GET, [this](AsyncWebServerRequest *request) {
|
||||
request->send(200, "text/plain", WiFi.softAPSSID());
|
||||
@@ -82,7 +101,13 @@ void EvilPortal::setupServer() {
|
||||
void EvilPortal::setHtmlFromSerial() {
|
||||
Serial.println("Setting HTML from serial...");
|
||||
const char *htmlStr = Serial.readString().c_str();
|
||||
strncpy(index_html, htmlStr, strlen(htmlStr));
|
||||
#ifdef HAS_PSRAM
|
||||
index_html = (char*) ps_malloc(MAX_HTML_SIZE);
|
||||
#endif
|
||||
strlcpy(index_html, htmlStr, strlen(htmlStr));
|
||||
#ifdef HAS_PSRAM
|
||||
index_html[MAX_HTML_SIZE - 1] = '\0';
|
||||
#endif
|
||||
this->has_html = true;
|
||||
this->using_serial_html = true;
|
||||
Serial.println("html set");
|
||||
@@ -123,7 +148,13 @@ bool EvilPortal::setHtml() {
|
||||
if (isPrintable(c))
|
||||
html.concat(c);
|
||||
}
|
||||
strncpy(index_html, html.c_str(), strlen(html.c_str()));
|
||||
#ifdef HAS_PSRAM
|
||||
index_html = (char*) ps_malloc(MAX_HTML_SIZE);
|
||||
#endif
|
||||
strlcpy(index_html, html.c_str(), strlen(html.c_str()));
|
||||
#ifdef HAS_PSRAM
|
||||
index_html[MAX_HTML_SIZE - 1] = '\0';
|
||||
#endif
|
||||
this->has_html = true;
|
||||
Serial.println("html set");
|
||||
html_file.close();
|
||||
|
||||
@@ -37,7 +37,12 @@ extern Buffer buffer_obj;
|
||||
#define WIFI_SCAN_EVIL_PORTAL 30
|
||||
|
||||
char apName[MAX_AP_NAME_SIZE] = "PORTAL";
|
||||
char index_html[MAX_HTML_SIZE] = "TEST";
|
||||
|
||||
#ifndef HAS_PSRAM
|
||||
char index_html[MAX_HTML_SIZE] = "TEST";
|
||||
#else
|
||||
extern char* index_html;
|
||||
#endif
|
||||
|
||||
struct ssid {
|
||||
String essid;
|
||||
@@ -51,7 +56,8 @@ struct AccessPoint {
|
||||
uint8_t channel;
|
||||
uint8_t bssid[6];
|
||||
bool selected;
|
||||
LinkedList<char>* beacon;
|
||||
// LinkedList<char>* beacon;
|
||||
char beacon[2];
|
||||
int8_t rssi;
|
||||
LinkedList<uint16_t>* stations;
|
||||
uint16_t packets;
|
||||
@@ -106,6 +112,7 @@ class EvilPortal {
|
||||
|
||||
LinkedList<String>* html_files;
|
||||
|
||||
void cleanup();
|
||||
String get_user_name();
|
||||
String get_password();
|
||||
void setup();
|
||||
|
||||
@@ -1203,12 +1203,28 @@ void MenuFunctions::updateStatusBar()
|
||||
wifi_scan_obj.old_free_ram = wifi_scan_obj.free_ram;
|
||||
display_obj.tft.fillRect(100, 0, 60, STATUS_BAR_WIDTH, STATUSBAR_COLOR);
|
||||
#ifdef HAS_FULL_SCREEN
|
||||
display_obj.tft.drawString((String)wifi_scan_obj.free_ram + "B", 100, 0, 2);
|
||||
//display_obj.tft.setCursor(100, 0);
|
||||
//display_obj.tft.setFreeFont(2);
|
||||
//display_obj.tft.print("D:" + String(getDRAMUsagePercent()) + "%");
|
||||
#ifndef HAS_PSRAM
|
||||
display_obj.tft.drawString("D:" + String(getDRAMUsagePercent()) + "%", 100, 0, 2);
|
||||
#else
|
||||
display_obj.tft.drawString("D:" + String(getDRAMUsagePercent()) + "%" + " P:" + String(getPSRAMUsagePercent()) + "%", 100, 0, 1);
|
||||
#endif
|
||||
//display_obj.tft.drawString((String)wifi_scan_obj.free_ram + "B", 100, 0, 2);
|
||||
#endif
|
||||
|
||||
#ifdef HAS_MINI_SCREEN
|
||||
display_obj.tft.drawString((String)wifi_scan_obj.free_ram + "B", TFT_WIDTH/1.75, 0, 1);
|
||||
#ifdef HAS_MINI_SCREEN
|
||||
//display_obj.tft.setCursor(TFT_WIDTH/1.75, 0);
|
||||
//display_obj.tft.setFreeFont(1);
|
||||
//display_obj.tft.print("D:" + String(getDRAMUsagePercent()) + "%");
|
||||
#ifndef HAS_PSRAM
|
||||
display_obj.tft.drawString("D:" + String(getDRAMUsagePercent()) + "%", TFT_WIDTH/1.75, 0, 1);
|
||||
#else
|
||||
display_obj.tft.drawString("D:" + String(getDRAMUsagePercent()) + "%" + " P:" + String(getPSRAMUsagePercent()) + "%", TFT_WIDTH/1.75, 0, 1);
|
||||
#endif
|
||||
//display_obj.tft.drawString((String)wifi_scan_obj.free_ram + "B", TFT_WIDTH/1.75, 0, 1);
|
||||
#endif
|
||||
}
|
||||
|
||||
// Draw battery info
|
||||
@@ -1313,11 +1329,27 @@ void MenuFunctions::drawStatusBar()
|
||||
wifi_scan_obj.old_free_ram = wifi_scan_obj.free_ram;
|
||||
display_obj.tft.fillRect(100, 0, 60, STATUS_BAR_WIDTH, STATUSBAR_COLOR);
|
||||
#ifdef HAS_FULL_SCREEN
|
||||
display_obj.tft.drawString((String)wifi_scan_obj.free_ram + "B", 100, 0, 2);
|
||||
//display_obj.tft.setCursor(100, 0);
|
||||
//display_obj.tft.setFreeFont(2);
|
||||
//display_obj.tft.print("D:" + String(getDRAMUsagePercent()) + "%");
|
||||
#ifndef HAS_PSRAM
|
||||
display_obj.tft.drawString("D:" + String(getDRAMUsagePercent()) + "%", 100, 0, 2);
|
||||
#else
|
||||
display_obj.tft.drawString("D:" + String(getDRAMUsagePercent()) + "%" + " P:" + String(getPSRAMUsagePercent()) + "%", 100, 0, 1);
|
||||
#endif
|
||||
//display_obj.tft.drawString((String)wifi_scan_obj.free_ram + "B", 100, 0, 2);
|
||||
#endif
|
||||
|
||||
#ifdef HAS_MINI_SCREEN
|
||||
display_obj.tft.drawString((String)wifi_scan_obj.free_ram + "B", TFT_WIDTH/1.75, 0, 1);
|
||||
//display_obj.tft.setCursor(TFT_WIDTH/1.75, 0);
|
||||
//display_obj.tft.setFreeFont(1);
|
||||
//display_obj.tft.print("D:" + String(getDRAMUsagePercent()) + "%");
|
||||
#ifndef HAS_PSRAM
|
||||
display_obj.tft.drawString("D:" + String(getDRAMUsagePercent()) + "%", TFT_WIDTH/1.75, 0, 1);
|
||||
#else
|
||||
display_obj.tft.drawString("D:" + String(getDRAMUsagePercent()) + "%" + " P:" + String(getPSRAMUsagePercent()) + "%", TFT_WIDTH/1.75, 0, 1);
|
||||
#endif
|
||||
//display_obj.tft.drawString((String)wifi_scan_obj.free_ram + "B", TFT_WIDTH/1.75, 0, 1);
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
#include "WiFiScan.h"
|
||||
#include "lang_var.h"
|
||||
|
||||
#ifdef HAS_PSRAM
|
||||
struct mac_addr* mac_history = nullptr;
|
||||
#endif
|
||||
|
||||
int num_beacon = 0;
|
||||
int num_deauth = 0;
|
||||
int num_probe = 0;
|
||||
@@ -531,13 +535,22 @@ void WiFiScan::RunSetup() {
|
||||
this->wsl_bypass_enabled = true;
|
||||
else
|
||||
this->wsl_bypass_enabled = false;
|
||||
|
||||
ssids = new LinkedList<ssid>();
|
||||
|
||||
#ifdef HAS_PSRAM
|
||||
ssids = new (ps_malloc(sizeof(LinkedList<ssid>))) LinkedList<ssid>();
|
||||
new (ssids) LinkedList<ssid>();
|
||||
#else
|
||||
ssids = new LinkedList<ssid>();
|
||||
#endif
|
||||
access_points = new LinkedList<AccessPoint>();
|
||||
stations = new LinkedList<Station>();
|
||||
airtags = new LinkedList<AirTag>();
|
||||
flippers = new LinkedList<Flipper>();
|
||||
|
||||
#ifdef HAS_PSRAM
|
||||
mac_history = (struct mac_addr*) ps_malloc(mac_history_len * sizeof(struct mac_addr));
|
||||
#endif
|
||||
|
||||
#ifdef HAS_BT
|
||||
watch_models = new WatchModel[26] {
|
||||
{0x1A, "Fallback Watch"},
|
||||
@@ -660,6 +673,13 @@ int WiFiScan::generateSSIDs(int count) {
|
||||
Serial.println(ssids->get(ssids->size() - 1).essid);
|
||||
}
|
||||
|
||||
Serial.print("Free Heap: ");
|
||||
Serial.print(esp_get_free_heap_size());
|
||||
#ifdef HAS_PSRAM
|
||||
Serial.print(" Free PSRAM: ");
|
||||
Serial.println(heap_caps_get_free_size(MALLOC_CAP_SPIRAM));
|
||||
#endif
|
||||
|
||||
return num_gen;
|
||||
}
|
||||
|
||||
@@ -928,6 +948,7 @@ bool WiFiScan::shutdownWiFi() {
|
||||
esp_wifi_stop();
|
||||
esp_wifi_restore();
|
||||
esp_wifi_deinit();
|
||||
esp_netif_deinit();
|
||||
|
||||
#ifdef HAS_FLIPPER_LED
|
||||
flipper_led.offLED();
|
||||
@@ -1032,6 +1053,8 @@ void WiFiScan::StopScan(uint8_t scan_mode)
|
||||
this->eapol_frames = 0;
|
||||
this->min_rssi = 0;
|
||||
this->max_rssi = -128;
|
||||
|
||||
evil_portal_obj.cleanup();
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -1147,7 +1170,7 @@ bool WiFiScan::seen_mac(unsigned char* mac) {
|
||||
}
|
||||
|
||||
for (int x = 0; x < mac_history_len; x++) {
|
||||
if (this->mac_cmp(tmp, this->mac_history[x])) {
|
||||
if (this->mac_cmp(tmp, mac_history[x])) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -1164,7 +1187,7 @@ void WiFiScan::save_mac(unsigned char* mac) {
|
||||
tmp.bytes[x] = mac[x];
|
||||
}
|
||||
|
||||
this->mac_history[this->mac_history_cursor] = tmp;
|
||||
mac_history[this->mac_history_cursor] = tmp;
|
||||
this->mac_history_cursor++;
|
||||
}
|
||||
|
||||
@@ -1219,7 +1242,7 @@ String WiFiScan::security_int_to_string(int security_type) {
|
||||
|
||||
void WiFiScan::clearMacHistory() {
|
||||
for (int i = 0; i < mac_history_len; ++i) {
|
||||
memset(this->mac_history[i].bytes, 0, sizeof(mac_history[i].bytes));
|
||||
memset(mac_history[i].bytes, 0, sizeof(mac_history[i].bytes));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1651,6 +1674,9 @@ void WiFiScan::RunAPScan(uint8_t scan_mode, uint16_t color)
|
||||
delete access_points;
|
||||
access_points = new LinkedList<AccessPoint>();
|
||||
|
||||
esp_netif_init();
|
||||
esp_event_loop_create_default();
|
||||
|
||||
esp_wifi_init(&cfg2);
|
||||
esp_wifi_set_storage(WIFI_STORAGE_RAM);
|
||||
esp_wifi_set_mode(WIFI_MODE_NULL);
|
||||
@@ -2814,8 +2840,22 @@ void WiFiScan::RunStationScan(uint8_t scan_mode, uint16_t color)
|
||||
display_obj.setupScrollArea(display_obj.TOP_FIXED_AREA_2, BOT_FIXED_AREA);
|
||||
#endif
|
||||
|
||||
esp_netif_init();
|
||||
esp_event_loop_create_default();
|
||||
//esp_wifi_init(&cfg);
|
||||
esp_wifi_init(&cfg2);
|
||||
esp_err_t err = esp_wifi_init(&cfg2);
|
||||
if (err != ESP_OK) {
|
||||
Serial.printf("Custom config failed (0x%04X), falling back to default...\n", err);
|
||||
wifi_init_config_t default_cfg = WIFI_INIT_CONFIG_DEFAULT();
|
||||
err = esp_wifi_init(&default_cfg);
|
||||
if (err != ESP_OK) {
|
||||
Serial.printf("Default config also failed (0x%04X)\n", err);
|
||||
} else {
|
||||
Serial.println("Wi-Fi init succeeded with default config.");
|
||||
}
|
||||
} else {
|
||||
Serial.println("Wi-Fi init succeeded with custom config.");
|
||||
}
|
||||
esp_wifi_set_storage(WIFI_STORAGE_RAM);
|
||||
esp_wifi_set_mode(WIFI_MODE_NULL);
|
||||
esp_wifi_start();
|
||||
@@ -3435,7 +3475,12 @@ void WiFiScan::apSnifferCallbackFull(void* buf, wifi_promiscuous_pkt_type_t type
|
||||
//const wifi_ieee80211_packet_t *ipkt = (wifi_ieee80211_packet_t *)snifferPacket->payload;
|
||||
//const WifiMgmtHdr *hdr = &ipkt->hdr;
|
||||
|
||||
int buf = 0;
|
||||
// If we dont the buffer size is not 0, don't write or else we get CORRUPT_HEAP
|
||||
#ifdef HAS_SCREEN
|
||||
int buf = display_obj.display_buffer->size();
|
||||
#else
|
||||
int buf = 0;
|
||||
#endif
|
||||
|
||||
bool wps = wifi_scan_obj.beaconHasWPS(snifferPacket->payload, len);
|
||||
|
||||
@@ -3558,19 +3603,22 @@ void WiFiScan::apSnifferCallbackFull(void* buf, wifi_promiscuous_pkt_type_t type
|
||||
ap.selected = false;
|
||||
ap.stations = new LinkedList<uint16_t>();
|
||||
|
||||
ap.beacon = new LinkedList<char>();
|
||||
//ap.beacon = new LinkedList<char>();
|
||||
|
||||
//for (int i = 0; i < len; i++) {
|
||||
// ap.beacon->add(snifferPacket->payload[i]);
|
||||
//}
|
||||
ap.beacon->add(snifferPacket->payload[34]);
|
||||
ap.beacon->add(snifferPacket->payload[35]);
|
||||
ap.beacon[0] = snifferPacket->payload[34];
|
||||
ap.beacon[1] = snifferPacket->payload[35];
|
||||
//ap.beacon->add(snifferPacket->payload[34]);
|
||||
//ap.beacon->add(snifferPacket->payload[35]);
|
||||
|
||||
Serial.print("\nBeacon: ");
|
||||
|
||||
for (int i = 0; i < ap.beacon->size(); i++) {
|
||||
for (int i = 0; i < 2; i++) {
|
||||
char hexCar[4];
|
||||
sprintf(hexCar, "%02X", ap.beacon->get(i));
|
||||
//sprintf(hexCar, "%02X", ap.beacon->get(i));
|
||||
sprintf(hexCar, "%02X", ap.beacon[i]);
|
||||
Serial.print(hexCar);
|
||||
if ((i + 1) % 16 == 0)
|
||||
Serial.print("\n");
|
||||
@@ -3593,6 +3641,10 @@ void WiFiScan::apSnifferCallbackFull(void* buf, wifi_promiscuous_pkt_type_t type
|
||||
Serial.print(access_points->size());
|
||||
Serial.print(" ");
|
||||
Serial.print(esp_get_free_heap_size());
|
||||
#ifdef HAS_PSRAM
|
||||
Serial.print(" ");
|
||||
Serial.print(heap_caps_get_free_size(MALLOC_CAP_SPIRAM));
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
@@ -3969,7 +4021,7 @@ void WiFiScan::apSnifferCallback(void* buf, wifi_promiscuous_pkt_type_t type)
|
||||
|
||||
bool wps = wifi_scan_obj.beaconHasWPS(snifferPacket->payload, snifferPacket->rx_ctrl.sig_len);
|
||||
|
||||
AccessPoint ap = {essid,
|
||||
/*AccessPoint ap = {essid,
|
||||
snifferPacket->rx_ctrl.channel,
|
||||
{snifferPacket->payload[10],
|
||||
snifferPacket->payload[11],
|
||||
@@ -3983,6 +4035,22 @@ void WiFiScan::apSnifferCallback(void* buf, wifi_promiscuous_pkt_type_t type)
|
||||
new LinkedList<uint16_t>(),
|
||||
0,
|
||||
security_type,
|
||||
wps};*/
|
||||
|
||||
AccessPoint ap = {essid,
|
||||
snifferPacket->rx_ctrl.channel,
|
||||
{snifferPacket->payload[10],
|
||||
snifferPacket->payload[11],
|
||||
snifferPacket->payload[12],
|
||||
snifferPacket->payload[13],
|
||||
snifferPacket->payload[14],
|
||||
snifferPacket->payload[15]},
|
||||
false,
|
||||
{snifferPacket->payload[34], snifferPacket->payload[35]},
|
||||
snifferPacket->rx_ctrl.rssi,
|
||||
new LinkedList<uint16_t>(),
|
||||
0,
|
||||
security_type,
|
||||
wps};
|
||||
|
||||
access_points->add(ap);
|
||||
@@ -3990,6 +4058,10 @@ void WiFiScan::apSnifferCallback(void* buf, wifi_promiscuous_pkt_type_t type)
|
||||
Serial.print(access_points->size());
|
||||
Serial.print(" ");
|
||||
Serial.print(esp_get_free_heap_size());
|
||||
#ifdef HAS_PSRAM
|
||||
Serial.print(" ");
|
||||
Serial.print(heap_caps_get_free_size(MALLOC_CAP_SPIRAM));
|
||||
#endif
|
||||
|
||||
Serial.println();
|
||||
|
||||
@@ -4407,7 +4479,8 @@ void WiFiScan::stationSnifferCallback(void* buf, wifi_promiscuous_pkt_type_t typ
|
||||
snifferPacket->payload[frame_offset + 4],
|
||||
snifferPacket->payload[frame_offset + 5]},
|
||||
false,
|
||||
0};
|
||||
0,
|
||||
ap_index};
|
||||
|
||||
stations->add(sta);
|
||||
}
|
||||
@@ -4648,11 +4721,11 @@ void WiFiScan::probeSnifferCallback(void* buf, wifi_promiscuous_pkt_type_t type)
|
||||
|
||||
|
||||
// If we dont the buffer size is not 0, don't write or else we get CORRUPT_HEAP
|
||||
//#ifdef HAS_SCREEN
|
||||
// int buf = display_obj.display_buffer->size();
|
||||
//#else
|
||||
int buf = 0;
|
||||
//#endif
|
||||
#ifdef HAS_SCREEN
|
||||
int buf = display_obj.display_buffer->size();
|
||||
#else
|
||||
int buf = 0;
|
||||
#endif
|
||||
if ((snifferPacket->payload[0] == 0x40) && (buf == 0))
|
||||
{
|
||||
if (wifi_scan_obj.currentScanMode == WIFI_SCAN_PROBE) {
|
||||
@@ -4833,8 +4906,8 @@ void WiFiScan::broadcastCustomBeacon(uint32_t current_time, AccessPoint custom_s
|
||||
esp_wifi_set_channel(set_channel, WIFI_SECOND_CHAN_NONE);
|
||||
delay(1);
|
||||
|
||||
if (custom_ssid.beacon->size() == 0)
|
||||
return;
|
||||
//if (custom_ssid.beacon->size() == 0)
|
||||
// return;
|
||||
|
||||
|
||||
// Randomize SRC MAC
|
||||
@@ -4876,8 +4949,10 @@ void WiFiScan::broadcastCustomBeacon(uint32_t current_time, AccessPoint custom_s
|
||||
//for(int i = 0; i < 12; i++)
|
||||
// packet[38 + fullLen + i] = postSSID[i];
|
||||
|
||||
packet[34] = custom_ssid.beacon->get(0);
|
||||
packet[35] = custom_ssid.beacon->get(1);
|
||||
//packet[34] = custom_ssid.beacon->get(0);
|
||||
//packet[35] = custom_ssid.beacon->get(1);
|
||||
packet[34] = custom_ssid.beacon[0];
|
||||
packet[35] = custom_ssid.beacon[1];
|
||||
|
||||
|
||||
esp_wifi_80211_tx(WIFI_IF_AP, packet, sizeof(packet), false);
|
||||
|
||||
@@ -201,11 +201,17 @@ struct Flipper {
|
||||
String name;
|
||||
};
|
||||
|
||||
#ifdef HAS_PSRAM
|
||||
extern struct mac_addr* mac_history;
|
||||
#endif
|
||||
|
||||
class WiFiScan
|
||||
{
|
||||
private:
|
||||
// Wardriver thanks to https://github.com/JosephHewitt
|
||||
struct mac_addr mac_history[mac_history_len];
|
||||
#ifndef HAS_PSRAM
|
||||
struct mac_addr mac_history[mac_history_len];
|
||||
#endif
|
||||
|
||||
uint8_t ap_mac[6] = {0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED};
|
||||
uint8_t sta_mac[6] = {0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED};
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
//#define MARAUDER_V6
|
||||
//#define MARAUDER_V6_1
|
||||
//#define MARAUDER_V7
|
||||
//#define MARAUDER_V7_1
|
||||
#define MARAUDER_V7_1
|
||||
//#define MARAUDER_KIT
|
||||
//#define GENERIC_ESP32
|
||||
//#define MARAUDER_FLIPPER
|
||||
@@ -1620,7 +1620,7 @@
|
||||
//// EVIL PORTAL STUFF
|
||||
|
||||
#ifdef HAS_PSRAM
|
||||
#define MAX_HTML_SIZE 28000
|
||||
#define MAX_HTML_SIZE 30000
|
||||
#else
|
||||
#define MAX_HTML_SIZE 11400
|
||||
#endif
|
||||
@@ -1630,7 +1630,7 @@
|
||||
//// GPS STUFF
|
||||
#ifdef HAS_GPS
|
||||
#ifdef HAS_PSRAM
|
||||
#define mac_history_len 1000
|
||||
#define mac_history_len 500
|
||||
#else
|
||||
#define mac_history_len 100
|
||||
#endif
|
||||
@@ -1761,8 +1761,8 @@
|
||||
//// PCAP BUFFER STUFF
|
||||
|
||||
#ifdef HAS_PSRAM
|
||||
#define BUF_SIZE 16 * 1024 // Had to reduce buffer size to save RAM. GG @spacehuhn
|
||||
#define SNAP_LEN 2 * 4096 // max len of each recieved packet
|
||||
#define BUF_SIZE 8 * 1024 // Had to reduce buffer size to save RAM. GG @spacehuhn
|
||||
#define SNAP_LEN 1 * 4096 // max len of each recieved packet
|
||||
#elif !defined(HAS_ILI9341)
|
||||
#define BUF_SIZE 8 * 1024 // Had to reduce buffer size to save RAM. GG @spacehuhn
|
||||
#define SNAP_LEN 4096 // max len of each recieved packet
|
||||
|
||||
@@ -192,6 +192,14 @@ void setup()
|
||||
|
||||
Serial.println("ESP-IDF version is: " + String(esp_get_idf_version()));
|
||||
|
||||
#ifdef HAS_PSRAM
|
||||
if (psramInit()) {
|
||||
Serial.println("PSRAM is correctly initialized");
|
||||
} else {
|
||||
Serial.println("PSRAM not available");
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef HAS_SCREEN
|
||||
display_obj.RunSetup();
|
||||
display_obj.tft.setTextColor(TFT_WHITE, TFT_BLACK);
|
||||
|
||||
@@ -5,6 +5,10 @@
|
||||
#include <Arduino.h>
|
||||
#include <vector>
|
||||
|
||||
#include "configs.h"
|
||||
|
||||
#include "esp_heap_caps.h"
|
||||
|
||||
struct mac_addr {
|
||||
unsigned char bytes[6];
|
||||
};
|
||||
@@ -13,6 +17,7 @@ struct Station {
|
||||
uint8_t mac[6];
|
||||
bool selected;
|
||||
uint16_t packets;
|
||||
uint16_t ap;
|
||||
};
|
||||
|
||||
const char apple_ouis[][9] PROGMEM = {
|
||||
@@ -144,6 +149,35 @@ const char xiaomi_ouis[][9] PROGMEM = {
|
||||
"90:4E:91", "C4:0B:CB", "D0:DB:32"
|
||||
};
|
||||
|
||||
uint8_t getDRAMUsagePercent() {
|
||||
//size_t total = heap_caps_get_total_size(MALLOC_CAP_8BIT);
|
||||
//size_t free = heap_caps_get_free_size(MALLOC_CAP_8BIT);
|
||||
size_t free = ESP.getFreeHeap();
|
||||
size_t total = ESP.getHeapSize();
|
||||
|
||||
if (total == 0) return 0; // Avoid division by zero
|
||||
|
||||
size_t used = total - free;
|
||||
uint8_t percent = (used * 100) / total;
|
||||
return percent;
|
||||
}
|
||||
|
||||
#ifdef HAS_PSRAM
|
||||
uint8_t getPSRAMUsagePercent() {
|
||||
//size_t total = heap_caps_get_total_size(MALLOC_CAP_SPIRAM);
|
||||
//size_t free = heap_caps_get_free_size(MALLOC_CAP_SPIRAM);
|
||||
|
||||
size_t total = ESP.getPsramSize();
|
||||
size_t free = ESP.getFreePsram();
|
||||
|
||||
if (total == 0) return 0; // Avoid division by zero or PSRAM not available
|
||||
|
||||
size_t used = total - free;
|
||||
uint8_t percent = (used * 100) / total;
|
||||
return percent;
|
||||
}
|
||||
#endif
|
||||
|
||||
String byteArrayToHexString(const std::vector<uint8_t>& byteArray) {
|
||||
String result;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user