Skip to content

Commit

Permalink
Merge pull request #4 from henriquesebastiao/dev
Browse files Browse the repository at this point in the history
Add new features sound and wifi signal level.
  • Loading branch information
henriquesebastiao authored Jun 8, 2024
2 parents cd3525c + a9a5dea commit c7a0be5
Show file tree
Hide file tree
Showing 5 changed files with 1,222 additions and 1 deletion.
150 changes: 150 additions & 0 deletions saturn.ino
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#include "src/sd.h"
#include "src/portal.h"
#include "src/applejuice.h"
#include "src/sounds.h"

IRsend irsend(IR_SEND_PIN);

Expand All @@ -39,6 +40,7 @@ Menu mainMenu[] = {
{TXT_IR, 4},
{"WiFi", 20},
{"Bluetooth", 27},
{TXT_SOUNDS, 31},
{"QR Codes", 2},
{TXT_SETTINGS, 3},
};
Expand Down Expand Up @@ -78,6 +80,7 @@ Menu wifiMenu[] = {
int wifiMenuSize = sizeof(wifiMenu) / sizeof(Menu);

Menu wifiAttackMenu[] = {
{TXT_SIGNAL_LEVEL, 3},
{TXT_WIFI_PORTAL, 0},
{TXT_WIFI_DEAUTH, 1},
{TXT_WIFI_COMBINED, 2},
Expand Down Expand Up @@ -129,6 +132,18 @@ Menu appleJuiceMenu[] = {
};
int appleJuiceMenuSize = sizeof(appleJuiceMenu) / sizeof(Menu);

Menu soundMenu[] = {
{"Super Mario Bross", 1},
{"Crazy Train", 5},
{TXT_IMPERIAL_MARCH_SOUND, 2},
{"Aha Take On Me", 3},
{"Jingle Bells", 4},
{"Star Wars", 6},
{"Nokia Ringtone", 7},
{TXT_BACK, 0},
};
int soundMenuSize = sizeof(soundMenu) / sizeof(Menu);

QrCode qrMenu[] = {
{"Saturn", "https://youtu.be/dzNvk80XY9s"},
{TXT_INTERSTELLAR, "https://youtu.be/JuSsvM8B4Jc"},
Expand Down Expand Up @@ -758,13 +773,87 @@ void wifiAttackMenuLoop() {
target_deauth=true;
currentProc = 25; // Combined TODO
break;
case 3: // Signal Level
currentProc = 32;
break;
case 5:
currentProc = 20;
break;
}
}
}

void wifiSignalLevelSetup() {
rstOverride = true;

DISPLAY.fillScreen(BG_COLOR);
DISPLAY.setTextSize(MEDIUM_TEXT);
DISPLAY.drawString(TXT_SIGNAL_LEVEL, DISPLAY_CENTER_X, 50);
delay(500);
}

void wifiSignalLevelLoop() {
// Reescan networks
int networks = WiFi.scanNetworks();
for (int i = 0; i < networks; i++) {
if (WiFi.BSSIDstr(i) == apMac) {
cursor = i;
break;
}
}

int signalLevel = WiFi.RSSI(cursor);
int signalFeedbackDuration = 100;
String signal = String(WiFi.RSSI(cursor)) + "dbm";
String ssid = WiFi.SSID(cursor);
String channel = String(WiFi.channel(cursor));

DISPLAY.fillScreen(BG_COLOR);

DISPLAY.setTextSize(MEDIUM_TEXT);
DISPLAY.setTextColor(BG_COLOR);
DISPLAY.fillRoundRect(5, 4, DISPLAY.width() - 10, 30, 10, MAIN_COLOR);
DISPLAY.drawRoundRect(5, 4, DISPLAY.width() - 10, 30, 10, MAIN_COLOR);
DISPLAY.drawString(TXT_SIGNAL_LEVEL, DISPLAY_CENTER_X, 20);
DISPLAY.setTextColor(MAIN_COLOR);
DISPLAY.setTextSize(1.5);
DISPLAY.drawString(ssid, DISPLAY_CENTER_X, 50);
DISPLAY.drawString(TXT_WF_CHANN + channel, DISPLAY_CENTER_X, 65);
DISPLAY.setTextSize(LARGE_TEXT);
DISPLAY.drawString(signal, DISPLAY_CENTER_X, 100);

int frequency;

if (signalLevel > -25) {
frequency = 5500;
} else if (signalLevel > -30) {
frequency = 5000;
} else if (signalLevel > -45) {
frequency = 4500;
} else if (signalLevel > -50) {
frequency = 4000;
} else if (signalLevel > -60) {
frequency = 3500;
} else if (signalLevel > -70) {
frequency = 3000;
} else if (signalLevel > -80) {
frequency = 2000;
} else if (signalLevel > -90) {
frequency = 1000;
} else {
frequency = 500;
}

M5Cardputer.Speaker.tone(frequency, signalFeedbackDuration);

// delay(200);
if (checkNextPress() || checkESCPress() || checkSelectPress()) {
rstOverride = false;
isSwitching = true;
currentProc = 23;
}
}

// -=-=-= DEAUTH =-=-=-

void deauthSetup(){
Expand Down Expand Up @@ -1358,6 +1447,55 @@ void bluetoothMaelstromLoop(){
}
}

// -=-=-= SOUNDS =-=-=-

void soundMenuSetup() {
cursor = 0;
rstOverride = true;
drawMenu(soundMenu, soundMenuSize);
delay(500);
}

void soundMenuLoop() {
if (checkNextPress()) {
cursor++;
cursor = cursor % soundMenuSize;
drawMenu(soundMenu, soundMenuSize);
delay(250);
}
if (checkSelectPress()) {
int option = soundMenu[cursor].command;
rstOverride = false;
isSwitching = true;
switch(option) {
case 0:
currentProc = 1;
break;
case 1:
superMarioBrossSound();
break;
case 2:
imperialMarchSound();
break;
case 3:
ahaTakeOnMeSound();
break;
case 4:
jingleBellsSound();
break;
case 5:
ozzyOsbornCrazyTrainSound();
break;
case 6:
starWarsSound();
break;
case 7:
nokiaSound();
break;
}
}
}

// -=-=-= QR CODES =-=-=-

void qrMenuSetup() {
Expand Down Expand Up @@ -1716,6 +1854,12 @@ void loop() {
case 30:
bluetoothMaelstromSetup();
break;
case 31:
soundMenuSetup();
break;
case 32:
wifiSignalLevelSetup();
break;
}
}

Expand Down Expand Up @@ -1771,5 +1915,11 @@ void loop() {
case 30:
bluetoothMaelstromLoop();
break;
case 31:
soundMenuLoop();
break;
case 32:
wifiSignalLevelLoop();
break;
}
}
6 changes: 6 additions & 0 deletions src/language.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,9 @@
#define TXT_AD_SPAM_ADV "Android Spam Advertisement: "
#define TXT_AJ_ADV "AppleJuice Advertisement: "
#define TXT_DEFAULT_AP_SSID_NAME "Free WiFi"
#define TXT_SOUNDS "Sounds"
#define TXT_IMPERIAL_MARCH_SOUND "Imperial March"
#define TXT_SIGNAL_LEVEL "Signal Level"
#endif

