mirror of
https://github.com/justcallmekoko/ESP32Marauder.git
synced 2026-08-02 17:08:34 -07:00
@@ -3,7 +3,6 @@ name: Build and Push
|
||||
on:
|
||||
workflow_dispatch:
|
||||
pull_request:
|
||||
types: [opened, reopened]
|
||||
|
||||
jobs:
|
||||
# This workflow contains a single job called "build"
|
||||
@@ -205,27 +204,6 @@ jobs:
|
||||
run: |
|
||||
mv ./esp32_marauder/build/esp32.esp32.esp32s2/esp32_marauder.ino.bin ./esp32_marauder/build/esp32.esp32.esp32s2/esp32_marauder.flipper.bin
|
||||
|
||||
- name: Configure SD Serial for Flipper Zero SD Serial
|
||||
run: |
|
||||
pwd
|
||||
sed -i 's/^ \/\/#define WRITE_PACKETS_SERIAL/ #define WRITE_PACKETS_SERIAL/' esp32_marauder/configs.h
|
||||
|
||||
- name: Build Marauder SD Serial for Flipper Zero WiFi Dev Board
|
||||
uses: ArminJo/arduino-test-compile@v3.2.1
|
||||
with:
|
||||
sketch-names: esp32_marauder.ino
|
||||
arduino-board-fqbn: esp32:esp32:esp32s2:PartitionScheme=min_spiffs,FlashSize=4M,PSRAM=enabled
|
||||
extra-arduino-cli-args: "--warnings none"
|
||||
|
||||
- name: Rename Marauder Flipper SD Serial bin
|
||||
run: |
|
||||
mv ./esp32_marauder/build/esp32.esp32.esp32s2/esp32_marauder.ino.bin ./esp32_marauder/build/esp32.esp32.esp32s2/esp32_marauder.flipper_sd_serial.bin
|
||||
|
||||
- name: Remove SD Serial
|
||||
run: |
|
||||
pwd
|
||||
sed -i 's/^ #define WRITE_PACKETS_SERIAL/ \/\/#define WRITE_PACKETS_SERIAL/' esp32_marauder/configs.h
|
||||
|
||||
- name: Build Marauder for Flipper Zero Multi Board
|
||||
uses: ArminJo/arduino-test-compile@v3.2.1
|
||||
with:
|
||||
@@ -464,13 +442,6 @@ jobs:
|
||||
path: ./esp32_marauder/build/esp32.esp32.esp32s2/esp32_marauder.flipper.bin
|
||||
retention-days: 5
|
||||
|
||||
- name: 'Upload Flipper SD Serial Artifact'
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: esp32_marauder.flipper_sd_serial.bin
|
||||
path: ./esp32_marauder/build/esp32.esp32.esp32s2/esp32_marauder.flipper_sd_serial.bin
|
||||
retention-days: 5
|
||||
|
||||
- name: 'Upload MultiboardS3 Artifact'
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
@@ -558,18 +529,6 @@ jobs:
|
||||
asset_content_type: application/bin
|
||||
if: github.event_name != 'pull_request'
|
||||
|
||||
- name: Upload Flipper SD Serial Asset
|
||||
id: upload-flipper-sd-serial-release-asset
|
||||
uses: actions/upload-release-asset@v1
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
||||
asset_path: ./esp32_marauder/build/esp32.esp32.esp32s2/esp32_marauder.flipper_sd_serial.bin
|
||||
asset_name: esp32_marauder.flipper_sd_serial.bin
|
||||
asset_content_type: application/bin
|
||||
if: github.event_name != 'pull_request'
|
||||
|
||||
- name: Upload MultiboardS3 Asset
|
||||
id: upload-multiboardS3-release-asset
|
||||
uses: actions/upload-release-asset@v1
|
||||
|
||||
+93
-98
@@ -6,17 +6,17 @@ Buffer::Buffer(){
|
||||
bufB = (uint8_t*)malloc(BUF_SIZE);
|
||||
}
|
||||
|
||||
void Buffer::createPcapFile(fs::FS* fs, String fn, bool log){
|
||||
void Buffer::createFile(String name, bool is_pcap){
|
||||
int i=0;
|
||||
if (!log) {
|
||||
if (is_pcap) {
|
||||
do{
|
||||
fileName = "/"+fn+"_"+(String)i+".pcap";
|
||||
fileName = "/"+name+"_"+(String)i+".pcap";
|
||||
i++;
|
||||
} while(fs->exists(fileName));
|
||||
}
|
||||
else {
|
||||
do{
|
||||
fileName = "/"+fn+"_"+(String)i+".log";
|
||||
fileName = "/"+name+"_"+(String)i+".log";
|
||||
i++;
|
||||
} while(fs->exists(fileName));
|
||||
}
|
||||
@@ -27,7 +27,7 @@ void Buffer::createPcapFile(fs::FS* fs, String fn, bool log){
|
||||
file.close();
|
||||
}
|
||||
|
||||
void Buffer::open(bool log){
|
||||
void Buffer::open(bool is_pcap){
|
||||
bufSizeA = 0;
|
||||
bufSizeB = 0;
|
||||
|
||||
@@ -35,7 +35,7 @@ void Buffer::open(bool log){
|
||||
|
||||
writing = true;
|
||||
|
||||
if (!log) {
|
||||
if (is_pcap) {
|
||||
write(uint32_t(0xa1b2c3d4)); // magic number
|
||||
write(uint16_t(2)); // major version number
|
||||
write(uint16_t(4)); // minor version number
|
||||
@@ -46,14 +46,35 @@ void Buffer::open(bool log){
|
||||
}
|
||||
}
|
||||
|
||||
void Buffer::close(fs::FS* fs){
|
||||
if(!writing) return;
|
||||
forceSave(fs);
|
||||
writing = false;
|
||||
Serial.println(text01);
|
||||
void Buffer::openFile(String file_name, fs::FS* fs, bool serial, bool is_pcap) {
|
||||
bool save_pcap = settings_obj.loadSetting<bool>("SavePCAP");
|
||||
if (!save_pcap) {
|
||||
this->fs = NULL;
|
||||
this->serial = false;
|
||||
writing = false;
|
||||
return;
|
||||
}
|
||||
this->fs = fs;
|
||||
this->serial = serial;
|
||||
if (this->fs) {
|
||||
createFile(file_name, is_pcap);
|
||||
}
|
||||
if (this->fs || this->serial) {
|
||||
open(is_pcap);
|
||||
} else {
|
||||
writing = false;
|
||||
}
|
||||
}
|
||||
|
||||
void Buffer::addPacket(uint8_t* buf, uint32_t len, bool log){
|
||||
void Buffer::pcapOpen(String file_name, fs::FS* fs, bool serial) {
|
||||
openFile(file_name, fs, serial, true);
|
||||
}
|
||||
|
||||
void Buffer::logOpen(String file_name, fs::FS* fs, bool serial) {
|
||||
openFile(file_name, fs, serial, false);
|
||||
}
|
||||
|
||||
void Buffer::add(const uint8_t* buf, uint32_t len, bool is_pcap){
|
||||
// buffer is full -> drop packet
|
||||
if((useA && bufSizeA + len >= BUF_SIZE && bufSizeB > 0) || (!useA && bufSizeB + len >= BUF_SIZE && bufSizeA > 0)){
|
||||
//Serial.print(";");
|
||||
@@ -74,7 +95,7 @@ void Buffer::addPacket(uint8_t* buf, uint32_t len, bool log){
|
||||
|
||||
microSeconds -= seconds*1000*1000; // e.g. 45200400 - 45*1000*1000 = 45200400 - 45000000 = 400us (because we only need the offset)
|
||||
|
||||
if (!log) {
|
||||
if (is_pcap) {
|
||||
write(seconds); // ts_sec
|
||||
write(microSeconds); // ts_usec
|
||||
write(len); // incl_len
|
||||
@@ -84,6 +105,20 @@ void Buffer::addPacket(uint8_t* buf, uint32_t len, bool log){
|
||||
write(buf, len); // packet payload
|
||||
}
|
||||
|
||||
void Buffer::append(wifi_promiscuous_pkt_t *packet, int len) {
|
||||
bool save_packet = settings_obj.loadSetting<bool>(text_table4[7]);
|
||||
if (save_packet) {
|
||||
add(packet->payload, len, true);
|
||||
}
|
||||
}
|
||||
|
||||
void Buffer::append(String log) {
|
||||
bool save_packet = settings_obj.loadSetting<bool>(text_table4[7]);
|
||||
if (save_packet) {
|
||||
add((const uint8_t*)log.c_str(), log.length(), false);
|
||||
}
|
||||
}
|
||||
|
||||
void Buffer::write(int32_t n){
|
||||
uint8_t buf[4];
|
||||
buf[0] = n;
|
||||
@@ -109,8 +144,9 @@ void Buffer::write(uint16_t n){
|
||||
write(buf,2);
|
||||
}
|
||||
|
||||
void Buffer::write(uint8_t* buf, uint32_t len){
|
||||
void Buffer::write(const uint8_t* buf, uint32_t len){
|
||||
if(!writing) return;
|
||||
while(saving) delay(10);
|
||||
|
||||
if(useA){
|
||||
memcpy(&bufA[bufSizeA], buf, len);
|
||||
@@ -121,127 +157,86 @@ void Buffer::write(uint8_t* buf, uint32_t len){
|
||||
}
|
||||
}
|
||||
|
||||
void Buffer::save(fs::FS* fs){
|
||||
if(saving) return; // makes sure the function isn't called simultaneously on different cores
|
||||
|
||||
// buffers are already emptied, therefor saving is unecessary
|
||||
if((useA && bufSizeB == 0) || (!useA && bufSizeA == 0)){
|
||||
//Serial.printf("useA: %s, bufA %u, bufB %u\n",useA ? "true" : "false",bufSizeA,bufSizeB); // for debug porpuses
|
||||
return;
|
||||
}
|
||||
|
||||
//Serial.println("saving file");
|
||||
|
||||
uint32_t startTime = millis();
|
||||
uint32_t finishTime;
|
||||
|
||||
file = fs->open(fileName, FILE_APPEND);
|
||||
if (!file) {
|
||||
Serial.println(text02 + fileName+"'");
|
||||
//useSD = false;
|
||||
return;
|
||||
}
|
||||
|
||||
saving = true;
|
||||
|
||||
uint32_t len;
|
||||
|
||||
if(useA){
|
||||
file.write(bufB, bufSizeB);
|
||||
len = bufSizeB;
|
||||
bufSizeB = 0;
|
||||
}
|
||||
else{
|
||||
file.write(bufA, bufSizeA);
|
||||
len = bufSizeA;
|
||||
bufSizeA = 0;
|
||||
}
|
||||
|
||||
file.close();
|
||||
|
||||
finishTime = millis() - startTime;
|
||||
|
||||
//Serial.printf("\n%u bytes written for %u ms\n", len, finishTime);
|
||||
|
||||
saving = false;
|
||||
|
||||
}
|
||||
|
||||
void Buffer::forceSave(fs::FS* fs){
|
||||
uint32_t len = bufSizeA + bufSizeB;
|
||||
if(len == 0) return;
|
||||
|
||||
void Buffer::saveFs(){
|
||||
file = fs->open(fileName, FILE_APPEND);
|
||||
if (!file) {
|
||||
Serial.println(text02+fileName+"'");
|
||||
//useSD = false;
|
||||
return;
|
||||
}
|
||||
|
||||
saving = true;
|
||||
writing = false;
|
||||
|
||||
if(useA){
|
||||
|
||||
if(bufSizeB > 0){
|
||||
file.write(bufB, bufSizeB);
|
||||
bufSizeB = 0;
|
||||
}
|
||||
|
||||
if(bufSizeA > 0){
|
||||
file.write(bufA, bufSizeA);
|
||||
bufSizeA = 0;
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
if(bufSizeA > 0){
|
||||
file.write(bufA, bufSizeA);
|
||||
bufSizeA = 0;
|
||||
}
|
||||
|
||||
if(bufSizeB > 0){
|
||||
file.write(bufB, bufSizeB);
|
||||
bufSizeB = 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
file.close();
|
||||
|
||||
//Serial.printf("saved %u bytes\n",len);
|
||||
|
||||
saving = false;
|
||||
writing = true;
|
||||
}
|
||||
|
||||
void Buffer::forceSaveSerial() {
|
||||
uint32_t len = bufSizeA + bufSizeB;
|
||||
if(len == 0) return;
|
||||
void Buffer::saveSerial() {
|
||||
// Saves to main console UART, user-facing app will ignore these markers
|
||||
// Uses / and ] in markers as they are illegal characters for SSIDs
|
||||
const char* mark_begin = "[BUF/BEGIN]";
|
||||
const size_t mark_begin_len = strlen(mark_begin);
|
||||
const char* mark_close = "[BUF/CLOSE]";
|
||||
const size_t mark_close_len = strlen(mark_close);
|
||||
|
||||
saving = true;
|
||||
writing = false;
|
||||
// Additional buffer and memcpy's so that a single Serial.write() is called
|
||||
// This is necessary so that other console output isn't mixed into buffer stream
|
||||
uint8_t* buf = (uint8_t*)malloc(mark_begin_len + bufSizeA + bufSizeB + mark_close_len);
|
||||
uint8_t* it = buf;
|
||||
memcpy(it, mark_begin, mark_begin_len);
|
||||
it += mark_begin_len;
|
||||
|
||||
if(useA){
|
||||
if(bufSizeB > 0){
|
||||
Serial1.write(bufB, bufSizeB);
|
||||
bufSizeB = 0;
|
||||
memcpy(it, bufB, bufSizeB);
|
||||
it += bufSizeB;
|
||||
}
|
||||
if(bufSizeA > 0){
|
||||
Serial1.write(bufA, bufSizeA);
|
||||
bufSizeA = 0;
|
||||
memcpy(it, bufA, bufSizeA);
|
||||
it += bufSizeA;
|
||||
}
|
||||
} else {
|
||||
if(bufSizeA > 0){
|
||||
Serial1.write(bufA, bufSizeA);
|
||||
bufSizeA = 0;
|
||||
memcpy(it, bufA, bufSizeA);
|
||||
it += bufSizeA;
|
||||
}
|
||||
if(bufSizeB > 0){
|
||||
Serial1.write(bufB, bufSizeB);
|
||||
bufSizeB = 0;
|
||||
memcpy(it, bufB, bufSizeB);
|
||||
it += bufSizeB;
|
||||
}
|
||||
}
|
||||
|
||||
saving = false;
|
||||
writing = true;
|
||||
memcpy(it, mark_close, mark_close_len);
|
||||
it += mark_close_len;
|
||||
Serial.write(buf, it - buf);
|
||||
free(buf);
|
||||
}
|
||||
|
||||
void Buffer::save() {
|
||||
saving = true;
|
||||
|
||||
if((bufSizeA + bufSizeB) == 0){
|
||||
saving = false;
|
||||
return;
|
||||
}
|
||||
|
||||
if(this->fs) saveFs();
|
||||
if(this->serial) saveSerial();
|
||||
|
||||
bufSizeA = 0;
|
||||
bufSizeB = 0;
|
||||
|
||||
saving = false;
|
||||
}
|
||||
|
||||
+15
-9
@@ -6,7 +6,7 @@
|
||||
#include "Arduino.h"
|
||||
#include "FS.h"
|
||||
#include "settings.h"
|
||||
//#include "SD_MMC.h"
|
||||
#include "esp_wifi_types.h"
|
||||
|
||||
#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
|
||||
@@ -18,18 +18,22 @@ extern Settings settings_obj;
|
||||
class Buffer {
|
||||
public:
|
||||
Buffer();
|
||||
void createPcapFile(fs::FS* fs, String fn = "", bool log = false);
|
||||
void open(bool log = false);
|
||||
void close(fs::FS* fs);
|
||||
void addPacket(uint8_t* buf, uint32_t len, bool log = false);
|
||||
void save(fs::FS* fs);
|
||||
void forceSave(fs::FS* fs);
|
||||
void forceSaveSerial();
|
||||
void pcapOpen(String file_name, fs::FS* fs, bool serial);
|
||||
void logOpen(String file_name, fs::FS* fs, bool serial);
|
||||
void append(wifi_promiscuous_pkt_t *packet, int len);
|
||||
void append(String log);
|
||||
void save();
|
||||
private:
|
||||
void createFile(String name, bool is_pcap);
|
||||
void open(bool is_pcap);
|
||||
void openFile(String file_name, fs::FS* fs, bool serial, bool is_pcap);
|
||||
void add(const uint8_t* buf, uint32_t len, bool is_pcap);
|
||||
void write(int32_t n);
|
||||
void write(uint32_t n);
|
||||
void write(uint16_t n);
|
||||
void write(uint8_t* buf, uint32_t len);
|
||||
void write(const uint8_t* buf, uint32_t len);
|
||||
void saveFs();
|
||||
void saveSerial();
|
||||
|
||||
uint8_t* bufA;
|
||||
uint8_t* bufB;
|
||||
@@ -43,6 +47,8 @@ class Buffer {
|
||||
|
||||
String fileName = "/0.pcap";
|
||||
File file;
|
||||
fs::FS* fs;
|
||||
bool serial;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -9,9 +9,6 @@ void CommandLine::RunSetup() {
|
||||
Serial.println(F("\n\n--------------------------------\n"));
|
||||
Serial.println(F(" ESP32 Marauder \n"));
|
||||
Serial.println(" " + version_number + "\n");
|
||||
#ifdef WRITE_PACKETS_SERIAL
|
||||
Serial.println(F(" >> Serial \n"));
|
||||
#endif
|
||||
Serial.println(F(" By: justcallmekoko\n"));
|
||||
Serial.println(F("--------------------------------\n\n"));
|
||||
|
||||
@@ -508,6 +505,9 @@ void CommandLine::runCommand(String input) {
|
||||
|
||||
//// WiFi/Bluetooth Scan/Attack commands
|
||||
if (!wifi_scan_obj.scanning()) {
|
||||
// Dump pcap/log to serial too, valid for all scan/attack commands
|
||||
wifi_scan_obj.save_serial = this->argSearch(&cmd_args, "-serial") != -1;
|
||||
|
||||
// Signal strength scan
|
||||
if (cmd_args.get(0) == SIGSTREN_CMD) {
|
||||
Serial.println("Starting Signal Strength Scan. Stop with " + (String)STOPSCAN_CMD);
|
||||
@@ -1035,21 +1035,17 @@ void CommandLine::runCommand(String input) {
|
||||
//}
|
||||
// Update via SD
|
||||
if (sd_sw != -1) {
|
||||
#ifdef HAS_SD
|
||||
#ifndef WRITE_PACKETS_SERIAL
|
||||
if (!sd_obj.supported) {
|
||||
Serial.println("SD card is not connected. Cannot perform SD Update");
|
||||
return;
|
||||
}
|
||||
wifi_scan_obj.currentScanMode = OTA_UPDATE;
|
||||
sd_obj.runUpdate();
|
||||
#else
|
||||
Serial.println("SD card not initialized. Cannot perform SD Update");
|
||||
#endif
|
||||
#else
|
||||
Serial.println("SD card support disabled. Cannot perform SD Update");
|
||||
return;
|
||||
#endif
|
||||
#ifdef HAS_SD
|
||||
if (!sd_obj.supported) {
|
||||
Serial.println("SD card is not connected. Cannot perform SD Update");
|
||||
return;
|
||||
}
|
||||
wifi_scan_obj.currentScanMode = OTA_UPDATE;
|
||||
sd_obj.runUpdate();
|
||||
#else
|
||||
Serial.println("SD card support disabled. Cannot perform SD Update");
|
||||
return;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -92,41 +92,37 @@ bool EvilPortal::setHtml() {
|
||||
return true;
|
||||
}
|
||||
Serial.println("Setting HTML...");
|
||||
#ifndef WRITE_PACKETS_SERIAL
|
||||
File html_file = sd_obj.getFile("/" + this->target_html_name);
|
||||
if (!html_file) {
|
||||
File html_file = sd_obj.getFile("/" + this->target_html_name);
|
||||
if (!html_file) {
|
||||
#ifdef HAS_SCREEN
|
||||
this->sendToDisplay("Could not find /" + this->target_html_name);
|
||||
this->sendToDisplay("Touch to exit...");
|
||||
#endif
|
||||
Serial.println("Could not find /" + this->target_html_name + ". Use stopscan...");
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
if (html_file.size() > MAX_HTML_SIZE) {
|
||||
#ifdef HAS_SCREEN
|
||||
this->sendToDisplay("Could not find /" + this->target_html_name);
|
||||
this->sendToDisplay("The given HTML is too large.");
|
||||
this->sendToDisplay("The Byte limit is " + (String)MAX_HTML_SIZE);
|
||||
this->sendToDisplay("Touch to exit...");
|
||||
#endif
|
||||
Serial.println("Could not find /" + this->target_html_name + ". Use stopscan...");
|
||||
Serial.println("The provided HTML is too large. Byte limit is " + (String)MAX_HTML_SIZE + "\nUse stopscan...");
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
if (html_file.size() > MAX_HTML_SIZE) {
|
||||
#ifdef HAS_SCREEN
|
||||
this->sendToDisplay("The given HTML is too large.");
|
||||
this->sendToDisplay("The Byte limit is " + (String)MAX_HTML_SIZE);
|
||||
this->sendToDisplay("Touch to exit...");
|
||||
#endif
|
||||
Serial.println("The provided HTML is too large. Byte limit is " + (String)MAX_HTML_SIZE + "\nUse stopscan...");
|
||||
return false;
|
||||
}
|
||||
String html = "";
|
||||
while (html_file.available()) {
|
||||
char c = html_file.read();
|
||||
if (isPrintable(c))
|
||||
html.concat(c);
|
||||
}
|
||||
strncpy(index_html, html.c_str(), strlen(html.c_str()));
|
||||
this->has_html = true;
|
||||
Serial.println("html set");
|
||||
html_file.close();
|
||||
return true;
|
||||
String html = "";
|
||||
while (html_file.available()) {
|
||||
char c = html_file.read();
|
||||
if (isPrintable(c))
|
||||
html.concat(c);
|
||||
}
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
strncpy(index_html, html.c_str(), strlen(html.c_str()));
|
||||
this->has_html = true;
|
||||
Serial.println("html set");
|
||||
html_file.close();
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -143,47 +139,43 @@ bool EvilPortal::setAP(LinkedList<ssid>* ssids, LinkedList<AccessPoint>* access_
|
||||
// If there are no SSIDs and there are no APs selected, pull from file
|
||||
// This means the file is last resort
|
||||
if ((ssids->size() <= 0) && (temp_ap_name == "")) {
|
||||
#ifndef WRITE_PACKETS_SERIAL
|
||||
File ap_config_file = sd_obj.getFile("/ap.config.txt");
|
||||
// Could not open config file. return false
|
||||
if (!ap_config_file) {
|
||||
File ap_config_file = sd_obj.getFile("/ap.config.txt");
|
||||
// Could not open config file. return false
|
||||
if (!ap_config_file) {
|
||||
#ifdef HAS_SCREEN
|
||||
this->sendToDisplay("Could not find /ap.config.txt.");
|
||||
this->sendToDisplay("Touch to exit...");
|
||||
#endif
|
||||
Serial.println("Could not find /ap.config.txt. Use stopscan...");
|
||||
return false;
|
||||
}
|
||||
// Config file good. Proceed
|
||||
else {
|
||||
// ap name too long. return false
|
||||
if (ap_config_file.size() > MAX_AP_NAME_SIZE) {
|
||||
#ifdef HAS_SCREEN
|
||||
this->sendToDisplay("Could not find /ap.config.txt.");
|
||||
this->sendToDisplay("The given AP name is too large.");
|
||||
this->sendToDisplay("The Byte limit is " + (String)MAX_AP_NAME_SIZE);
|
||||
this->sendToDisplay("Touch to exit...");
|
||||
#endif
|
||||
Serial.println("Could not find /ap.config.txt. Use stopscan...");
|
||||
Serial.println("The provided AP name is too large. Byte limit is " + (String)MAX_AP_NAME_SIZE + "\nUse stopscan...");
|
||||
return false;
|
||||
}
|
||||
// Config file good. Proceed
|
||||
else {
|
||||
// ap name too long. return false
|
||||
if (ap_config_file.size() > MAX_AP_NAME_SIZE) {
|
||||
#ifdef HAS_SCREEN
|
||||
this->sendToDisplay("The given AP name is too large.");
|
||||
this->sendToDisplay("The Byte limit is " + (String)MAX_AP_NAME_SIZE);
|
||||
this->sendToDisplay("Touch to exit...");
|
||||
#endif
|
||||
Serial.println("The provided AP name is too large. Byte limit is " + (String)MAX_AP_NAME_SIZE + "\nUse stopscan...");
|
||||
return false;
|
||||
// AP name length good. Read from file into var
|
||||
while (ap_config_file.available()) {
|
||||
char c = ap_config_file.read();
|
||||
Serial.print(c);
|
||||
if (isPrintable(c)) {
|
||||
ap_config.concat(c);
|
||||
}
|
||||
// AP name length good. Read from file into var
|
||||
while (ap_config_file.available()) {
|
||||
char c = ap_config_file.read();
|
||||
Serial.print(c);
|
||||
if (isPrintable(c)) {
|
||||
ap_config.concat(c);
|
||||
}
|
||||
}
|
||||
#ifdef HAS_SCREEN
|
||||
this->sendToDisplay("AP name from config file");
|
||||
this->sendToDisplay("AP name: " + ap_config);
|
||||
#endif
|
||||
Serial.println("AP name from config file: " + ap_config);
|
||||
ap_config_file.close();
|
||||
}
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
#ifdef HAS_SCREEN
|
||||
this->sendToDisplay("AP name from config file");
|
||||
this->sendToDisplay("AP name: " + ap_config);
|
||||
#endif
|
||||
Serial.println("AP name from config file: " + ap_config);
|
||||
ap_config_file.close();
|
||||
}
|
||||
}
|
||||
// There are SSIDs in the list but there could also be an AP selected
|
||||
// Priority is SSID list before AP selected and config file
|
||||
@@ -272,37 +264,6 @@ void EvilPortal::startPortal() {
|
||||
this->runServer = true;
|
||||
}
|
||||
|
||||
void EvilPortal::convertStringToUint8Array(const String& str, uint8_t*& buf, uint32_t& len) {
|
||||
len = str.length(); // Obtain the length of the string
|
||||
|
||||
buf = new uint8_t[len]; // Dynamically allocate the buffer
|
||||
|
||||
// Copy each character from the string to the buffer
|
||||
for (uint32_t i = 0; i < len; i++) {
|
||||
buf[i] = static_cast<uint8_t>(str.charAt(i));
|
||||
}
|
||||
}
|
||||
|
||||
void EvilPortal::addLog(String log, int len) {
|
||||
bool save_packet = settings_obj.loadSetting<bool>(text_table4[7]);
|
||||
if (save_packet) {
|
||||
uint8_t* logBuffer = nullptr;
|
||||
uint32_t logLength = 0;
|
||||
this->convertStringToUint8Array(log, logBuffer, logLength);
|
||||
|
||||
#ifdef WRITE_PACKETS_SERIAL
|
||||
buffer_obj.addPacket(logBuffer, logLength, true);
|
||||
delete[] logBuffer;
|
||||
#elif defined(HAS_SD)
|
||||
sd_obj.addPacket(logBuffer, logLength, true);
|
||||
delete[] logBuffer;
|
||||
#else
|
||||
delete[] logBuffer;
|
||||
return;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
void EvilPortal::sendToDisplay(String msg) {
|
||||
#ifdef HAS_SCREEN
|
||||
String display_string = "";
|
||||
@@ -329,7 +290,7 @@ void EvilPortal::main(uint8_t scan_mode) {
|
||||
String logValue2 = "p: " + this->password;
|
||||
String full_string = logValue1 + " " + logValue2 + "\n";
|
||||
Serial.print(full_string);
|
||||
this->addLog(full_string, full_string.length());
|
||||
buffer_obj.append(full_string);
|
||||
#ifdef HAS_SCREEN
|
||||
this->sendToDisplay(full_string);
|
||||
#endif
|
||||
|
||||
@@ -13,17 +13,12 @@
|
||||
#include "Display.h"
|
||||
#include <LinkedList.h>
|
||||
#endif
|
||||
#ifndef WRITE_PACKETS_SERIAL
|
||||
#include "SDInterface.h"
|
||||
#else
|
||||
#include "Buffer.h"
|
||||
#endif
|
||||
#include "SDInterface.h"
|
||||
#include "Buffer.h"
|
||||
#include "lang_var.h"
|
||||
|
||||
extern Settings settings_obj;
|
||||
#ifndef WRITE_PACKETS_SERIAL
|
||||
extern SDInterface sd_obj;
|
||||
#endif
|
||||
extern SDInterface sd_obj;
|
||||
#ifdef HAS_SCREEN
|
||||
extern Display display_obj;
|
||||
#endif
|
||||
@@ -95,7 +90,6 @@ class EvilPortal {
|
||||
void setupServer();
|
||||
void startPortal();
|
||||
void startAP();
|
||||
void convertStringToUint8Array(const String& str, uint8_t*& buf, uint32_t& len);
|
||||
void sendToDisplay(String msg);
|
||||
|
||||
public:
|
||||
@@ -111,7 +105,6 @@ class EvilPortal {
|
||||
String get_user_name();
|
||||
String get_password();
|
||||
void setup();
|
||||
void addLog(String log, int len);
|
||||
bool begin(LinkedList<ssid>* ssids, LinkedList<AccessPoint>* access_points);
|
||||
void main(uint8_t scan_mode);
|
||||
void setHtmlFromSerial();
|
||||
|
||||
@@ -8,26 +8,31 @@ char nmeaBuffer[100];
|
||||
|
||||
MicroNMEA nmea(nmeaBuffer, sizeof(nmeaBuffer));
|
||||
|
||||
#ifndef GPS_SOFTWARE_SERIAL
|
||||
HardwareSerial Serial2(GPS_SERIAL_INDEX);
|
||||
#else
|
||||
EspSoftwareSerial::UART Serial2;
|
||||
#endif
|
||||
HardwareSerial Serial2(GPS_SERIAL_INDEX);
|
||||
|
||||
void GpsInterface::begin() {
|
||||
|
||||
#ifndef GPS_SOFTWARE_SERIAL
|
||||
Serial2.begin(9600, SERIAL_8N1, GPS_TX, GPS_RX);
|
||||
#else
|
||||
Serial2.begin(9600, SWSERIAL_8N1, GPS_TX, GPS_RX);
|
||||
#ifdef MARAUDER_MINI
|
||||
pinMode(26, OUTPUT);
|
||||
|
||||
delay(1);
|
||||
|
||||
analogWrite(26, 243);
|
||||
delay(1);
|
||||
|
||||
Serial.println("Activated GPS");
|
||||
delay(100);
|
||||
#endif
|
||||
|
||||
|
||||
Serial2.begin(9600, SERIAL_8N1, GPS_TX, GPS_RX);
|
||||
|
||||
MicroNMEA::sendSentence(Serial2, "$PSTMSETPAR,1201,0x00000042");
|
||||
MicroNMEA::sendSentence(Serial2, "$PSTMSAVEPAR");
|
||||
|
||||
MicroNMEA::sendSentence(Serial2, "$PSTMSRR");
|
||||
|
||||
delay(4000);
|
||||
delay(3900);
|
||||
|
||||
if (Serial2.available()) {
|
||||
Serial.println("GPS Attached Successfully");
|
||||
@@ -35,11 +40,17 @@ void GpsInterface::begin() {
|
||||
while (Serial2.available())
|
||||
Serial2.read();
|
||||
}
|
||||
else {
|
||||
this->gps_enabled = false;
|
||||
Serial.println("GPS Not Found");
|
||||
}
|
||||
|
||||
|
||||
this->type_flag=GPSTYPE_NATIVE; //enforce default
|
||||
this->disable_queue(); //init the queue, disabled, kill NULLs
|
||||
|
||||
nmea.setUnknownSentenceHandler(gps_nmea_notimp);
|
||||
|
||||
}
|
||||
|
||||
//passthrough for other objects
|
||||
@@ -102,8 +113,8 @@ void GpsInterface::enqueue(MicroNMEA& nmea){
|
||||
if(this->text_in){
|
||||
int size=text_in->size();
|
||||
if(size){
|
||||
#ifdef GPS_TEXT_MAXCOPIES
|
||||
if(this->text_cycles>=GPS_TEXT_MAXCOPIES){
|
||||
#ifdef GPS_TEXT_MAXCYCLES
|
||||
if(this->text_cycles>=GPS_TEXT_MAXCYCLES){
|
||||
#else
|
||||
if(this->text_cycles){
|
||||
#endif
|
||||
@@ -158,8 +169,8 @@ void GpsInterface::enqueue(MicroNMEA& nmea){
|
||||
#else
|
||||
if(size>=5){
|
||||
#endif
|
||||
#ifdef GPS_TEXT_MAXCOPIES
|
||||
if(this->text_cycles>=GPS_TEXT_MAXCOPIES){
|
||||
#ifdef GPS_TEXT_MAXCYCLES
|
||||
if(this->text_cycles>=GPS_TEXT_MAXCYCLES){
|
||||
#else
|
||||
if(this->text_cycles){
|
||||
#endif
|
||||
@@ -196,11 +207,25 @@ void GpsInterface::enqueue(MicroNMEA& nmea){
|
||||
this->notparsed_nmea_sentence = nmea_sentence.c_str();
|
||||
|
||||
if(this->queue_enabled_flag){
|
||||
if(!this->queue) this->new_queue();
|
||||
if(enqueue){
|
||||
String enqueue_me=nmea_sentence.c_str();
|
||||
this->queue->add(enqueue_me);
|
||||
nmea_sentence_t line = { unparsed, msg_id, nmea_sentence.c_str() };
|
||||
|
||||
if(this->queue){
|
||||
#ifdef GPS_NMEA_MAXQUEUE
|
||||
if(this->queue->size()>=GPS_NMEA_MAXQUEUE)
|
||||
#else
|
||||
if(this->queue->size()>=30)
|
||||
#endif
|
||||
this->flush_queue();
|
||||
}
|
||||
else
|
||||
this->new_queue();
|
||||
|
||||
this->queue->add(line);
|
||||
}
|
||||
else
|
||||
if(!this->queue)
|
||||
this->new_queue();
|
||||
}
|
||||
else
|
||||
this->flush_queue();
|
||||
@@ -234,12 +259,12 @@ bool GpsInterface::queue_enabled(){
|
||||
return this->queue_enabled_flag;
|
||||
}
|
||||
|
||||
LinkedList<String>* GpsInterface::get_queue(){
|
||||
LinkedList<nmea_sentence_t>* GpsInterface::get_queue(){
|
||||
return this->queue;
|
||||
}
|
||||
|
||||
void GpsInterface::new_queue(){
|
||||
this->queue=new LinkedList<String>;
|
||||
this->queue=new LinkedList<nmea_sentence_t>;
|
||||
}
|
||||
|
||||
void GpsInterface::flush_queue(){
|
||||
@@ -250,7 +275,7 @@ void GpsInterface::flush_queue(){
|
||||
void GpsInterface::flush_queue_nmea(){
|
||||
if(this->queue){
|
||||
if(this->queue->size()){
|
||||
LinkedList<String> *delme=this->queue;
|
||||
LinkedList<nmea_sentence_t> *delme=this->queue;
|
||||
this->new_queue();
|
||||
delete delme;
|
||||
}
|
||||
|
||||
@@ -10,7 +10,27 @@
|
||||
#include "configs.h"
|
||||
|
||||
//#define GPS_TEXT_MAXLINES 5 //default:5 lines in the buffer maximum
|
||||
//#define GPS_TEXT_MAXCOPIES 1 //default:any nonzero number resets, i.e. one copy
|
||||
//#define GPS_TEXT_MAXCYCLES 1 //default:1
|
||||
|
||||
//#define GPS_NMEA_SCRNLINES TEXT_HEIGHT //default: defined TEXT_HEIGHT from configs.h
|
||||
//#define GPS_NMEA_SCRNWRAP true //default:true, except on MARAUDER_MINI where false
|
||||
//#define GPS_NMEA_MAXQUEUE 30 //default:30 messages max in queue
|
||||
|
||||
#ifdef MARAUDER_MINI
|
||||
#ifndef GPS_NMEA_SCRNWRAP
|
||||
#define GPS_NMEA_SCRNWRAP false
|
||||
#endif
|
||||
#else
|
||||
#ifndef GPS_NMEA_SCRNWRAP
|
||||
#define GPS_NMEA_SCRNWRAP true
|
||||
#endif
|
||||
#endif
|
||||
|
||||
struct nmea_sentence_t {
|
||||
bool unparsed;
|
||||
String type;
|
||||
String sentence;
|
||||
};
|
||||
|
||||
void gps_nmea_notimp(MicroNMEA& nmea);
|
||||
|
||||
@@ -38,7 +58,7 @@ class GpsInterface {
|
||||
void setType(String t);
|
||||
|
||||
void enqueue(MicroNMEA& nmea);
|
||||
LinkedList<String>* get_queue();
|
||||
LinkedList<nmea_sentence_t>* get_queue();
|
||||
void flush_queue();
|
||||
void flush_text();
|
||||
void new_queue();
|
||||
@@ -84,9 +104,9 @@ class GpsInterface {
|
||||
type_t type_flag = GPSTYPE_NATIVE;
|
||||
|
||||
bool queue_enabled_flag=0;
|
||||
LinkedList<String> *queue=NULL;
|
||||
LinkedList<nmea_sentence_t> *queue=NULL;
|
||||
|
||||
int text_cycles=0;
|
||||
unsigned int text_cycles=0;
|
||||
LinkedList<String> *text_in=NULL;
|
||||
LinkedList<String> *text=NULL;
|
||||
|
||||
|
||||
@@ -891,29 +891,31 @@ void MenuFunctions::battery2(bool initial)
|
||||
#else
|
||||
void MenuFunctions::battery(bool initial)
|
||||
{
|
||||
uint16_t the_color;
|
||||
if (battery_obj.i2c_supported)
|
||||
{
|
||||
// Could use int compare maybe idk
|
||||
if (((String)battery_obj.battery_level != "25") && ((String)battery_obj.battery_level != "0"))
|
||||
the_color = TFT_GREEN;
|
||||
else
|
||||
the_color = TFT_RED;
|
||||
#ifdef HAS_BATTERY
|
||||
uint16_t the_color;
|
||||
if (battery_obj.i2c_supported)
|
||||
{
|
||||
// Could use int compare maybe idk
|
||||
if (((String)battery_obj.battery_level != "25") && ((String)battery_obj.battery_level != "0"))
|
||||
the_color = TFT_GREEN;
|
||||
else
|
||||
the_color = TFT_RED;
|
||||
|
||||
if ((battery_obj.battery_level != battery_obj.old_level) || (initial)) {
|
||||
battery_obj.old_level = battery_obj.battery_level;
|
||||
display_obj.tft.fillRect(204, 0, SCREEN_WIDTH, STATUS_BAR_WIDTH, STATUSBAR_COLOR);
|
||||
display_obj.tft.setCursor(0, 1);
|
||||
display_obj.tft.drawXBitmap(186,
|
||||
0,
|
||||
menu_icons[STATUS_BAT],
|
||||
16,
|
||||
16,
|
||||
STATUSBAR_COLOR,
|
||||
the_color);
|
||||
display_obj.tft.drawString((String)battery_obj.battery_level + "%", 204, 0, 2);
|
||||
if ((battery_obj.battery_level != battery_obj.old_level) || (initial)) {
|
||||
battery_obj.old_level = battery_obj.battery_level;
|
||||
display_obj.tft.fillRect(204, 0, SCREEN_WIDTH, STATUS_BAR_WIDTH, STATUSBAR_COLOR);
|
||||
display_obj.tft.setCursor(0, 1);
|
||||
display_obj.tft.drawXBitmap(186,
|
||||
0,
|
||||
menu_icons[STATUS_BAT],
|
||||
16,
|
||||
16,
|
||||
STATUSBAR_COLOR,
|
||||
the_color);
|
||||
display_obj.tft.drawString((String)battery_obj.battery_level + "%", 204, 0, 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
void MenuFunctions::battery2(bool initial)
|
||||
{
|
||||
@@ -991,14 +993,10 @@ void MenuFunctions::updateStatusBar()
|
||||
|
||||
|
||||
// Draw SD info
|
||||
#ifndef WRITE_PACKETS_SERIAL
|
||||
if (sd_obj.supported)
|
||||
the_color = TFT_GREEN;
|
||||
else
|
||||
the_color = TFT_RED;
|
||||
#else
|
||||
if (sd_obj.supported)
|
||||
the_color = TFT_GREEN;
|
||||
else
|
||||
the_color = TFT_RED;
|
||||
#endif
|
||||
|
||||
#ifdef HAS_ILI9341
|
||||
display_obj.tft.drawXBitmap(170,
|
||||
@@ -1080,14 +1078,10 @@ void MenuFunctions::drawStatusBar()
|
||||
MenuFunctions::battery2(true);
|
||||
|
||||
// Draw SD info
|
||||
#ifndef WRITE_PACKETS_SERIAL
|
||||
if (sd_obj.supported)
|
||||
the_color = TFT_GREEN;
|
||||
else
|
||||
the_color = TFT_RED;
|
||||
#else
|
||||
if (sd_obj.supported)
|
||||
the_color = TFT_GREEN;
|
||||
else
|
||||
the_color = TFT_RED;
|
||||
#endif
|
||||
|
||||
#ifdef HAS_ILI9341
|
||||
display_obj.tft.drawXBitmap(170,
|
||||
@@ -1688,6 +1682,7 @@ void MenuFunctions::RunSetup()
|
||||
gpsInfoMenu.parentMenu = &deviceMenu;
|
||||
this->addNodes(&gpsInfoMenu, text09, TFT_LIGHTGREY, NULL, 0, [this]() {
|
||||
wifi_scan_obj.currentScanMode = WIFI_SCAN_OFF;
|
||||
wifi_scan_obj.StartScan(WIFI_SCAN_OFF);
|
||||
this->changeMenu(gpsInfoMenu.parentMenu);
|
||||
});
|
||||
}
|
||||
@@ -1720,12 +1715,10 @@ void MenuFunctions::RunSetup()
|
||||
wifi_scan_obj.currentScanMode = WIFI_SCAN_OFF;
|
||||
this->changeMenu(whichUpdateMenu.parentMenu);
|
||||
});
|
||||
#ifndef WRITE_PACKETS_SERIAL
|
||||
if (sd_obj.supported) addNodes(&whichUpdateMenu, text_table1[40], TFT_MAGENTA, NULL, SD_UPDATE, [this]() {
|
||||
wifi_scan_obj.currentScanMode = OTA_UPDATE;
|
||||
this->changeMenu(&confirmMenu);
|
||||
});
|
||||
#endif
|
||||
if (sd_obj.supported) addNodes(&whichUpdateMenu, text_table1[40], TFT_MAGENTA, NULL, SD_UPDATE, [this]() {
|
||||
wifi_scan_obj.currentScanMode = OTA_UPDATE;
|
||||
this->changeMenu(&confirmMenu);
|
||||
});
|
||||
|
||||
// Confirm SD update menu
|
||||
confirmMenu.parentMenu = &whichUpdateMenu;
|
||||
|
||||
@@ -32,9 +32,9 @@ bool SDInterface::initSD() {
|
||||
- CS (jumper to SD Card GND Pin)
|
||||
*/
|
||||
enum { SPI_SCK = 0, SPI_MISO = 36, SPI_MOSI = 26 };
|
||||
SPIClass SPI_EXT;
|
||||
SPI_EXT.begin(SPI_SCK, SPI_MISO, SPI_MOSI, SD_CS);
|
||||
if (!SD.begin(SD_CS, SPI_EXT)) {
|
||||
this->spiExt = new SPIClass();
|
||||
this->spiExt->begin(SPI_SCK, SPI_MISO, SPI_MOSI, SD_CS);
|
||||
if (!SD.begin(SD_CS, *(this->spiExt))) {
|
||||
#else
|
||||
if (!SD.begin(SD_CS)) {
|
||||
#endif
|
||||
@@ -73,8 +73,6 @@ bool SDInterface::initSD() {
|
||||
this->card_sz = sz;
|
||||
}
|
||||
|
||||
buffer_obj = Buffer();
|
||||
|
||||
if (!SD.exists("/SCRIPTS")) {
|
||||
Serial.println("/SCRIPTS does not exist. Creating...");
|
||||
|
||||
@@ -142,28 +140,6 @@ void SDInterface::listDir(String str_dir){
|
||||
}
|
||||
}
|
||||
|
||||
void SDInterface::addPacket(uint8_t* buf, uint32_t len, bool log) {
|
||||
if ((this->supported) && (this->do_save)) {
|
||||
buffer_obj.addPacket(buf, len, log);
|
||||
}
|
||||
}
|
||||
|
||||
void SDInterface::openCapture(String file_name) {
|
||||
bool save_pcap = settings_obj.loadSetting<bool>("SavePCAP");
|
||||
if ((this->supported) && (save_pcap)) {
|
||||
buffer_obj.createPcapFile(&SD, file_name);
|
||||
buffer_obj.open();
|
||||
}
|
||||
}
|
||||
|
||||
void SDInterface::openLog(String file_name) {
|
||||
bool save_pcap = settings_obj.loadSetting<bool>("SavePCAP");
|
||||
if ((this->supported) && (save_pcap)) {
|
||||
buffer_obj.createPcapFile(&SD, file_name, true);
|
||||
buffer_obj.open(true);
|
||||
}
|
||||
}
|
||||
|
||||
void SDInterface::runUpdate() {
|
||||
#ifdef HAS_SCREEN
|
||||
display_obj.tft.setTextWrap(false);
|
||||
@@ -300,11 +276,7 @@ bool SDInterface::checkDetectPin() {
|
||||
}
|
||||
|
||||
void SDInterface::main() {
|
||||
if ((this->supported) && (this->do_save)) {
|
||||
//Serial.println("Saving packet...");
|
||||
buffer_obj.forceSave(&SD);
|
||||
}
|
||||
else if (!this->supported) {
|
||||
if (!this->supported) {
|
||||
if (checkDetectPin()) {
|
||||
delay(100);
|
||||
this->initSD();
|
||||
|
||||
@@ -26,6 +26,9 @@ extern Settings settings_obj;
|
||||
class SDInterface {
|
||||
|
||||
private:
|
||||
#if defined(MARAUDER_M5STICKC)
|
||||
SPIClass *spiExt;
|
||||
#endif
|
||||
bool checkDetectPin();
|
||||
|
||||
public:
|
||||
@@ -35,7 +38,6 @@ class SDInterface {
|
||||
uint64_t cardSizeMB;
|
||||
//uint64_t cardSizeGB;
|
||||
bool supported = false;
|
||||
bool do_save = true;
|
||||
|
||||
String card_sz;
|
||||
|
||||
@@ -44,13 +46,9 @@ class SDInterface {
|
||||
void listDir(String str_dir);
|
||||
void listDirToLinkedList(LinkedList<String>* file_names, String str_dir = "/", String ext = "");
|
||||
File getFile(String path);
|
||||
void addPacket(uint8_t* buf, uint32_t len, bool log = false);
|
||||
void openCapture(String file_name = "");
|
||||
void openLog(String file_name = "");
|
||||
void runUpdate();
|
||||
void performUpdate(Stream &updateSource, size_t updateSize);
|
||||
void main();
|
||||
//void savePacket(uint8_t* buf, uint32_t len);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
+178
-175
@@ -242,7 +242,7 @@ extern "C" {
|
||||
Serial.print(wardrive_line);
|
||||
|
||||
if (do_save)
|
||||
evil_portal_obj.addLog(wardrive_line, wardrive_line.length());
|
||||
buffer_obj.append(wardrive_line);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -930,15 +930,31 @@ String WiFiScan::freeRAM()
|
||||
return String(s);
|
||||
}
|
||||
|
||||
void WiFiScan::startPcap(String file_name) {
|
||||
buffer_obj.pcapOpen(
|
||||
file_name,
|
||||
#if defined(HAS_SD)
|
||||
sd_obj.supported ? &SD :
|
||||
#endif
|
||||
NULL,
|
||||
save_serial // Set with commandline options
|
||||
);
|
||||
}
|
||||
|
||||
void WiFiScan::startLog(String file_name) {
|
||||
buffer_obj.logOpen(
|
||||
file_name,
|
||||
#if defined(HAS_SD)
|
||||
sd_obj.supported ? &SD :
|
||||
#endif
|
||||
NULL,
|
||||
save_serial // Set with commandline options
|
||||
);
|
||||
}
|
||||
|
||||
void WiFiScan::RunEvilPortal(uint8_t scan_mode, uint16_t color)
|
||||
{
|
||||
#ifdef WRITE_PACKETS_SERIAL
|
||||
buffer_obj.open();
|
||||
#elif defined(HAS_SD)
|
||||
sd_obj.openLog("evil_portal");
|
||||
#else
|
||||
return;
|
||||
#endif
|
||||
startLog("evil_portal");
|
||||
|
||||
#ifdef MARAUDER_FLIPPER
|
||||
flipper_led.sniffLED();
|
||||
@@ -981,13 +997,7 @@ void WiFiScan::RunEvilPortal(uint8_t scan_mode, uint16_t color)
|
||||
// Function to start running a beacon scan
|
||||
void WiFiScan::RunAPScan(uint8_t scan_mode, uint16_t color)
|
||||
{
|
||||
#ifdef WRITE_PACKETS_SERIAL
|
||||
buffer_obj.open();
|
||||
#elif defined(HAS_SD)
|
||||
sd_obj.openCapture("ap");
|
||||
#else
|
||||
return;
|
||||
#endif
|
||||
startPcap("ap");
|
||||
|
||||
#ifdef MARAUDER_FLIPPER
|
||||
flipper_led.sniffLED();
|
||||
@@ -1204,9 +1214,12 @@ void WiFiScan::RunGPSInfo() {
|
||||
|
||||
void WiFiScan::RunGPSNmea() {
|
||||
#ifdef HAS_GPS
|
||||
LinkedList<String> *buffer=gps_obj.get_queue();
|
||||
LinkedList<nmea_sentence_t> *buffer=gps_obj.get_queue();
|
||||
bool queue_enabled=gps_obj.queue_enabled();
|
||||
|
||||
String gxgga = gps_obj.generateGXgga();
|
||||
String gxrmc = gps_obj.generateGXrmc();
|
||||
|
||||
if(!buffer||!queue_enabled)
|
||||
gps_obj.flush_queue();
|
||||
#ifndef HAS_SCREEN
|
||||
@@ -1214,29 +1227,54 @@ void WiFiScan::RunGPSNmea() {
|
||||
gps_obj.flush_text();
|
||||
#else
|
||||
// Get screen position ready
|
||||
display_obj.tft.setTextWrap(true);
|
||||
int offset=100;
|
||||
if((SCREEN_HEIGHT / 3)<offset)
|
||||
offset=SCREEN_HEIGHT/3; //for smaller screens
|
||||
if(offset<(TOP_FIXED_AREA+6))
|
||||
offset=TOP_FIXED_AREA+6; //absolute minimium
|
||||
display_obj.tft.setTextWrap(false);
|
||||
display_obj.tft.setFreeFont(NULL);
|
||||
display_obj.tft.setCursor(0, SCREEN_HEIGHT / 3);
|
||||
display_obj.tft.setCursor(0, offset);
|
||||
display_obj.tft.setTextSize(1);
|
||||
display_obj.tft.setTextColor(TFT_CYAN);
|
||||
display_obj.tft.setTextColor(TFT_GREEN);
|
||||
|
||||
// Clean up screen first
|
||||
display_obj.tft.fillRect(0, (SCREEN_HEIGHT / 3) - 6, SCREEN_WIDTH, SCREEN_HEIGHT - ((SCREEN_HEIGHT / 3) - 6), TFT_BLACK);
|
||||
display_obj.tft.fillRect(0, offset-6, SCREEN_WIDTH, SCREEN_HEIGHT - (offset-6), TFT_BLACK);
|
||||
|
||||
display_obj.tft.setCursor(0, SCREEN_HEIGHT / 3);
|
||||
#ifdef GPS_NMEA_SCRNLINES
|
||||
int lines=GPS_NMEA_SCRNLINES;
|
||||
#else
|
||||
int lines=TEXT_HEIGHT;
|
||||
if(lines>((TFT_HEIGHT-offset-BOT_FIXED_AREA)/10))
|
||||
lines=(TFT_HEIGHT-offset-BOT_FIXED_AREA)/10;
|
||||
#endif
|
||||
|
||||
String text=gps_obj.getText();
|
||||
if(queue_enabled){
|
||||
if(gps_obj.getTextQueueSize()>0)
|
||||
display_obj.tft.print(gps_obj.getTextQueue());
|
||||
int queue=gps_obj.getTextQueueSize();
|
||||
if(queue>0){
|
||||
display_obj.tft.println(gps_obj.getTextQueue());
|
||||
lines-=queue; //used lines for text display
|
||||
}
|
||||
else
|
||||
if(text != "") display_obj.tft.print(text);
|
||||
if(text != ""){
|
||||
display_obj.tft.println(text);
|
||||
lines--;
|
||||
}
|
||||
}
|
||||
else
|
||||
if(text != "") display_obj.tft.print(text);
|
||||
if(text != ""){
|
||||
display_obj.tft.println(text);
|
||||
lines--;
|
||||
}
|
||||
|
||||
//This one doesn't contain self-genned GxGGA or GxRMC, nor does it contain GxTXT, processed above
|
||||
String display_nmea_sentence=gps_obj.getNmeaNotparsed();
|
||||
#if GPS_NMEA_SCRNWRAP
|
||||
lines-=((gxgga.length()-1)/STANDARD_FONT_CHAR_LIMIT) + 1;
|
||||
lines-=((gxrmc.length()-1)/STANDARD_FONT_CHAR_LIMIT) + 1;
|
||||
display_obj.tft.setTextWrap(GPS_NMEA_SCRNWRAP);
|
||||
#else
|
||||
lines-=2; //two self-genned messages
|
||||
#endif
|
||||
#endif
|
||||
|
||||
if(buffer && queue_enabled){
|
||||
@@ -1244,15 +1282,35 @@ void WiFiScan::RunGPSNmea() {
|
||||
if(size){
|
||||
gps_obj.new_queue();
|
||||
for(int i=0;i<size;i++){
|
||||
Serial.println(buffer->get(i));
|
||||
nmea_sentence_t line=buffer->get(i);
|
||||
Serial.println(line.sentence);
|
||||
|
||||
#ifdef HAS_SCREEN
|
||||
if(lines>0){
|
||||
if(line.unparsed){
|
||||
if(line.type != "" && line.type != "TXT" && line.type != "GGA" && line.type != "RMC"){
|
||||
int length=line.sentence.length();
|
||||
if(length){
|
||||
#if GPS_NMEA_SCRNWRAP
|
||||
if((((length-1)/STANDARD_FONT_CHAR_LIMIT) + 1)<=lines){
|
||||
#endif
|
||||
display_obj.tft.println(line.sentence);
|
||||
#if GPS_NMEA_SCRNWRAP
|
||||
lines-=((length-1)/STANDARD_FONT_CHAR_LIMIT) + 1;
|
||||
#else
|
||||
lines--;
|
||||
#endif
|
||||
#if GPS_NMEA_SCRNWRAP
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
delete buffer;
|
||||
}
|
||||
|
||||
#ifdef HAS_SCREEN
|
||||
//This matches the else block, but could later display more of the queue...
|
||||
display_obj.tft.print(display_nmea_sentence);
|
||||
#endif
|
||||
} else {
|
||||
static String old_nmea_sentence="";
|
||||
String nmea_sentence=gps_obj.getNmeaNotimp();
|
||||
@@ -1263,17 +1321,24 @@ void WiFiScan::RunGPSNmea() {
|
||||
}
|
||||
|
||||
#ifdef HAS_SCREEN
|
||||
display_obj.tft.print(display_nmea_sentence);
|
||||
if(lines>0){
|
||||
String display_nmea_sentence=gps_obj.getNmeaNotparsed();
|
||||
int length=display_nmea_sentence.length();
|
||||
if(length)
|
||||
#if GPS_NMEA_SCRNWRAP
|
||||
if((((length-1)/STANDARD_FONT_CHAR_LIMIT) + 1)<=lines)
|
||||
#endif
|
||||
display_obj.tft.println(display_nmea_sentence);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
String gxgga = gps_obj.generateGXgga();
|
||||
String gxrmc = gps_obj.generateGXrmc();
|
||||
|
||||
#ifdef HAS_SCREEN
|
||||
display_obj.tft.print(gxgga);
|
||||
display_obj.tft.print(gxrmc);
|
||||
display_obj.tft.setTextWrap(false);
|
||||
display_obj.tft.println(gxgga);
|
||||
display_obj.tft.println(gxrmc);
|
||||
#if GPS_NMEA_SCRNWRAP
|
||||
display_obj.tft.setTextWrap(false);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
gps_obj.sendSentence(Serial, gxgga.c_str());
|
||||
@@ -1319,11 +1384,7 @@ void WiFiScan::RunInfo()
|
||||
display_obj.tft.println(text_table4[27] + free_ram);
|
||||
#endif
|
||||
|
||||
#ifdef WRITE_PACKETS_SERIAL
|
||||
#ifdef HAS_SCREEN
|
||||
display_obj.tft.println(text_table4[48]);
|
||||
#endif
|
||||
#elif defined(HAS_SD)
|
||||
#if defined(HAS_SD)
|
||||
if (sd_obj.supported) {
|
||||
#ifdef HAS_SCREEN
|
||||
display_obj.tft.println(text_table4[28]);
|
||||
@@ -1337,8 +1398,6 @@ void WiFiScan::RunInfo()
|
||||
display_obj.tft.println(text_table4[31]);
|
||||
#endif
|
||||
}
|
||||
#else
|
||||
return;
|
||||
#endif
|
||||
|
||||
#ifdef HAS_BATTERY
|
||||
@@ -1373,13 +1432,7 @@ void WiFiScan::RunPacketMonitor(uint8_t scan_mode, uint16_t color)
|
||||
led_obj.setMode(MODE_SNIFF);
|
||||
#endif
|
||||
|
||||
#ifdef WRITE_PACKETS_SERIAL
|
||||
buffer_obj.open();
|
||||
#elif defined(HAS_SD)
|
||||
sd_obj.openCapture("packet_monitor");
|
||||
#else
|
||||
return;
|
||||
#endif
|
||||
startPcap("packet_monitor");
|
||||
|
||||
#ifdef HAS_ILI9341
|
||||
|
||||
@@ -1467,11 +1520,7 @@ void WiFiScan::RunEapolScan(uint8_t scan_mode, uint16_t color)
|
||||
display_obj.tft.fillScreen(TFT_BLACK);
|
||||
#endif
|
||||
|
||||
#ifdef WRITE_PACKETS_SERIAL
|
||||
buffer_obj.open();
|
||||
#elif defined(HAS_SD)
|
||||
sd_obj.openCapture("eapol");
|
||||
#endif
|
||||
startPcap("eapol");
|
||||
|
||||
#ifdef HAS_SCREEN
|
||||
#ifdef TFT_SHIELD
|
||||
@@ -1496,13 +1545,7 @@ void WiFiScan::RunEapolScan(uint8_t scan_mode, uint16_t color)
|
||||
display_obj.tftDrawExitScaleButtons();
|
||||
#endif
|
||||
#else
|
||||
#ifdef WRITE_PACKETS_SERIAL
|
||||
buffer_obj.open();
|
||||
#elif defined(HAS_SD)
|
||||
sd_obj.openCapture("eapol");
|
||||
#else
|
||||
return;
|
||||
#endif
|
||||
startPcap("eapol");
|
||||
|
||||
#ifdef HAS_SCREEN
|
||||
display_obj.TOP_FIXED_AREA_2 = 48;
|
||||
@@ -1597,13 +1640,7 @@ void WiFiScan::RunMimicFlood(uint8_t scan_mode, uint16_t color) {
|
||||
|
||||
void WiFiScan::RunPwnScan(uint8_t scan_mode, uint16_t color)
|
||||
{
|
||||
#ifdef WRITE_PACKETS_SERIAL
|
||||
buffer_obj.open();
|
||||
#elif defined(HAS_SD)
|
||||
sd_obj.openCapture("pwnagotchi");
|
||||
#else
|
||||
return;
|
||||
#endif
|
||||
startPcap("pwnagotchi");
|
||||
|
||||
#ifdef MARAUDER_FLIPPER
|
||||
flipper_led.sniffLED();
|
||||
@@ -1766,7 +1803,9 @@ void WiFiScan::executeWarDrive() {
|
||||
String wardrive_line = WiFi.BSSIDstr(i) + "," + ssid + "," + this->security_int_to_string(WiFi.encryptionType(i)) + "," + gps_obj.getDatetime() + "," + (String)WiFi.channel(i) + "," + (String)WiFi.RSSI(i) + "," + gps_obj.getLat() + "," + gps_obj.getLon() + "," + gps_obj.getAlt() + "," + gps_obj.getAccuracy() + ",WIFI\n";
|
||||
Serial.print((String)this->mac_history_cursor + " | " + wardrive_line);
|
||||
|
||||
evil_portal_obj.addLog(wardrive_line, wardrive_line.length());
|
||||
if (do_save) {
|
||||
buffer_obj.append(wardrive_line);
|
||||
}
|
||||
}
|
||||
}
|
||||
this->channelHop();
|
||||
@@ -1780,23 +1819,21 @@ void WiFiScan::executeWarDrive() {
|
||||
// Function to start running a beacon scan
|
||||
void WiFiScan::RunBeaconScan(uint8_t scan_mode, uint16_t color)
|
||||
{
|
||||
#ifdef WRITE_PACKETS_SERIAL
|
||||
buffer_obj.open();
|
||||
#elif defined(HAS_SD)
|
||||
if (scan_mode == WIFI_SCAN_AP)
|
||||
sd_obj.openCapture("beacon");
|
||||
else if (scan_mode == WIFI_SCAN_WAR_DRIVE) {
|
||||
#ifdef HAS_GPS
|
||||
if (gps_obj.getGpsModuleStatus()) {
|
||||
sd_obj.openLog("wardrive");
|
||||
String header_line = "WigleWifi-1.4,appRelease=" + (String)MARAUDER_VERSION + ",model=ESP32 Marauder,release=" + (String)MARAUDER_VERSION + ",device=ESP32 Marauder,display=SPI TFT,board=ESP32 Marauder,brand=JustCallMeKoko\nMAC,SSID,AuthMode,FirstSeen,Channel,RSSI,CurrentLatitude,CurrentLongitude,AltitudeMeters,AccuracyMeters,Type\n";
|
||||
evil_portal_obj.addLog(header_line, header_line.length());
|
||||
}
|
||||
#endif
|
||||
}
|
||||
#else
|
||||
return;
|
||||
#endif
|
||||
if (scan_mode == WIFI_SCAN_AP)
|
||||
startPcap("beacon");
|
||||
else if (scan_mode == WIFI_SCAN_WAR_DRIVE) {
|
||||
#ifdef HAS_GPS
|
||||
if (gps_obj.getGpsModuleStatus()) {
|
||||
startLog("wardrive");
|
||||
String header_line = "WigleWifi-1.4,appRelease=" + (String)MARAUDER_VERSION + ",model=ESP32 Marauder,release=" + (String)MARAUDER_VERSION + ",device=ESP32 Marauder,display=SPI TFT,board=ESP32 Marauder,brand=JustCallMeKoko\nMAC,SSID,AuthMode,FirstSeen,Channel,RSSI,CurrentLatitude,CurrentLongitude,AltitudeMeters,AccuracyMeters,Type\n";
|
||||
buffer_obj.append(header_line);
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
#else
|
||||
return;
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef MARAUDER_FLIPPER
|
||||
flipper_led.sniffLED();
|
||||
@@ -1855,13 +1892,7 @@ void WiFiScan::startWardriverWiFi() {
|
||||
|
||||
void WiFiScan::RunStationScan(uint8_t scan_mode, uint16_t color)
|
||||
{
|
||||
#ifdef WRITE_PACKETS_SERIAL
|
||||
buffer_obj.open();
|
||||
#elif defined(HAS_SD)
|
||||
sd_obj.openCapture("station");
|
||||
#else
|
||||
return;
|
||||
#endif
|
||||
startPcap("station");
|
||||
|
||||
#ifdef MARAUDER_FLIPPER
|
||||
flipper_led.sniffLED();
|
||||
@@ -1904,14 +1935,8 @@ void WiFiScan::RunStationScan(uint8_t scan_mode, uint16_t color)
|
||||
|
||||
void WiFiScan::RunRawScan(uint8_t scan_mode, uint16_t color)
|
||||
{
|
||||
#ifdef WRITE_PACKETS_SERIAL
|
||||
buffer_obj.open();
|
||||
#elif defined(HAS_SD)
|
||||
if (scan_mode != WIFI_SCAN_SIG_STREN)
|
||||
sd_obj.openCapture("raw");
|
||||
#else
|
||||
return;
|
||||
#endif
|
||||
if (scan_mode != WIFI_SCAN_SIG_STREN)
|
||||
startPcap("raw");
|
||||
|
||||
#ifdef MARAUDER_FLIPPER
|
||||
flipper_led.sniffLED();
|
||||
@@ -1957,13 +1982,7 @@ void WiFiScan::RunRawScan(uint8_t scan_mode, uint16_t color)
|
||||
|
||||
void WiFiScan::RunDeauthScan(uint8_t scan_mode, uint16_t color)
|
||||
{
|
||||
#ifdef WRITE_PACKETS_SERIAL
|
||||
buffer_obj.open();
|
||||
#elif defined(HAS_SD)
|
||||
sd_obj.openCapture("deauth");
|
||||
#else
|
||||
return;
|
||||
#endif
|
||||
startPcap("deauth");
|
||||
|
||||
#ifdef MARAUDER_FLIPPER
|
||||
flipper_led.sniffLED();
|
||||
@@ -2008,23 +2027,21 @@ void WiFiScan::RunDeauthScan(uint8_t scan_mode, uint16_t color)
|
||||
// Function for running probe request scan
|
||||
void WiFiScan::RunProbeScan(uint8_t scan_mode, uint16_t color)
|
||||
{
|
||||
#ifdef WRITE_PACKETS_SERIAL
|
||||
buffer_obj.open();
|
||||
#elif defined(HAS_SD)
|
||||
if (scan_mode == WIFI_SCAN_PROBE)
|
||||
sd_obj.openCapture("probe");
|
||||
else if (scan_mode == WIFI_SCAN_STATION_WAR_DRIVE) {
|
||||
#ifdef HAS_GPS
|
||||
if (gps_obj.getGpsModuleStatus()) {
|
||||
sd_obj.openLog("station_wardrive");
|
||||
String header_line = "WigleWifi-1.4,appRelease=" + (String)MARAUDER_VERSION + ",model=ESP32 Marauder,release=" + (String)MARAUDER_VERSION + ",device=ESP32 Marauder,display=SPI TFT,board=ESP32 Marauder,brand=JustCallMeKoko\nMAC,SSID,AuthMode,FirstSeen,Channel,RSSI,CurrentLatitude,CurrentLongitude,AltitudeMeters,AccuracyMeters,Type\n";
|
||||
evil_portal_obj.addLog(header_line, header_line.length());
|
||||
}
|
||||
#endif
|
||||
}
|
||||
#else
|
||||
return;
|
||||
#endif
|
||||
if (scan_mode == WIFI_SCAN_PROBE)
|
||||
startPcap("probe");
|
||||
else if (scan_mode == WIFI_SCAN_STATION_WAR_DRIVE) {
|
||||
#ifdef HAS_GPS
|
||||
if (gps_obj.getGpsModuleStatus()) {
|
||||
startLog("station_wardrive");
|
||||
String header_line = "WigleWifi-1.4,appRelease=" + (String)MARAUDER_VERSION + ",model=ESP32 Marauder,release=" + (String)MARAUDER_VERSION + ",device=ESP32 Marauder,display=SPI TFT,board=ESP32 Marauder,brand=JustCallMeKoko\nMAC,SSID,AuthMode,FirstSeen,Channel,RSSI,CurrentLatitude,CurrentLongitude,AltitudeMeters,AccuracyMeters,Type\n";
|
||||
buffer_obj.append(header_line);
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
#else
|
||||
return;
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef MARAUDER_FLIPPER
|
||||
flipper_led.sniffLED();
|
||||
@@ -2155,25 +2172,19 @@ void WiFiScan::RunBluetoothScan(uint8_t scan_mode, uint16_t color)
|
||||
pBLEScan->setAdvertisedDeviceCallbacks(new bluetoothScanAllCallback(), false);
|
||||
}
|
||||
else if ((scan_mode == BT_SCAN_WAR_DRIVE) || (scan_mode == BT_SCAN_WAR_DRIVE_CONT)) {
|
||||
#ifdef WRITE_PACKETS_SERIAL
|
||||
buffer_obj.open();
|
||||
#elif defined(HAS_SD)
|
||||
#ifdef HAS_GPS
|
||||
if (gps_obj.getGpsModuleStatus()) {
|
||||
if (scan_mode == BT_SCAN_WAR_DRIVE) {
|
||||
#ifdef HAS_SD
|
||||
sd_obj.openLog("bt_wardrive");
|
||||
#endif
|
||||
}
|
||||
else if (scan_mode == BT_SCAN_WAR_DRIVE_CONT) {
|
||||
#ifdef HAS_SD
|
||||
sd_obj.openLog("bt_wardrive_cont");
|
||||
#endif
|
||||
}
|
||||
String header_line = "WigleWifi-1.4,appRelease=" + (String)MARAUDER_VERSION + ",model=ESP32 Marauder,release=" + (String)MARAUDER_VERSION + ",device=ESP32 Marauder,display=SPI TFT,board=ESP32 Marauder,brand=JustCallMeKoko\nMAC,SSID,AuthMode,FirstSeen,Channel,RSSI,CurrentLatitude,CurrentLongitude,AltitudeMeters,AccuracyMeters,Type\n";
|
||||
evil_portal_obj.addLog(header_line, header_line.length());
|
||||
#ifdef HAS_GPS
|
||||
if (gps_obj.getGpsModuleStatus()) {
|
||||
if (scan_mode == BT_SCAN_WAR_DRIVE) {
|
||||
startLog("bt_wardrive");
|
||||
}
|
||||
#endif
|
||||
else if (scan_mode == BT_SCAN_WAR_DRIVE_CONT) {
|
||||
startLog("bt_wardrive_cont");
|
||||
}
|
||||
String header_line = "WigleWifi-1.4,appRelease=" + (String)MARAUDER_VERSION + ",model=ESP32 Marauder,release=" + (String)MARAUDER_VERSION + ",device=ESP32 Marauder,display=SPI TFT,board=ESP32 Marauder,brand=JustCallMeKoko\nMAC,SSID,AuthMode,FirstSeen,Channel,RSSI,CurrentLatitude,CurrentLongitude,AltitudeMeters,AccuracyMeters,Type\n";
|
||||
buffer_obj.append(header_line);
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
#else
|
||||
return;
|
||||
#endif
|
||||
@@ -2338,7 +2349,7 @@ void WiFiScan::pwnSnifferCallback(void* buf, wifi_promiscuous_pkt_type_t type)
|
||||
|
||||
Serial.println();
|
||||
|
||||
addPacket(snifferPacket, len);
|
||||
buffer_obj.append(snifferPacket, len);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2497,7 +2508,7 @@ void WiFiScan::apSnifferCallbackFull(void* buf, wifi_promiscuous_pkt_type_t type
|
||||
|
||||
Serial.println();
|
||||
|
||||
addPacket(snifferPacket, len);
|
||||
buffer_obj.append(snifferPacket, len);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2623,7 +2634,7 @@ void WiFiScan::apSnifferCallback(void* buf, wifi_promiscuous_pkt_type_t type)
|
||||
|
||||
Serial.println();
|
||||
|
||||
addPacket(snifferPacket, len);
|
||||
buffer_obj.append(snifferPacket, len);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2744,7 +2755,7 @@ void WiFiScan::beaconSnifferCallback(void* buf, wifi_promiscuous_pkt_type_t type
|
||||
|
||||
Serial.println();
|
||||
|
||||
addPacket(snifferPacket, len);
|
||||
buffer_obj.append(snifferPacket, len);
|
||||
}
|
||||
else if (wifi_scan_obj.currentScanMode == WIFI_SCAN_WAR_DRIVE) {
|
||||
#ifdef HAS_GPS
|
||||
@@ -2819,7 +2830,7 @@ void WiFiScan::beaconSnifferCallback(void* buf, wifi_promiscuous_pkt_type_t type
|
||||
}
|
||||
String wardrive_line = (String)addr + "," + essid + "," + wifi_scan_obj.security_int_to_string(snifferPacket->rx_ctrl.channel) + "," + gps_obj.getDatetime() + "," + (String)snifferPacket->rx_ctrl.channel + "," + (String)snifferPacket->rx_ctrl.rssi + "," + gps_obj.getLat() + "," + gps_obj.getLon() + "," + gps_obj.getAlt() + "," + gps_obj.getAccuracy() + ",WIFI";
|
||||
Serial.println(wardrive_line);
|
||||
//evil_portal_obj.addLog(wardrive_line, wardrive_line.length());
|
||||
//buffer_obj.append(wardrive_line);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -2983,7 +2994,7 @@ void WiFiScan::stationSnifferCallback(void* buf, wifi_promiscuous_pkt_type_t typ
|
||||
|
||||
access_points->set(ap_index, ap);
|
||||
|
||||
addPacket(snifferPacket, len);
|
||||
buffer_obj.append(snifferPacket, len);
|
||||
}
|
||||
|
||||
void WiFiScan::rawSnifferCallback(void* buf, wifi_promiscuous_pkt_type_t type)
|
||||
@@ -3084,7 +3095,7 @@ void WiFiScan::rawSnifferCallback(void* buf, wifi_promiscuous_pkt_type_t type)
|
||||
|
||||
Serial.println();
|
||||
|
||||
addPacket(snifferPacket, len);
|
||||
buffer_obj.append(snifferPacket, len);
|
||||
}
|
||||
|
||||
void WiFiScan::deauthSnifferCallback(void* buf, wifi_promiscuous_pkt_type_t type)
|
||||
@@ -3148,7 +3159,7 @@ void WiFiScan::deauthSnifferCallback(void* buf, wifi_promiscuous_pkt_type_t type
|
||||
|
||||
Serial.println();
|
||||
|
||||
addPacket(snifferPacket, len);
|
||||
buffer_obj.append(snifferPacket, len);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3220,7 +3231,7 @@ void WiFiScan::probeSnifferCallback(void* buf, wifi_promiscuous_pkt_type_t type)
|
||||
|
||||
Serial.println();
|
||||
|
||||
addPacket(snifferPacket, len);
|
||||
buffer_obj.append(snifferPacket, len);
|
||||
}
|
||||
else if (wifi_scan_obj.currentScanMode == WIFI_SCAN_STATION_WAR_DRIVE) {
|
||||
#ifdef HAS_GPS
|
||||
@@ -3275,7 +3286,7 @@ void WiFiScan::probeSnifferCallback(void* buf, wifi_promiscuous_pkt_type_t type)
|
||||
if (do_save) {
|
||||
String wardrive_line = (String)addr + "," + (String)addr + ",," + gps_obj.getDatetime() + "," + (String)snifferPacket->rx_ctrl.channel + "," + (String)snifferPacket->rx_ctrl.rssi + "," + gps_obj.getLat() + "," + gps_obj.getLon() + "," + gps_obj.getAlt() + "," + gps_obj.getAccuracy() + ",WIFI";
|
||||
Serial.println(wardrive_line);
|
||||
evil_portal_obj.addLog(wardrive_line, wardrive_line.length());
|
||||
buffer_obj.append(wardrive_line);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -3366,7 +3377,7 @@ void WiFiScan::beaconListSnifferCallback(void* buf, wifi_promiscuous_pkt_type_t
|
||||
|
||||
Serial.println();
|
||||
|
||||
addPacket(snifferPacket, len);
|
||||
buffer_obj.append(snifferPacket, len);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3827,7 +3838,7 @@ void WiFiScan::wifiSnifferCallback(void* buf, wifi_promiscuous_pkt_type_t type)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
addPacket(snifferPacket, len);
|
||||
buffer_obj.append(snifferPacket, len);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3915,7 +3926,7 @@ void WiFiScan::eapolSnifferCallback(void* buf, wifi_promiscuous_pkt_type_t type)
|
||||
#endif
|
||||
}
|
||||
|
||||
addPacket(snifferPacket, len);
|
||||
buffer_obj.append(snifferPacket, len);
|
||||
}
|
||||
|
||||
void WiFiScan::activeEapolSnifferCallback(void* buf, wifi_promiscuous_pkt_type_t type)
|
||||
@@ -4001,20 +4012,7 @@ void WiFiScan::activeEapolSnifferCallback(void* buf, wifi_promiscuous_pkt_type_t
|
||||
|
||||
}
|
||||
|
||||
addPacket(snifferPacket, len);
|
||||
}
|
||||
|
||||
void WiFiScan::addPacket(wifi_promiscuous_pkt_t *snifferPacket, int len) {
|
||||
bool save_packet = settings_obj.loadSetting<bool>(text_table4[7]);
|
||||
if (save_packet) {
|
||||
#ifdef WRITE_PACKETS_SERIAL
|
||||
buffer_obj.addPacket(snifferPacket->payload, len);
|
||||
#elif defined(HAS_SD)
|
||||
sd_obj.addPacket(snifferPacket->payload, len);
|
||||
#else
|
||||
return;
|
||||
#endif
|
||||
}
|
||||
buffer_obj.append(snifferPacket, len);
|
||||
}
|
||||
|
||||
#ifdef HAS_SCREEN
|
||||
@@ -4770,4 +4768,9 @@ void WiFiScan::main(uint32_t currentTime)
|
||||
packets_sent = 0;
|
||||
}
|
||||
}
|
||||
#ifdef HAS_GPS
|
||||
else if ((currentScanMode == WIFI_SCAN_OFF))
|
||||
if(gps_obj.queue_enabled())
|
||||
gps_obj.disable_queue();
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -389,8 +389,11 @@ class WiFiScan
|
||||
void StartScan(uint8_t scan_mode, uint16_t color = 0);
|
||||
void StopScan(uint8_t scan_mode);
|
||||
const char* generateRandomName();
|
||||
//void addLog(String log, int len);
|
||||
|
||||
|
||||
bool save_serial = false;
|
||||
void startPcap(String file_name);
|
||||
void startLog(String file_name);
|
||||
|
||||
static void getMAC(char *addr, uint8_t* data, uint16_t offset);
|
||||
static void pwnSnifferCallback(void* buf, wifi_promiscuous_pkt_type_t type);
|
||||
static void beaconSnifferCallback(void* buf, wifi_promiscuous_pkt_type_t type);
|
||||
@@ -404,7 +407,6 @@ class WiFiScan
|
||||
static void activeEapolSnifferCallback(void* buf, wifi_promiscuous_pkt_type_t type);
|
||||
static void eapolSnifferCallback(void* buf, wifi_promiscuous_pkt_type_t type);
|
||||
static void wifiSnifferCallback(void* buf, wifi_promiscuous_pkt_type_t type);
|
||||
static void addPacket(wifi_promiscuous_pkt_t *snifferPacket, int len);
|
||||
|
||||
/*#ifdef HAS_BT
|
||||
enum EBLEPayloadType
|
||||
|
||||
@@ -6,10 +6,6 @@
|
||||
|
||||
#define POLISH_POTATO
|
||||
|
||||
//Indicates that it must redirect the stream with the captured packets to serial (1)
|
||||
//If not defined, will write packages to SD card if supported
|
||||
//#define WRITE_PACKETS_SERIAL
|
||||
|
||||
//// BOARD TARGETS
|
||||
//#define MARAUDER_M5STICKC
|
||||
//#define MARAUDER_MINI
|
||||
@@ -24,7 +20,7 @@
|
||||
//#define XIAO_ESP32_S3
|
||||
//// END BOARD TARGETS
|
||||
|
||||
#define MARAUDER_VERSION "v0.13.6"
|
||||
#define MARAUDER_VERSION "v0.13.7"
|
||||
|
||||
//// HARDWARE NAMES
|
||||
#ifdef MARAUDER_M5STICKC
|
||||
@@ -70,7 +66,7 @@
|
||||
|
||||
#ifdef MARAUDER_MINI
|
||||
//#define FLIPPER_ZERO_HAT
|
||||
#define HAS_BATTERY
|
||||
//#define HAS_BATTERY
|
||||
#define HAS_BT
|
||||
#define HAS_BUTTONS
|
||||
#define HAS_NEOPIXEL_LED
|
||||
@@ -147,10 +143,8 @@
|
||||
//#define HAS_PWR_MGMT
|
||||
//#define HAS_SCREEN
|
||||
#define HAS_GPS
|
||||
#ifndef WRITE_PACKETS_SERIAL
|
||||
#define HAS_SD
|
||||
#define USE_SD
|
||||
#endif
|
||||
#define HAS_SD
|
||||
#define USE_SD
|
||||
//#define HAS_TEMP_SENSOR
|
||||
#endif
|
||||
|
||||
@@ -196,20 +190,6 @@
|
||||
#endif
|
||||
//// END BOARD FEATURES
|
||||
|
||||
//// FLIPPER ZERO HAT SETTINGS
|
||||
#ifdef FLIPPER_ZERO_HAT
|
||||
|
||||
//#ifdef MARAUDER_FLIPPER
|
||||
// #define USE_FLIPPER_SD
|
||||
//#endif
|
||||
|
||||
#ifdef XIAO_ESP32_S3
|
||||
#define USE_FLIPPER_SD
|
||||
#endif
|
||||
|
||||
#endif
|
||||
//// END FLIPPER ZERO HAT SETTINGS
|
||||
|
||||
//// POWER MANAGEMENT
|
||||
#ifdef HAS_PWR_MGMT
|
||||
#ifdef MARAUDER_M5STICKC
|
||||
@@ -667,13 +647,7 @@
|
||||
//// END MENU DEFINITIONS
|
||||
|
||||
//// SD DEFINITIONS
|
||||
#ifdef FLIPPER_ZERO_HAT
|
||||
|
||||
#ifdef USE_FLIPPER_SD
|
||||
#define WRITE_PACKETS_SERIAL
|
||||
#endif
|
||||
|
||||
#elif defined(USE_SD)
|
||||
#if defined(USE_SD)
|
||||
|
||||
#ifdef MARAUDER_V4
|
||||
#define SD_CS 12
|
||||
@@ -783,15 +757,6 @@
|
||||
#endif
|
||||
//// END NEOPIXEL STUFF
|
||||
|
||||
//// BOARD PIN OVERRIDES
|
||||
#ifdef XIAO_ESP32_S3
|
||||
#ifdef USE_FLIPPER_SD
|
||||
#define XIAO_RX1 1
|
||||
#define XIAO_TX1 2
|
||||
#endif
|
||||
#endif
|
||||
//// END BOARD PIN OVERRIDES
|
||||
|
||||
//// EVIL PORTAL STUFF
|
||||
#ifdef MARAUDER_M5STICKC
|
||||
#define MAX_HTML_SIZE 11400
|
||||
@@ -846,11 +811,7 @@
|
||||
#define GPS_RX 22
|
||||
#define mac_history_len 512
|
||||
#elif defined(MARAUDER_FLIPPER)
|
||||
#ifdef WRITE_PACKETS_SERIAL
|
||||
#define GPS_SOFTWARE_SERIAL
|
||||
#else
|
||||
#define GPS_SERIAL_INDEX 1
|
||||
#endif
|
||||
#define GPS_SERIAL_INDEX 1
|
||||
#define GPS_TX 9
|
||||
#define GPS_RX 21
|
||||
#define mac_history_len 512
|
||||
|
||||
@@ -198,17 +198,6 @@ void setup()
|
||||
|
||||
Serial.begin(115200);
|
||||
|
||||
// Starts a second serial channel to stream the captured packets
|
||||
#ifdef WRITE_PACKETS_SERIAL
|
||||
|
||||
#ifdef XIAO_ESP32_S3
|
||||
Serial1.begin(115200, SERIAL_8N1, XIAO_RX1, XIAO_TX1);
|
||||
#else
|
||||
Serial1.begin(115200);
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
//Serial.println("\n\nHello, World!\n");
|
||||
|
||||
Serial.println("ESP-IDF version is: " + String(esp_get_idf_version()));
|
||||
@@ -293,9 +282,8 @@ void setup()
|
||||
display_obj.tft.println(F(text_table0[2]));
|
||||
#endif
|
||||
|
||||
#ifdef WRITE_PACKETS_SERIAL
|
||||
buffer_obj = Buffer();
|
||||
#elif defined(HAS_SD)
|
||||
buffer_obj = Buffer();
|
||||
#if defined(HAS_SD)
|
||||
// Do some SD stuff
|
||||
if(sd_obj.initSD()) {
|
||||
#ifdef HAS_SCREEN
|
||||
@@ -419,14 +407,14 @@ void loop()
|
||||
gps_obj.main();
|
||||
#endif
|
||||
|
||||
#ifdef WRITE_PACKETS_SERIAL
|
||||
buffer_obj.forceSaveSerial();
|
||||
#elif defined(HAS_SD)
|
||||
// Detect SD card
|
||||
#if defined(HAS_SD)
|
||||
sd_obj.main();
|
||||
#else
|
||||
return;
|
||||
#endif
|
||||
|
||||
// Save buffer to SD and/or serial
|
||||
buffer_obj.save();
|
||||
|
||||
#ifdef HAS_BATTERY
|
||||
battery_obj.main(currentTime);
|
||||
//temp_obj.main(currentTime);
|
||||
|
||||
@@ -179,13 +179,12 @@ PROGMEM const char text4_44[] = " AP Scan ";
|
||||
PROGMEM const char text4_45[] = "Clearing Stations...";
|
||||
PROGMEM const char text4_46[] = "Stations Cleared: ";
|
||||
PROGMEM const char text4_47[] = "Targeted Deauth";
|
||||
PROGMEM const char text4_48[] = "Using serial to transmit packets";
|
||||
|
||||
//Making tables
|
||||
PROGMEM const char *text_table0[] = {text0_0,text0_1, text0_2, text0_3, text0_4, text0_5, text0_6, text0_7, text0_8};
|
||||
PROGMEM const char *text_table1[] = {text1_0,text1_1,text1_2,text1_3,text1_4,text1_5,text1_6,text1_7,text1_8,text1_9,text1_10,text1_11,text1_12,text1_13,text1_14,text1_15,text1_16,text1_17,text1_18,text1_19,text1_20,text1_21,text1_22,text1_23,text1_24,text1_25,text1_26,text1_27,text1_28,text1_29,text1_30,text1_31,text1_32,text1_33,text1_34,text1_35,text1_36,text1_37,text1_38,text1_39,text1_40,text1_41,text1_42,text1_43,text1_44,text1_45,text1_46,text1_47,text1_48,text1_49,text1_50,text1_51,text1_52,text1_53,text1_54,text1_55,text1_56,text1_57,text1_58,text1_59,text1_60,text1_61,text1_62};
|
||||
PROGMEM const char *text_table2[] = {text2_0,text2_1,text2_2,text2_3,text2_4,text2_5,text2_6,text2_7,text2_8,text2_9,text2_10,text2_11,text2_12,text2_13,text2_14};
|
||||
PROGMEM const char *text_table3[] = {text3_0,text3_1,text3_2,text3_3,text3_4,text3_5};
|
||||
PROGMEM const char *text_table4[] = {text4_0,text4_1,text4_2,text4_3,text4_4,text4_5,text4_6,text4_7,text1_54,text4_9,text4_10,text4_11,text4_12,text4_13,text4_14,text4_15,text4_16,text4_17,text4_18,text4_19,text4_20,text4_21,text4_22,text4_23,text4_24,text4_25,text4_26,text4_27,text4_28,text4_29,text4_30,text4_31,text4_32,text4_33,text4_34,text4_35,text4_36,text4_37,text4_38,text4_39,text4_40,text4_41,text4_42,text4_43,text4_44,text4_45,text4_46,text4_47, text4_48};
|
||||
PROGMEM const char *text_table4[] = {text4_0,text4_1,text4_2,text4_3,text4_4,text4_5,text4_6,text4_7,text1_54,text4_9,text4_10,text4_11,text4_12,text4_13,text4_14,text4_15,text4_16,text4_17,text4_18,text4_19,text4_20,text4_21,text4_22,text4_23,text4_24,text4_25,text4_26,text4_27,text4_28,text4_29,text4_30,text4_31,text4_32,text4_33,text4_34,text4_35,text4_36,text4_37,text4_38,text4_39,text4_40,text4_41,text4_42,text4_43,text4_44,text4_45,text4_46,text4_47};
|
||||
|
||||
#endif
|
||||
|
||||
Binary file not shown.
Reference in New Issue
Block a user