diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..a317ea9 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,52 @@ +FROM python:3.6-slim + +ENV PYTHONBUFFERED=1 + +# Install required packages and tools +RUN apt-get update && apt-get install -y --no-install-recommends \ + curl \ + bash \ + && apt-get clean \ + && rm -rf /var/lib/apt/lists/* + +RUN curl -fsSL https://github.com/raw/arduino/arduino-cli/master/install.sh | BINDIR=/usr/bin sh + +# Ensure pip is installed and upgrade it +RUN python3 -m ensurepip +RUN pip3 install --no-cache --upgrade pip setuptools pyserial esptool + +# Install 32-bit C++ standard library +RUN apt-get update && apt-get install -y --no-install-recommends \ + lib32stdc++6 \ + && apt-get clean \ + && rm -rf /var/lib/apt/lists/* + +# Install m5stack boards +COPY ./package_m5stack_index.json /package_m5stack_index.json +RUN arduino-cli core install m5stack:esp32 --additional-urls "file:///package_m5stack_index.json" --log-level warn --verbose + +RUN arduino-cli core search m5stack +RUN arduino-cli board listall +# +# Create a directory for the prerequisites script +RUN mkdir -p /deauth_prerequisites +COPY ./deauth_prerequisites/install_prerequisites_Linux.sh /deauth_prerequisites/install_prerequisites_linux.sh + +# Make the script executable +RUN chmod +x /deauth_prerequisites/install_prerequisites_linux.sh + +# Run the script +RUN /deauth_prerequisites/install_prerequisites_linux.sh + +ARG LIBRARIES + +# Install required libraries +RUN arduino-cli lib install $LIBRARIES --log-level warn --verbose + +COPY ./scripts/compile.sh /compile.sh +RUN chmod +x /compile.sh + +COPY ./scripts/entrypoint.sh ./entrypoint.sh +RUN chmod +x /entrypoint.sh + +ENTRYPOINT ["/entrypoint.sh"] diff --git a/README.md b/README.md index 9264af1..6b9568c 100644 --- a/README.md +++ b/README.md @@ -132,6 +132,32 @@ esptool.py --chip esp32s3 merge_bin --output final.bin 0x0000 m5stick-nemo.ino.b esptool.exe write_flash -z 0 final.bin ``` +## Building from Source (Docker) + +- Install Docker +- Run `./scripts/docker-build.sh ` +- Run `./scripts/flash.sh --device=` + +```sh +# This will build an image will all required libraries based on the configured platform, and it will compile, output and merge binaries +# By default this will compile for the M5Cardputer in en-us locale, ./config/.env.M5Cardputer +./scripts/docker-build.sh + +# If you want to select a different build config you can pass it as a parameter. See ./configs/ for various configurations +./scripts/docker-build.sh ./config/.env.M5Cardputer + +# Binary files will be output to ./build +ls ./build + +# This will flash the build output from the build step, it reuses the container image from the previous step. +# By default this will compile for the M5Cardputer in en-us locale, ./config/.env.M5Cardputer +./scipts/flash.sh --device=/dev/ttyusb0 + +# If you passed a different build config make sure to pass it along to the flash script +./scipts/flash.sh --device=/dev/ttyusb0 --build-config=./config/.env.M5Cardputer +``` + + ## Troubleshooting * Several features output debugging information to the serial monitor. Use the Serial Monitor feature in Arduino IDE or M5Burner to gather this information. It may have useful hints. When filing a bug report, it often helps to include serial monitor output. diff --git a/configs/.env.M5Cardputer b/configs/.env.M5Cardputer new file mode 100755 index 0000000..07c4fd2 --- /dev/null +++ b/configs/.env.M5Cardputer @@ -0,0 +1,6 @@ +export LOCALE="en-us" +export NAME="M5Cardputer" +export FQBN="m5stack:esp32:m5stack_cardputer" +export EXTRA_FLAGS="-DCARDPUTER" +export LIBRARIES="M5Cardputer IRRemoteESP8266 M5Stack-SD-Updater M5Unified" +export BOOTLOADER_ADDR="0x0000" diff --git a/configs/.env.M5StickC b/configs/.env.M5StickC new file mode 100755 index 0000000..1ec088e --- /dev/null +++ b/configs/.env.M5StickC @@ -0,0 +1,6 @@ +export LOCALE="en-us" +export NAME="M5StickC" +export FQBN="m5stack:esp32:m5stack_stickc" +export EXTRA_FLAGS="-DSTICK_C" +export LIBRARIES="M5StickC@0.2.8 IRRemoteESP8266 M5Stack-SD-Updater M5Unified" +export BOOTLOADER_ADDR="0x1000" diff --git a/configs/.env.M5StickCPlus b/configs/.env.M5StickCPlus new file mode 100755 index 0000000..c5372bf --- /dev/null +++ b/configs/.env.M5StickCPlus @@ -0,0 +1,6 @@ +export LOCALE="en-us" +export NAME="M5StickCPlus" +export FQBN="m5stack:esp32:m5stack_stickc_plus" +export EXTRA_FLAGS="-DSTICK_C_PLUS" +export LIBRARIES="M5StickCPlus IRRemoteESP8266 M5Stack-SD-Updater M5Unified" +export BOOTLOADER_ADDR="0x1000" diff --git a/configs/.env.M5StickCPlus2 b/configs/.env.M5StickCPlus2 new file mode 100755 index 0000000..1ddb4c9 --- /dev/null +++ b/configs/.env.M5StickCPlus2 @@ -0,0 +1,6 @@ +export LOCALE="en-us" +export NAME="M5StickCPlus2" +export FQBN="m5stack:esp32:m5stack_stickc_plus2" +export EXTRA_FLAGS="-DSTICK_C_PLUS2" +export LIBRARIES="M5StickCPlus2 IRRemoteESP8266 M5Stack-SD-Updater M5Unified" +export BOOTLOADER_ADDR="0x1000" diff --git a/DEAUTH Prerequisites/README.md b/deauth_prerequisites/README.md similarity index 100% rename from DEAUTH Prerequisites/README.md rename to deauth_prerequisites/README.md diff --git a/DEAUTH Prerequisites/install-prerequisites.bat b/deauth_prerequisites/install-prerequisites.bat similarity index 96% rename from DEAUTH Prerequisites/install-prerequisites.bat rename to deauth_prerequisites/install-prerequisites.bat index 90a2fd9..11a9a7e 100644 --- a/DEAUTH Prerequisites/install-prerequisites.bat +++ b/deauth_prerequisites/install-prerequisites.bat @@ -1,51 +1,51 @@ -@echo off -setlocal enabledelayedexpansion - -set "baseFolder=%localappdata%\Arduino15\packages\m5stack\hardware\esp32" - -rem Find the latest version of the folder -set "latestVersion=" -for /d %%I in ("%baseFolder%\*") do ( - set "latestVersion=%%~nxI" -) - -if not defined latestVersion ( - echo No version found. - pause - exit /b -) - -rem Full path to the file to be edited -set "file=%baseFolder%\%latestVersion%\platform.txt" -set "backupFile=%baseFolder%\%latestVersion%\platform.txt.bkp" -set "prefix=build.extra_flags.esp32" -set "option= -w" - -set "prefix2=compiler.c.elf.libs.esp32" -set "option2= -zmuldefs" - -set "readyMark=##NEMO_DEAUTH_READY##" - -rem Check if the ready mark already exists in the file -findstr /C:"%readyMark%" "%file%" >nul -if %errorlevel% equ 0 ( - echo The file is already OK. - pause - exit /b -) - -rem Create a backup copy of the original file -copy "%file%" "%backupFile%" - -rem Use PowerShell to edit the file -powershell -Command "(Get-Content '%file%') | ForEach-Object { $_ -replace ('^(%prefix%.*?)$', '$1%option%') -replace ('^(%prefix2%.*?)$', '$1%option2%') } | Set-Content '%file%'" - -rem Add the ready mark to the end of the file -echo %readyMark%>> "%file%" - -rem Open the latest version of the folder in Windows Explorer -start explorer "%baseFolder%\%latestVersion%" - -echo Done. -pause - +@echo off +setlocal enabledelayedexpansion + +set "baseFolder=%localappdata%\Arduino15\packages\m5stack\hardware\esp32" + +rem Find the latest version of the folder +set "latestVersion=" +for /d %%I in ("%baseFolder%\*") do ( + set "latestVersion=%%~nxI" +) + +if not defined latestVersion ( + echo No version found. + pause + exit /b +) + +rem Full path to the file to be edited +set "file=%baseFolder%\%latestVersion%\platform.txt" +set "backupFile=%baseFolder%\%latestVersion%\platform.txt.bkp" +set "prefix=build.extra_flags.esp32" +set "option= -w" + +set "prefix2=compiler.c.elf.libs.esp32" +set "option2= -zmuldefs" + +set "readyMark=##NEMO_DEAUTH_READY##" + +rem Check if the ready mark already exists in the file +findstr /C:"%readyMark%" "%file%" >nul +if %errorlevel% equ 0 ( + echo The file is already OK. + pause + exit /b +) + +rem Create a backup copy of the original file +copy "%file%" "%backupFile%" + +rem Use PowerShell to edit the file +powershell -Command "(Get-Content '%file%') | ForEach-Object { $_ -replace ('^(%prefix%.*?)$', '$1%option%') -replace ('^(%prefix2%.*?)$', '$1%option2%') } | Set-Content '%file%'" + +rem Add the ready mark to the end of the file +echo %readyMark%>> "%file%" + +rem Open the latest version of the folder in Windows Explorer +start explorer "%baseFolder%\%latestVersion%" + +echo Done. +pause + diff --git a/DEAUTH Prerequisites/install-prerequisites_MAC.sh b/deauth_prerequisites/install-prerequisites_MAC.sh similarity index 100% rename from DEAUTH Prerequisites/install-prerequisites_MAC.sh rename to deauth_prerequisites/install-prerequisites_MAC.sh diff --git a/DEAUTH Prerequisites/install_prerequisites_Linux.sh b/deauth_prerequisites/install_prerequisites_Linux.sh similarity index 89% rename from DEAUTH Prerequisites/install_prerequisites_Linux.sh rename to deauth_prerequisites/install_prerequisites_Linux.sh index 6701d44..afaac44 100644 --- a/DEAUTH Prerequisites/install_prerequisites_Linux.sh +++ b/deauth_prerequisites/install_prerequisites_Linux.sh @@ -1,11 +1,9 @@ #!/bin/bash -# - baseFolder="$HOME/.arduino15/packages/m5stack/hardware/esp32" # Find the latest version of the folder -latestVersion=$(find "$baseFolder" -maxdepth 1 -type d -exec basename {} \; | sort -V | head -n 1) +latestVersion=$(find "$baseFolder" -maxdepth 1 -type d -exec basename {} \; | sed '/esp32/d' | sort -V -r | head -n 1) if [ -z "$latestVersion" ]; then echo "No version found." @@ -51,8 +49,4 @@ awk -v prefix="$prefix" -v option="$option" -v prefix2="$prefix2" -v option2="$o # Add the ready mark to the end of the file echo "$readyMark" >> "$file" -# Open the latest version of the folder in Finder -open "$baseFolder/$latestVersion" - echo "Done." -read -p "Press Enter to exit." diff --git a/localization.h b/localization.h index 094a2ae..bb96bd3 100644 --- a/localization.h +++ b/localization.h @@ -73,6 +73,29 @@ #define TXT_WFA_PORTAL "Clone Portal" #define TXT_WFA_DEAUTH "Deauth attack" #define TXT_WFA_COMBINED "Deauth+Clone" + #define TXT_BLACK "Black" + #define TXT_NAVY "Navy" + #define TXT_DARKGREEN "Dark Green" + #define TXT_DARKCYAN "Dark Cyan" + #define TXT_MAROON "Maroon" + #define TXT_PURPLE "Purple" + #define TXT_OLIVE "Olive" + #define TXT_LIGHTGREY "Light Grey" + #define TXT_DARKGREY "Dark Grey" + #define TXT_BLUE "Blue" + #define TXT_GREEN "Green" + #define TXT_CYAN "Cyan" + #define TXT_RED "Red" + #define TXT_MAGENTA "Magenta" + #define TXT_YELLOW "Yellow" + #define TXT_WHITE "White" + #define TXT_ORANGE "Orange" + #define TXT_GREENYELLOW "Green Yellow" + #define TXT_PINK "Pink" + #define TXT_COLOR "Custom Colors" + #define TXT_SET_FGCOLOR "MAIN COLOR" + #define TXT_SET_BGCOLOR "BACKGROUND COLOR" + #define TXT_THEME "Color Theme" #endif #if defined(LANGUAGE_PT_BR) @@ -150,4 +173,27 @@ #define TXT_WFA_PORTAL "Clonar Portal" #define TXT_WFA_DEAUTH "Ataque Deauth" #define TXT_WFA_COMBINED "Deauth+Clone" -#endif \ No newline at end of file + #define TXT_BLACK "Preto" + #define TXT_NAVY "Azul Escuro" + #define TXT_DARKGREEN "Verde Escuro" + #define TXT_DARKCYAN "Ciano Escuro" + #define TXT_MAROON "Vermelho Escuro" + #define TXT_PURPLE "Roxo" + #define TXT_OLIVE "Castanho" + #define TXT_LIGHTGREY "Cinzo Claro" + #define TXT_DARKGREY "Cinzo Escuro" + #define TXT_BLUE "Azul" + #define TXT_GREEN "Verde" + #define TXT_CYAN "Ciano" + #define TXT_RED "Vermelho" + #define TXT_MAGENTA "Magenta" + #define TXT_YELLOW "Amarelo" + #define TXT_WHITE "Branco" + #define TXT_ORANGE "Alaranjado" + #define TXT_GREENYELLOW "Verde Amarelo" + #define TXT_PINK "Rosa" + #define TXT_COLOR "Mudar Cores" + #define TXT_SET_FGCOLOR "COR PRINCIPAL" + #define TXT_SET_BGCOLOR "COR DE FUNDO" + #define TXT_THEME "Tema De Cores" +#endif diff --git a/m5stick-nemo.ino b/m5stick-nemo.ino index efb63ac..6fd0943 100644 --- a/m5stick-nemo.ino +++ b/m5stick-nemo.ino @@ -12,8 +12,9 @@ // #define LANGUAGE_EN_US // #define LANGUAGE_PT_BR -#define BGCOLOR BLACK -#define FGCOLOR GREEN +// -- DEPRECATED - THESE ARE NOW EEPROM DEFINED -- // +uint16_t BGCOLOR=0x0001; // placeholder +uint16_t FGCOLOR=0xFFF1; // placeholder #ifndef NEMO_VERSION #define NEMO_VERSION "dev" @@ -196,6 +197,8 @@ // 19 - NEMO Portal // 20 - Attack menu // 21 - Deauth Attack +// 22 - Custom Color Settings +// 23 - Pre-defined color themes // .. - .. // 97 - Mount/UnMount SD Card on M5Stick devices, if SDCARD is declared @@ -291,21 +294,27 @@ QRCODE qrcodes[] = { void drawmenu(MENU thismenu[], int size) { DISP.setTextSize(SMALL_TEXT); DISP.fillScreen(BGCOLOR); - DISP.setCursor(0, 5, 1); + DISP.setCursor(0, 0, 1); // scrolling menu if (cursor < 0) { cursor = size - 1; // rollover hack for up-arrow on cardputer } if (cursor > 5) { for ( int i = 0 + (cursor - 5) ; i < size ; i++ ) { - DISP.print((cursor == i) ? ">" : " "); - DISP.println(thismenu[i].name); + if(cursor == i){ + DISP.setTextColor(BGCOLOR, FGCOLOR); + } + DISP.printf(" %-19s\n",thismenu[i].name); + DISP.setTextColor(FGCOLOR, BGCOLOR); } } else { for ( int i = 0 ; i < size ; i++ ) { - DISP.print((cursor == i) ? ">" : " "); - DISP.println(thismenu[i].name); + if(cursor == i){ + DISP.setTextColor(BGCOLOR, FGCOLOR); + } + DISP.printf(" %-19s\n",thismenu[i].name); + DISP.setTextColor(FGCOLOR, BGCOLOR); } } } @@ -313,18 +322,24 @@ void drawmenu(MENU thismenu[], int size) { void number_drawmenu(int nums) { DISP.setTextSize(SMALL_TEXT); DISP.fillScreen(BGCOLOR); - DISP.setCursor(0, 5, 1); + DISP.setCursor(0, 0); // scrolling menu if (cursor > 5) { for ( int i = 0 + (cursor - 5) ; i < nums ; i++ ) { - DISP.print((cursor == i) ? ">" : " "); - DISP.println(i); + if(cursor == i){ + DISP.setTextColor(BGCOLOR, FGCOLOR); + } + DISP.printf(" %-19d\n",i); + DISP.setTextColor(FGCOLOR, BGCOLOR); } } else { for ( int i = 0 ; i < nums ; i++ ) { - DISP.print((cursor == i) ? ">" : " "); - DISP.println(i); + if(cursor == i){ + DISP.setTextColor(BGCOLOR, FGCOLOR); + } + DISP.printf(" %-19d\n",i); + DISP.setTextColor(FGCOLOR, BGCOLOR); } } } @@ -489,7 +504,7 @@ int dmenu_size = sizeof(dmenu) / sizeof(MENU); void dmenu_setup() { DISP.fillScreen(BGCOLOR); - DISP.setCursor(0, 5, 1); + DISP.setCursor(0, 0); DISP.println(String(TXT_AUTO_DIM)); delay(1000); cursor = 0; @@ -512,7 +527,7 @@ void dmenu_loop() { EEPROM.commit(); #endif DISP.fillScreen(BGCOLOR); - DISP.setCursor(0, 5, 1); + DISP.setCursor(0, 0); DISP.println(String(TXT_SET_BRIGHT)); delay(1000); cursor = brightness / 10; @@ -558,6 +573,7 @@ MENU smenu[] = { { TXT_SDCARD, 97}, #endif #endif + { TXT_THEME, 23}, { TXT_ABOUT, 10}, { TXT_REBOOT, 98}, #if defined(USE_EEPROM) @@ -615,6 +631,275 @@ void smenu_loop() { } } +MENU cmenu[] = { + { TXT_BACK, 0}, + { TXT_BLACK, 1}, + { TXT_NAVY, 2}, + { TXT_DARKGREEN, 3}, + { TXT_DARKCYAN, 4}, + { TXT_MAROON, 5}, + { TXT_PURPLE, 6}, + { TXT_OLIVE, 7}, + { TXT_LIGHTGREY, 8}, + { TXT_DARKGREY, 9}, + { TXT_BLUE, 10}, + { TXT_GREEN, 11}, + { TXT_CYAN, 12}, + { TXT_RED, 13}, + { TXT_MAGENTA, 14}, + { TXT_YELLOW, 15}, + { TXT_WHITE, 16}, + { TXT_ORANGE, 17}, + { TXT_GREENYELLOW, 18}, + { TXT_PINK, 19}, +}; +int cmenu_size = sizeof(cmenu) / sizeof (MENU); + +void setcolor(bool fg, int col){ + uint16_t color = 0x0000; + switch (col){ + case 1: + color=0x0000; + break; + case 2: + color=0x000F; + break; + case 3: + color=0x03E0; + break; + case 4: + color=0x03EF; + break; + case 5: + color=0x7800; + break; + case 6: + color=0x780F; + break; + case 7: + color=0x7BE0; + break; + case 8: + color=0xC618; + break; + case 9: + color=0x7BEF; + break; + case 10: + color=0x001F; + break; + case 11: + color=0x07E0; + break; + case 12: + color=0x07FF; + break; + case 13: + color=0xF800; + break; + case 14: + color=0xF81F; + break; + case 15: + color=0xFFE0; + break; + case 16: + color=0xFFFF; + break; + case 17: + color=0xFDA0; + break; + case 18: + color=0xB7E0; + break; + case 19: + color=0xFC9F; + break; + } + if(fg){ + if(color == BGCOLOR){ + cursor++; + cursor = cursor % cmenu_size; + }else{ + FGCOLOR=color; + } + }else{ + if(color == FGCOLOR){ + cursor++; + cursor = cursor % cmenu_size; + }else{ + BGCOLOR=color; + } + } + DISP.setTextColor(FGCOLOR, BGCOLOR); +} + +void color_setup() { + DISP.fillScreen(BGCOLOR); + DISP.setCursor(0, 0); + DISP.println(String(TXT_SET_FGCOLOR)); + cursor = 0; + #if defined(USE_EEPROM) + cursor=EEPROM.read(4); // get current fg color + #endif + rstOverride = true; + delay(1000); + drawmenu(cmenu, cmenu_size); +} + +void color_loop() { + if (check_next_press()) { + cursor++; + cursor = cursor % cmenu_size; + setcolor(true, cursor); + drawmenu(cmenu, cmenu_size); + delay(250); + } + if (check_select_press()) { + #if defined(USE_EEPROM) + Serial.printf("EEPROM WRITE (4) FGCOLOR: %d\n", cursor); + EEPROM.write(4, cursor); + EEPROM.commit(); + cursor=EEPROM.read(5); // get current bg color + #endif + DISP.fillScreen(BGCOLOR); + DISP.setCursor(0, 0); + DISP.println(String(TXT_SET_BGCOLOR)); + delay(1000); + setcolor(false, cursor); + drawmenu(cmenu, cmenu_size); + while( !check_select_press()) { + if (check_next_press()) { + cursor++; + cursor = cursor % cmenu_size ; + setcolor(false, cursor); + drawmenu(cmenu, cmenu_size); + delay(250); + } + } + #if defined(USE_EEPROM) + Serial.printf("EEPROM WRITE (5) BGCOLOR: %d\n", cursor); + EEPROM.write(5, cursor); + EEPROM.commit(); + #endif + rstOverride = false; + isSwitching = true; + current_proc = 2; + } +} + +MENU thmenu[] = { + { TXT_BACK, 0}, + { "Nemo", 1}, + { "Tux", 2}, + { "Bill", 3}, + { "Steve", 4}, + { "Lilac", 5}, + { "Contrast", 6}, + { "NightShift", 7}, + { "Camo", 8}, + { "BubbleGum", 9}, + { TXT_COLOR, 99}, +}; +int thmenu_size = sizeof(thmenu) / sizeof (MENU); + +void theme_setup() { + DISP.fillScreen(BGCOLOR); + DISP.setCursor(0, 0); + DISP.println(String(TXT_THEME)); + cursor = 0; + rstOverride = true; + delay(1000); + drawmenu(thmenu, thmenu_size); +} + +void theme_loop() { + if (check_next_press()) { + cursor++; + cursor = cursor % thmenu_size; + switch (thmenu[cursor].command){ + case 0: + FGCOLOR=11; + BGCOLOR=1; + break; + case 1: // Nemo + FGCOLOR=11; + BGCOLOR=1; + break; + case 2: // Tux + FGCOLOR=8; + BGCOLOR=1; + break; + case 3: // Bill + FGCOLOR=16; + BGCOLOR=10; + break; + case 4: // Steve + FGCOLOR=1; + BGCOLOR=8; + break; + case 5: // Lilac + FGCOLOR=19; + BGCOLOR=6; + break; + case 6: // Contrast + FGCOLOR=16; + BGCOLOR=1; + break; + case 7: // NightShift + FGCOLOR=5; + BGCOLOR=1; + break; + case 8: // Camo + FGCOLOR=1; + BGCOLOR=7; + break; + case 9: // BubbleGum + FGCOLOR=1; + BGCOLOR=19; + break; + case 99: + FGCOLOR=11; + BGCOLOR=1; + break; + } + setcolor(true, FGCOLOR); + setcolor(false, BGCOLOR); + drawmenu(thmenu, thmenu_size); + delay(250); + } + if (check_select_press()) { + switch (thmenu[cursor].command){ + case 99: + rstOverride = false; + isSwitching = true; + current_proc = 22; + break; + case 0: + #if defined(USE_EEPROM) + setcolor(true, EEPROM.read(4)); + setcolor(false, EEPROM.read(5)); + #endif + rstOverride = false; + isSwitching = true; + current_proc = 2; + break; + default: + #if defined(USE_EEPROM) + Serial.printf("EEPROM WRITE (4) FGCOLOR: %d\n", FGCOLOR); + EEPROM.write(4, FGCOLOR); + Serial.printf("EEPROM WRITE (5) BGCOLOR: %d\n", BGCOLOR); + EEPROM.write(5, BGCOLOR); + #endif + rstOverride = false; + isSwitching = true; + current_proc = 2; + } + } +} + + + int rotation = 1; #if defined(ROTATION) /// Rotation MENU /// @@ -809,7 +1094,7 @@ int rotation = 1; void tvbgone_setup() { DISP.fillScreen(BGCOLOR); DISP.setTextSize(BIG_TEXT); - DISP.setCursor(5, 1); + DISP.setCursor(0, 0); DISP.println("TV-B-Gone"); DISP.setTextSize(SMALL_TEXT); irsend.begin(); @@ -848,7 +1133,7 @@ int tvbgmenu_size = sizeof(tvbgmenu) / sizeof (MENU); void tvbgmenu_setup() { DISP.fillScreen(BGCOLOR); DISP.setTextSize(BIG_TEXT); - DISP.setCursor(5, 1); + DISP.setCursor(0, 0); DISP.println("TV-B-Gone"); DISP.setTextSize(MEDIUM_TEXT); DISP.println(TXT_REGION); @@ -904,7 +1189,7 @@ void sendAllCodes() { const uint8_t numpairs = powerCode->numpairs; DISP.fillScreen(BGCOLOR); DISP.setTextSize(BIG_TEXT); - DISP.setCursor(5, 1); + DISP.setCursor(0, 0); DISP.println("TV-B-Gone"); DISP.setTextSize(SMALL_TEXT); DISP.println(TXT_FK_GP); @@ -956,7 +1241,7 @@ void sendAllCodes() { } DISP.fillScreen(BGCOLOR); DISP.setTextSize(BIG_TEXT); - DISP.setCursor(5, 1); + DISP.setCursor(0, 0); DISP.println("TV-B-Gone"); DISP.setTextSize(SMALL_TEXT); DISP.println(TXT_SEL_GO_PAUSE); @@ -988,7 +1273,7 @@ void sendAllCodes() { void timeset_setup() { rstOverride = true; DISP.fillScreen(BGCOLOR); - DISP.setCursor(0, 5, 1); + DISP.setCursor(0, 0); DISP.println(TXT_SET_HOUR); delay(2000); } @@ -1012,7 +1297,7 @@ void sendAllCodes() { } int hour = cursor; DISP.fillScreen(BGCOLOR); - DISP.setCursor(0, 5, 1); + DISP.setCursor(0, 0); DISP.println(TXT_SET_MIN); delay(2000); #if defined(STICK_C_PLUS2) @@ -1031,7 +1316,7 @@ void sendAllCodes() { } int minute = cursor; DISP.fillScreen(BGCOLOR); - DISP.setCursor(0, 5, 1); + DISP.setCursor(0, 0); #if defined(STICK_C_PLUS2) StickCP2.Rtc.setDateTime( { { dt.date.year, dt.date.month, dt.date.date }, { hour, minute, 0 } } ); #else @@ -1083,8 +1368,10 @@ void btmenu_loop() { int option = btmenu[cursor].command; DISP.fillScreen(BGCOLOR); DISP.setTextSize(MEDIUM_TEXT); - DISP.setCursor(5, 1); - DISP.println(TXT_BT_SPAM); + DISP.setCursor(0, 0); + DISP.setTextColor(BGCOLOR, FGCOLOR); + DISP.printf(" %-12s\n", TXT_BT_SPAM); + DISP.setTextColor(FGCOLOR, BGCOLOR); DISP.setTextSize(SMALL_TEXT); DISP.print(TXT_ADV); @@ -1175,8 +1462,10 @@ int ajmenu_size = sizeof(ajmenu) / sizeof (MENU); void aj_setup(){ DISP.fillScreen(BGCOLOR); DISP.setTextSize(MEDIUM_TEXT); - DISP.setCursor(5, 1); - DISP.println("AppleJuice"); + DISP.setCursor(0, 0); + DISP.setTextColor(BGCOLOR, FGCOLOR); + DISP.println(" AppleJuice "); + DISP.setTextColor(FGCOLOR, BGCOLOR); delay(1000); cursor = 0; sourApple = false; @@ -1297,8 +1586,10 @@ void aj_loop(){ if (current_proc == 8 && isSwitching == false){ DISP.fillScreen(BGCOLOR); DISP.setTextSize(MEDIUM_TEXT); - DISP.setCursor(5, 1); - DISP.println("AppleJuice"); + DISP.setCursor(0, 0); + DISP.setTextColor(BGCOLOR, FGCOLOR); + DISP.println(" AppleJuice "); + DISP.setTextColor(FGCOLOR, BGCOLOR); DISP.setTextSize(SMALL_TEXT); DISP.print(TXT_ADV); DISP.print(ajmenu[cursor].name); @@ -1505,7 +1796,7 @@ void wifispam_setup() { DISP.fillScreen(BGCOLOR); DISP.setTextSize(BIG_TEXT); - DISP.setCursor(5, 1); + DISP.setCursor(0, 0); DISP.println(TXT_WF_SP); delay(1000); DISP.setTextSize(TINY_TEXT); @@ -1656,23 +1947,37 @@ void wscan_drawmenu() { char ssid[19]; DISP.setTextSize(SMALL_TEXT); DISP.fillScreen(BGCOLOR); - DISP.setCursor(0, 5, 1); + DISP.setCursor(0, 0); // scrolling menu if (cursor > 4) { for ( int i = 0 + (cursor - 4) ; i < wifict ; i++ ) { - DISP.print((cursor == i) ? ">" : " "); + if(cursor == i){ + DISP.setTextColor(BGCOLOR, FGCOLOR); + } + DISP.print(" "); DISP.println(WiFi.SSID(i).substring(0,19)); + DISP.setTextColor(FGCOLOR, BGCOLOR); } } else { for ( int i = 0 ; i < wifict ; i++ ) { - DISP.print((cursor == i) ? ">" : " "); + if(cursor == i){ + DISP.setTextColor(BGCOLOR, FGCOLOR); + } + DISP.print(" "); DISP.println(WiFi.SSID(i).substring(0,19)); + DISP.setTextColor(FGCOLOR, BGCOLOR); } } - DISP.print((cursor == wifict) ? ">" : " "); + if(cursor == wifict){ + DISP.setTextColor(BGCOLOR, FGCOLOR); + } DISP.println(TXT_WF_RESCAN); - DISP.print((cursor == wifict + 1) ? ">" : " "); + DISP.setTextColor(FGCOLOR, BGCOLOR); + if(cursor == wifict + 1){ + DISP.setTextColor(BGCOLOR, FGCOLOR); + } DISP.println(String(TXT_BACK)); + DISP.setTextColor(FGCOLOR, BGCOLOR); } void wscan_result_setup() { @@ -1721,21 +2026,25 @@ void wscan_result_loop(){ encryptType = TXT_WF_OPEN; break ; } - - DISP.setTextSize(SMALL_TEXT); + DISP.fillScreen(BGCOLOR); + DISP.setCursor(0, 0); + DISP.setTextColor(BGCOLOR, FGCOLOR); if(WiFi.SSID(cursor).length() > 12){ + DISP.setTextSize(SMALL_TEXT); + }else if(WiFi.SSID(cursor).length() > 20){ DISP.setTextSize(TINY_TEXT); - } - DISP.fillScreen(BGCOLOR); - DISP.setCursor(5, 1); + }else{ + DISP.setTextSize(MEDIUM_TEXT); + } DISP.println(WiFi.SSID(cursor)); + DISP.setTextColor(FGCOLOR, BGCOLOR); DISP.setTextSize(SMALL_TEXT); DISP.printf(TXT_WF_CHANN, WiFi.channel(cursor)); DISP.printf(TXT_WF_CRYPT, encryptType); DISP.print("BSSID:\n" + WiFi.BSSIDstr(i)); DISP.printf(TXT_SEL_BACK); - DISP.setTextColor(TFT_RED, BGCOLOR); - DISP.printf(TXT_HOLD_ATTACK); + DISP.setTextColor(BGCOLOR, FGCOLOR); + DISP.printf(" %-19s\n", TXT_HOLD_ATTACK); DISP.setTextColor(FGCOLOR, BGCOLOR); if(check_select_press()){ apMac=WiFi.BSSIDstr(cursor); @@ -1756,7 +2065,7 @@ void wscan_setup(){ cursor = 0; DISP.fillScreen(BGCOLOR); DISP.setTextSize(BIG_TEXT); - DISP.setCursor(5, 1); + DISP.setCursor(0, 0); DISP.println(TXT_WF_SCN); delay(2000); } @@ -1764,12 +2073,12 @@ void wscan_setup(){ void wscan_loop(){ DISP.fillScreen(BGCOLOR); DISP.setTextSize(MEDIUM_TEXT); - DISP.setCursor(5, 1); + DISP.setCursor(0, 0); DISP.println(TXT_WF_SCNING); wifict = WiFi.scanNetworks(); DISP.fillScreen(BGCOLOR); DISP.setTextSize(SMALL_TEXT); - DISP.setCursor(5, 1); + DISP.setCursor(0, 0); if(wifict > 0){ isSwitching = true; current_proc=15; @@ -1847,7 +2156,7 @@ void wsAmenu_loop() { DISP.fillScreen(BGCOLOR); - DISP.setCursor(0, 5, 1); + DISP.setCursor(0, 0); DISP.setTextSize(BIG_TEXT); DISP.setTextColor(TFT_RED, BGCOLOR); DISP.println("Deauth Atk"); @@ -2070,7 +2379,9 @@ void setup() { Serial.printf("EEPROM 1 - Dim Time: %d\n", EEPROM.read(1)); Serial.printf("EEPROM 2 - Brightness: %d\n", EEPROM.read(2)); Serial.printf("EEPROM 3 - TVBG Reg: %d\n", EEPROM.read(3)); - if(EEPROM.read(0) > 3 || EEPROM.read(1) > 240 || EEPROM.read(2) > 100 || EEPROM.read(3) > 1) { + Serial.printf("EEPROM 4 - FGColor: %d\n", EEPROM.read(4)); + Serial.printf("EEPROM 5 - BGColor: %d\n", EEPROM.read(5)); + if(EEPROM.read(0) > 3 || EEPROM.read(1) > 240 || EEPROM.read(2) > 100 || EEPROM.read(3) > 1 || EEPROM.read(4) > 19 || EEPROM.read(5) > 19) { // Assume out-of-bounds settings are a fresh/corrupt EEPROM and write defaults for everything Serial.println("EEPROM likely not properly configured. Writing defaults."); #if defined(CARDPUTER) @@ -2080,13 +2391,17 @@ void setup() { #endif EEPROM.write(1, 15); // 15 second auto dim time EEPROM.write(2, 100); // 100% brightness - EEPROM.write(3, 0); // TVBG NA Region + EEPROM.write(3, 0); // TVBG NA Region + EEPROM.write(4, 11); // FGColor Green + EEPROM.write(5, 1); // BGcolor Black EEPROM.commit(); } rotation = EEPROM.read(0); screen_dim_time = EEPROM.read(1); brightness = EEPROM.read(2); region = EEPROM.read(3); + setcolor(true, EEPROM.read(4)); + setcolor(false, EEPROM.read(5)); #endif getSSID(); @@ -2219,6 +2534,12 @@ void loop() { deauth_setup(); break; #endif + case 22: + color_setup(); + break; + case 23: + theme_setup(); + break; } } @@ -2304,7 +2625,12 @@ void loop() { deauth_loop(); // DEAUTH break; // DEAUTH #endif // DEAUTH - + case 22: + color_loop(); + break; + case 23: + theme_loop(); + break; #if defined(SDCARD) // SDCARD M5Stick #ifndef CARDPUTER // SDCARD M5Stick case 97: diff --git a/portal.h b/portal.h index 04c1f59..c7ef5c9 100644 --- a/portal.h +++ b/portal.h @@ -59,12 +59,12 @@ void setSSID(String ssid){ #ifdef CARDPUTER void confirmOrTypeSSID(){ - DISP.fillScreen(BLACK); + DISP.fillScreen(BGCOLOR); DISP.setSwapBytes(true); DISP.setTextSize(MEDIUM_TEXT); - DISP.setTextColor(TFT_RED, BGCOLOR); + DISP.setTextColor(BGCOLOR, FGCOLOR); DISP.setCursor(0, 0); - DISP.println("WiFi SSID"); + DISP.println(" WiFi SSID "); DISP.setTextSize(TINY_TEXT); DISP.setTextColor(FGCOLOR, BGCOLOR); DISP.println(TYPE_SSID_TEXT); @@ -139,12 +139,12 @@ void getSSID(){ } void printHomeToScreen() { - DISP.fillScreen(BLACK); + DISP.fillScreen(BGCOLOR); DISP.setSwapBytes(true); DISP.setTextSize(MEDIUM_TEXT); - DISP.setTextColor(TFT_RED, BGCOLOR); + DISP.setTextColor(BGCOLOR, FGCOLOR); DISP.setCursor(0, 0); - DISP.println("NEMO PORTAL"); + DISP.println(" NEMO PORTAL "); DISP.setTextSize(SMALL_TEXT); DISP.setTextColor(FGCOLOR, BGCOLOR); DISP.printf("%s\n\n",apSsidName.c_str()); @@ -152,8 +152,8 @@ void printHomeToScreen() { DISP.println(AP_GATEWAY); DISP.println("Paths: /creds /ssid"); DISP.setTextSize(MEDIUM_TEXT); - DISP.setTextColor(TFT_RED, BGCOLOR); - DISP.printf("Victims: %d\n", totalCapturedCredentials); + DISP.setTextColor(BGCOLOR, FGCOLOR); + DISP.printf("Victims: %-4d\n", totalCapturedCredentials); DISP.setTextColor(FGCOLOR, BGCOLOR); } diff --git a/scripts/compile.sh b/scripts/compile.sh new file mode 100755 index 0000000..75d96b2 --- /dev/null +++ b/scripts/compile.sh @@ -0,0 +1,72 @@ +#!/bin/bash + +# Define the script usage +usage() { + cat <