#if defined(LANGUAGE_PT_BR)
Expand Down Expand Up @@ -122,4 +125,7 @@
#define TXT_AD_SPAM_ADV "Aviso Android Spam: "
#define TXT_AJ_ADV "Aviso AppleJuice: "
#define TXT_DEFAULT_AP_SSID_NAME "WiFi Livre"
#define TXT_SOUNDS "Sons"
#define TXT_IMPERIAL_MARCH_SOUND "Marcha Imperial"
#define TXT_SIGNAL_LEVEL "Nivel de Sinal"
#endif
101 changes: 101 additions & 0 deletions src/pitches.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
// -------------------------------------------------
// Copyright (c) 2021 HiBit <https://www.hibit.dev>
// -------------------------------------------------

#ifndef pitches_h
#define pitches_h

#define NOTE_B0 31
#define NOTE_C1 33
#define NOTE_CS1 35
#define NOTE_D1 37
#define NOTE_DS1 39
#define NOTE_E1 41
#define NOTE_F1 44
#define NOTE_FS1 46
#define NOTE_G1 49
#define NOTE_GS1 52
#define NOTE_A1 55
#define NOTE_AS1 58
#define NOTE_B1 62
#define NOTE_C2 65
#define NOTE_CS2 69
#define NOTE_D2 73
#define NOTE_DS2 78
#define NOTE_E2 82
#define NOTE_F2 87
#define NOTE_FS2 93
#define NOTE_G2 98
#define NOTE_GS2 104
#define NOTE_A2 110
#define NOTE_AS2 117
#define NOTE_B2 123
#define NOTE_C3 131
#define NOTE_CS3 139
#define NOTE_DB3 139
#define NOTE_D3 147
#define NOTE_DS3 156
#define NOTE_EB3 156
#define NOTE_E3 165
#define NOTE_F3 175
#define NOTE_FS3 185
#define NOTE_G3 196
#define NOTE_GS3 208
#define NOTE_A3 220
#define NOTE_AS3 233
#define NOTE_B3 247
#define NOTE_C4 262
#define NOTE_CS4 277
#define NOTE_D4 294
#define NOTE_DS4 311
#define NOTE_E4 330
#define NOTE_F4 349
#define NOTE_FS4 370
#define NOTE_G4 392
#define NOTE_GS4 415
#define NOTE_A4 440
#define NOTE_AS4 466
#define NOTE_B4 494
#define NOTE_C5 523
#define NOTE_CS5 554
#define NOTE_D5 587
#define NOTE_DS5 622
#define NOTE_E5 659
#define NOTE_F5 698
#define NOTE_FS5 740
#define NOTE_G5 784
#define NOTE_GS5 831
#define NOTE_A5 880
#define NOTE_AS5 932
#define NOTE_B5 988
#define NOTE_C6 1047
#define NOTE_CS6 1109
#define NOTE_D6 1175
#define NOTE_DS6 1245
#define NOTE_E6 1319
#define NOTE_F6 1397
#define NOTE_FS6 1480
#define NOTE_G6 1568
#define NOTE_GS6 1661
#define NOTE_A6 1760
#define NOTE_AS6 1865
#define NOTE_B6 1976
#define NOTE_C7 2093
#define NOTE_CS7 2217
#define NOTE_D7 2349
#define NOTE_DS7 2489
#define NOTE_E7 2637
#define NOTE_F7 2794
#define NOTE_FS7 2960
#define NOTE_G7 3136
#define NOTE_GS7 3322
#define NOTE_A7 3520
#define NOTE_AS7 3729
#define NOTE_B7 3951
#define NOTE_C8 4186
#define NOTE_CS8 4435
#define NOTE_D8 4699
#define NOTE_DS8 4978
#define REST 0

#endif
3 changes: 2 additions & 1 deletion src/settings.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,4 +67,5 @@ const byte PortalTickTimer = 1000;
int brightness = 100;
bool activeQR = false;
wifi_ap_record_t ap_record;
String apSsidName = String("");
String apSsidName = String("");
String bssidToCheck;
Loading

0 comments on commit c7a0be5

Please sign in to comment.