mirror of
https://github.com/justcallmekoko/ESP32Marauder.git
synced 2025-12-12 15:50:36 -08:00
Save RAM during BLE
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
<!---[](https://travis-ci.com/justcallmekoko/ESP32Marauder)--->
|
||||
<!---Shields/Badges https://shields.io/--->
|
||||
|
||||
# ESP32 Marauder v0.5.1
|
||||
# ESP32 Marauder v0.5.2
|
||||
<p align="center"><img alt="Marauder logo" src="https://github.com/justcallmekoko/ESP32Marauder/blob/master/pictures/marauder3L.jpg?raw=true" width="300"></p>
|
||||
<p align="center">
|
||||
<b>A suite of WiFi/Bluetooth offensive and defensive tools for the ESP32</b>
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -5,7 +5,7 @@
|
||||
#include "FS.h"
|
||||
//#include "SD_MMC.h"
|
||||
|
||||
#define BUF_SIZE 24 * 1024
|
||||
#define BUF_SIZE 3 * 1024 // Had to reduce buffer size to save RAM. GG @spacehuhn
|
||||
#define SNAP_LEN 2324 // max len of each recieved packet
|
||||
|
||||
//extern bool useSD;
|
||||
|
||||
@@ -56,7 +56,7 @@ class Display
|
||||
TFT_eSPI tft = TFT_eSPI();
|
||||
TFT_eSprite img = TFT_eSprite(&tft);
|
||||
TFT_eSPI_Button key[BUTTON_ARRAY_LEN];
|
||||
String version_number = "v0.5.1";
|
||||
String version_number = "v0.5.2";
|
||||
|
||||
bool printing = false;
|
||||
bool loading = false;
|
||||
|
||||
@@ -20,15 +20,15 @@ bool SDInterface::initSD() {
|
||||
else
|
||||
Serial.println("SD: UNKNOWN Card Mounted");
|
||||
|
||||
this->cardSizeBT = SD.cardSize();
|
||||
this->cardSizeKB = SD.cardSize() / 1024;
|
||||
//this->cardSizeBT = SD.cardSize();
|
||||
//this->cardSizeKB = SD.cardSize() / 1024;
|
||||
this->cardSizeMB = SD.cardSize() / (1024 * 1024);
|
||||
this->cardSizeGB = SD.cardSize() / (1024 * 1024 * 1024);
|
||||
//this->cardSizeGB = SD.cardSize() / (1024 * 1024 * 1024);
|
||||
|
||||
Serial.printf("SD Card Size: %llu Bytes\n", this->cardSizeBT);
|
||||
Serial.printf("SD Card Size: %lluKB\n", this->cardSizeKB);
|
||||
//Serial.printf("SD Card Size: %llu Bytes\n", this->cardSizeBT);
|
||||
//Serial.printf("SD Card Size: %lluKB\n", this->cardSizeKB);
|
||||
Serial.printf("SD Card Size: %lluMB\n", this->cardSizeMB);
|
||||
Serial.printf("SD Card Size: %lluGB\n", this->cardSizeGB);
|
||||
//Serial.printf("SD Card Size: %lluGB\n", this->cardSizeGB);
|
||||
|
||||
if (this->supported) {
|
||||
//display_obj.tft.println((byte)(sd_obj.cardSizeMB % 10));
|
||||
@@ -49,8 +49,8 @@ bool SDInterface::initSD() {
|
||||
|
||||
buffer_obj = Buffer();
|
||||
|
||||
if (this->supported)
|
||||
buffer_obj.open(&SD);
|
||||
//if (this->supported)
|
||||
// buffer_obj.open(&SD);
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -63,6 +63,11 @@ void SDInterface::addPacket(uint8_t* buf, uint32_t len) {
|
||||
}
|
||||
}
|
||||
|
||||
void SDInterface::openCapture() {
|
||||
if (this->supported)
|
||||
buffer_obj.open(&SD);
|
||||
}
|
||||
|
||||
void SDInterface::main() {
|
||||
if ((this->supported) && (this->do_save)) {
|
||||
//Serial.println("Saving packet...");
|
||||
|
||||
@@ -14,10 +14,10 @@ class SDInterface {
|
||||
|
||||
public:
|
||||
uint8_t cardType;
|
||||
uint64_t cardSizeBT;
|
||||
uint64_t cardSizeKB;
|
||||
//uint64_t cardSizeBT;
|
||||
//uint64_t cardSizeKB;
|
||||
uint64_t cardSizeMB;
|
||||
uint64_t cardSizeGB;
|
||||
//uint64_t cardSizeGB;
|
||||
bool supported = false;
|
||||
bool do_save = true;
|
||||
|
||||
@@ -26,6 +26,7 @@ class SDInterface {
|
||||
bool initSD();
|
||||
|
||||
void addPacket(uint8_t* buf, uint32_t len);
|
||||
void openCapture();
|
||||
void main();
|
||||
//void savePacket(uint8_t* buf, uint32_t len);
|
||||
};
|
||||
|
||||
@@ -20,14 +20,14 @@ class Web
|
||||
{
|
||||
private:
|
||||
|
||||
const char* host = "esp32marauder";
|
||||
const char* ssid = "MarauderOTA";
|
||||
const char* password = "justcallmekoko";
|
||||
PROGMEM const char* host = "esp32marauder";
|
||||
PROGMEM const char* ssid = "MarauderOTA";
|
||||
PROGMEM const char* password = "justcallmekoko";
|
||||
|
||||
bool serving = false;
|
||||
int num_sta = 0;
|
||||
|
||||
const char* loginIndex =
|
||||
PROGMEM const char* loginIndex =
|
||||
"<form name='loginForm'>"
|
||||
"<table width='20%' bgcolor='A09F9F' align='center'>"
|
||||
"<tr>"
|
||||
@@ -72,7 +72,7 @@ class Web
|
||||
* Server Index Page
|
||||
*/
|
||||
|
||||
const char* serverIndex =
|
||||
PROGMEM const char* serverIndex =
|
||||
"<script src='/jquery.min.js'></script>"
|
||||
"Because the lack of an asynchronous webserver in this Arduino sketch like 'ESPAsyncWebServer', <br/>"
|
||||
"both file 'serverIndex' and 'jquery.min.js' can't be read from the webserver at the same time. <br/><br/>"
|
||||
|
||||
@@ -163,6 +163,20 @@ void WiFiScan::StopScan(uint8_t scan_mode)
|
||||
Serial.println("Stopping BLE scan...");
|
||||
pBLEScan->stop();
|
||||
Serial.println("BLE Scan Stopped");
|
||||
|
||||
|
||||
Serial.println("Clearing BLE Results...");
|
||||
pBLEScan->clearResults();
|
||||
Serial.println("Deinitializing BT Controller...");
|
||||
BLEDevice::deinit();
|
||||
//Serial.println("Disable and Deinit BLE...");
|
||||
//esp_bt_controller_disable();
|
||||
//esp_bt_controller_deinit();
|
||||
//Serial.println("Releasing BLE Memory...");
|
||||
//esp_bt_controller_mem_release(ESP_BT_MODE_BLE);
|
||||
//Serial.println("BT Controller Status: " + (String)esp_bt_controller_get_status());
|
||||
|
||||
|
||||
}
|
||||
|
||||
display_obj.display_buffer->clear();
|
||||
@@ -266,6 +280,9 @@ void WiFiScan::RunPacketMonitor(uint8_t scan_mode, uint16_t color)
|
||||
display_obj.tft.init();
|
||||
display_obj.tft.setRotation(1);
|
||||
display_obj.tft.fillScreen(TFT_BLACK);
|
||||
|
||||
sd_obj.openCapture();
|
||||
|
||||
#ifdef TFT_SHIELD
|
||||
uint16_t calData[5] = { 391, 3491, 266, 3505, 7 }; // Landscape TFT Shield
|
||||
Serial.println("Using TFT Shield");
|
||||
@@ -447,6 +464,24 @@ void WiFiScan::RunBluetoothScan(uint8_t scan_mode, uint16_t color)
|
||||
{
|
||||
display_obj.print_delay_1 = 50;
|
||||
display_obj.print_delay_2 = 20;
|
||||
|
||||
/*
|
||||
esp_bt_controller_config_t bt_cfg = BT_CONTROLLER_INIT_CONFIG_DEFAULT();
|
||||
esp_err_t init_ret = esp_bt_controller_init(&bt_cfg);
|
||||
if (init_ret != ESP_OK)
|
||||
Serial.println("Could not initialize BT Controller: " + (String)init_ret);
|
||||
|
||||
//esp_bt_controller_enable(ESP_BT_MODE_CLASSIC_BT);
|
||||
//esp_bt_controller_disable();
|
||||
|
||||
|
||||
esp_err_t ret = esp_bt_controller_enable(ESP_BT_MODE_BTDM);
|
||||
if (ret != ESP_OK)
|
||||
Serial.println("Could not enable BT Controller: " + (String)ret);
|
||||
|
||||
Serial.println("BT Controller Status: " + (String)esp_bt_controller_get_status());
|
||||
*/
|
||||
|
||||
BLEDevice::init("");
|
||||
pBLEScan = BLEDevice::getScan(); //create new scan
|
||||
if (scan_mode == BT_SCAN_ALL)
|
||||
@@ -463,6 +498,8 @@ void WiFiScan::RunBluetoothScan(uint8_t scan_mode, uint16_t color)
|
||||
display_obj.tft.setTextColor(TFT_CYAN, TFT_BLACK);
|
||||
display_obj.setupScrollArea(display_obj.TOP_FIXED_AREA_2, BOT_FIXED_AREA);
|
||||
pBLEScan->setAdvertisedDeviceCallbacks(new bluetoothScanAllCallback());
|
||||
//bluetoothScanAllCallback myCallbacks;
|
||||
//pBLEScan->setAdvertisedDeviceCallbacks(&myCallbacks);
|
||||
}
|
||||
else if (scan_mode == BT_SCAN_SKIMMERS)
|
||||
{
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
#include <math.h>
|
||||
#include "esp_wifi.h"
|
||||
#include "esp_wifi_types.h"
|
||||
#include "esp_bt.h"
|
||||
#include "Display.h"
|
||||
#include "SDInterface.h"
|
||||
#include "Buffer.h"
|
||||
|
||||
Reference in New Issue
Block a user