Skip to content

A Hardware Hacking Tool with Web-Based CLI That Speaks Every Protocol

fix version for tembed view

Geocbb8c2a6375b
diff --git a/src/Services/WifiOpenScannerService.cpp b/src/Services/WifiOpenScannerService.cpp
index 63be3e64..82979a40 100644
--- a/src/Services/WifiOpenScannerService.cpp
+++ b/src/Services/WifiOpenScannerService.cpp
@@ -44,25 +44,6 @@ void WifiOpenScannerService::openProbeTaskThunk(void* arg) {
vTaskDelete(nullptr);
}
-bool WifiOpenScannerService::hasInternetConnectivity(unsigned long httpTimeoutMs) {
- HTTPClient http;
- // 204 expected for connectivity check
- if (http.begin("http://connectivitycheck.gstatic.com/generate_204")) {
- http.setTimeout(httpTimeoutMs);
- int code = http.GET();
- http.end();
- if (code == 204) return true;
- if (code > 0 && code < 600) return true; // HTTP joignable
- }
- if (http.begin("http://example.com")) {
- http.setTimeout(httpTimeoutMs);
- int code = http.GET();
- http.end();
- return code > 0;
- }
- return false;
-}
-
bool WifiOpenScannerService::isOpenAuth(int enc) {
return enc == WIFI_AUTH_OPEN;
}
@@ -142,29 +123,36 @@ void WifiOpenScannerService::processOneNetwork(int idx) {
unsigned long connectMs = 0;
const unsigned long timeoutMs = 12000;
- const bool ok = connectToNetwork(ssid, /*isOpen=*/true, timeoutMs, ip, connectMs);
- if (!ok) {
+ // IRAM overflow at compile time on M5Stick, so skip connection check
+ #ifdef DEVICE_M5STICK
char line[256];
snprintf(line, sizeof(line),
- "[TRY] SSID=\"%s\" ENC=%s -> connect FAILED (%lums)",
- ssid.c_str(), encToStr(enc), connectMs);
+ "[SKIP] SSID=\"%s\" ENC=%s -> Open. Can't check internet access on M5Stick",
+ ssid.c_str(), encToStr(enc));
pushProbeLog(line);
- safeDisconnect();
- return;
- }
-
- // Test HTTP/Internet
- int httpCode = -1; unsigned long httpMs = 0;
- const bool internet = performHttpCheck(httpCode, httpMs);
-
- char line[320];
- snprintf(line, sizeof(line),
- "[TRY] SSID=\"%s\" ENC=%s -> CONNECTED ip=%s (connect %lums) HTTP=%d (%s, %lums)",
- ssid.c_str(), encToStr(enc), ip.c_str(), connectMs, httpCode,
- internet ? "Internet OK" : "No Internet", httpMs);
- pushProbeLog(line);
-
- safeDisconnect(50);
+ #else
+ const bool ok = connectToNetwork(ssid, /*isOpen=*/true, timeoutMs, ip, connectMs);
+ if (!ok) {
+ char line[320];
+ snprintf(line, sizeof(line),
+ "[TRY] SSID=\"%s\" ENC=%s -> connect FAILED (%lums)",
+ ssid.c_str(), encToStr(enc), connectMs);
+ pushProbeLog(line);
+ safeDisconnect();
+
+ // Test HTTP/Internet
+ int httpCode = -1; unsigned long httpMs = 0;
+ const bool internet = performHttpCheck(httpCode, httpMs);
+
+ snprintf(line, sizeof(line),
+ "[TRY] SSID=\"%s\" ENC=%s -> CONNECTED ip=%s (connect %lums) HTTP=%d (%s, %lums)",
+ ssid.c_str(), encToStr(enc), ip.c_str(), connectMs, httpCode,
+ internet ? "Internet OK" : "No Internet", httpMs);
+ pushProbeLog(line);
+
+ safeDisconnect(50);
+ }
+ #endif
}
bool WifiOpenScannerService::connectToNetwork(const std::string& ssid,
diff --git a/src/Services/WifiOpenScannerService.h b/src/Services/WifiOpenScannerService.h
index e3c94b21..13627ce6 100644
--- a/src/Services/WifiOpenScannerService.h
+++ b/src/Services/WifiOpenScannerService.h
@@ -36,11 +36,9 @@ private:
bool performHttpCheck(int& outHttpCode, unsigned long& outHttpMs);
// Helpers
- bool hasInternetConnectivity(unsigned long httpTimeoutMs = 4000);
static bool isOpenAuth(int enc); // WIFI_AUTH_OPEN
std::string getSsid(int idx) const;
- const char* encToStr(int enc) const;
-
+
// Log buffer thread safe
static portMUX_TYPE probeMux;
static std::vector<std::string> probeLog;
diff --git a/src/Views/TembedDeviceView.h b/src/Views/TembedDeviceView.h
index 9abe5652..ff27c573 100644
--- a/src/Views/TembedDeviceView.h
+++ b/src/Views/TembedDeviceView.h
@@ -4,6 +4,7 @@
#include "Interfaces/IDeviceView.h"
#include <TFT_eSPI.h>
+#include "States/GlobalState.h"
#ifdef DEVICE_TEMBEDS3CC1101