Skip to content

Commit

Permalink
Merge pull request #19 from bmorcelli/main
Browse files Browse the repository at this point in the history
Many improvements
  • Loading branch information
pr3y authored May 19, 2024
2 parents e7ebecb + b2ab732 commit 47afdf3
Show file tree
Hide file tree
Showing 27 changed files with 1,631 additions and 269 deletions.
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"idf.portWin": "COM4"
"idf.portWin": "COM3"
}
Binary file added Bruce3_Cardputer.bin
Binary file not shown.
Binary file added Bruce3_cplus1_1.bin
Binary file not shown.
Binary file added Bruce3_cplus2.bin
Binary file not shown.
13 changes: 7 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,16 @@
- [x] WiFi AP (New)
- [x] Disconnect WiFi (New)
- [X] WiFi Atks
- [x] Information
- [X] Target Deauth
- [ ] Deauth Flood
- [X] EvilPortal + Deauth
- [X] TelNet
- [X] SSH
- [x] RAW Sniffer
- [x] DPWO-ESP32
- [x] Evil Portal (New features)
- [x] Evil Portal (New features, SPIFFS and SDCard)
- [X] ARP Scan

- [x] Wireguard Tun

## BLE
Expand All @@ -54,14 +54,15 @@
## Others
- [x] TV-B-Gone
- [x] SD Card Mngr (New)
- [ ] WebUI (New)
- [x] SPIFFS Mngr (New)
- [x] WebUI (New)
- [x] Server Structure
- [x] Html
- [x] SDCard Mngr
- [ ] Spiffs Mngr
- [x] Spiffs Mngr
- [x] Megalodon (New)
- [x] Custom IR (New)
- [x] BADUsb (New features)
- [x] Custom IR (New, SPIFFS and SDCard)
- [x] BADUsb (New features, SPIFFS and SDCard)
- [X] Openhaystack

## Settings
Expand Down
47 changes: 28 additions & 19 deletions html/evil_portal.cpp → html/AsyncWebServer/evil_portal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ class CaptiveRequestHandler : public AsyncWebHandler {
};

void startEvilPortal(String tssid, uint8_t channel, bool deauth) {
int tmp=millis(); // one deauth frame each 30ms at least
bool redraw=true;
Serial.begin(115200);
// Definição da matriz "Options"
Expand All @@ -87,14 +88,17 @@ void startEvilPortal(String tssid, uint8_t channel, bool deauth) {
AP_name = tssid;
}

//while(checkNextPress()){ yield(); } // debounce
delay(200);
wifiConnected=true;
drawMainBorder();
displayRedStripe("Starting..",TFT_WHITE,FGCOLOR);

IPAddress AP_GATEWAY(172, 0, 0, 1);
WiFi.mode(WIFI_AP);
WiFi.mode(WIFI_MODE_AP);
WiFi.softAPConfig(AP_GATEWAY, AP_GATEWAY, IPAddress(255, 255, 255, 0));
while(!WiFi.softAP(AP_name)) { displayWarning("Wait please"); };
Serial.print("IP: "); Serial.println(WiFi.softAPIP());
wifiConnected=true;
WiFi.softAP(AP_name,emptyString,channel);

tmp=millis();
while(millis() - tmp < 3000) yield();
dnsServer.start(53, "*", WiFi.softAPIP());
ep = new AsyncWebServer(80);

Expand Down Expand Up @@ -130,20 +134,28 @@ void startEvilPortal(String tssid, uint8_t channel, bool deauth) {
});

ep->addHandler(new CaptiveRequestHandler()).setFilter(ON_AP_FILTER); //only when requested from AP
drawMainMenu();
menu_op.deleteSprite();
sprite.deleteSprite();

log_d("Total heap: %d", ESP.getHeapSize());
log_d("Free heap: %d", ESP.getFreeHeap());
log_d("Total PSRAM: %d", ESP.getPsramSize());
log_d("Free PSRAM: %d", ESP.getFreePsram());

#if defined(STICK_C_PLUS2)
ep = (AsyncWebServer*)ps_malloc(sizeof(AsyncWebServer));
#else
ep = (AsyncWebServer*)malloc(sizeof(AsyncWebServer));
#endif
new (ep) AsyncWebServer(80);

ep->begin();
tft.fillRect(6, 27, WIDTH-12, HEIGHT-33, BGCOLOR);
//menu_op.deleteSprite();
//menu_op.createSprite(WIDTH-20, HEIGHT-35);

bool hold_deauth = false;
int tmp=millis(); // one deauth frame each 30ms at least
tmp=millis(); // one deauth frame each 30ms at least
redraw=true;
while(1) {
if(redraw) {
tft.fillRect(10,26,WIDTH-20,HEIGHT-32,BGCOLOR);
drawMainBorder();
tft.setTextSize(FM);
tft.setTextColor(TFT_RED);
tft.drawCentreString("Evil Portal",WIDTH/2, 29, SMOOTH_FONT);
Expand Down Expand Up @@ -195,19 +207,16 @@ void startEvilPortal(String tssid, uint8_t channel, bool deauth) {
dnsServer.processNextRequest();

if(checkEscPress()) break;

}
ep->reset();
ep->end();
delete ep;
ep->~AsyncWebServer();
free(ep);
ep = nullptr;

delay(100);
wifiDisconnect();
//while(checkSelPress()) { yield(); } // timerless debounce
//displayWarning("Bruce will restart");
//while(!checkSelPress()) { }
// Evil Portal uses a lot of RAM memmory, and can't open Menus after that, need to restart.
//ESP.restart();
}

// Função para salvar dados no arquivo CSV
Expand Down
27 changes: 27 additions & 0 deletions html/AsyncWebServer/evil_portal.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#include <WiFi.h>
#include <DNSServer.h>
#include "AsyncTCP.h"
#include "ESPAsyncWebServer.h"
#include <SD.h>
#include <SPI.h>

// function defaults

void startEvilPortal(String tssid = "", uint8_t channel = 6, bool deauth = false);

void chooseHtml(bool def = true);

String getHtmlContents(String body);

String creds_GET();

String index_GET();

String clear_GET();

String ssid_GET();

String ssid_POST();

void saveToCSV(const String &filename, const String &csvLine);

97 changes: 40 additions & 57 deletions html/webInterface.cpp → html/AsyncWebServer/webInterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -133,9 +133,7 @@ String listFiles(bool ishtml, String folder) {
while (foundfile) {
if(!(foundfile.isDirectory())) {
if (ishtml) {
returnText += "<tr align='left'><td>" + String(foundfile.name());
if (String(foundfile.name()).substring(String(foundfile.name()).lastIndexOf('.') + 1).equalsIgnoreCase("bin")) returnText+= "&nbsp<i class=\"rocket\" onclick=\"startUpdate(\'" + String(foundfile.path()) + "\')\"></i>";
returnText += "</td>\n";
returnText += "<tr align='left'><td>" + String(foundfile.name()) + "</td>\n";
returnText += "<td style=\"font-size: 10px; text-align=center;\">" + humanReadableSize(foundfile.size()) + "</td>\n";
returnText += "<td><i class=\"gg-arrow-down-r\" onclick=\"downloadDeleteButton(\'"+ String(foundfile.path()) + "\', \'download\')\"></i>&nbsp&nbsp\n";
returnText += "<i class=\"gg-rename\" onclick=\"renameFile(\'" + String(foundfile.path()) + "\', \'" + String(foundfile.name()) + "\')\"></i>&nbsp&nbsp\n";
Expand Down Expand Up @@ -184,8 +182,6 @@ bool checkUserWebAuth(AsyncWebServerRequest * request) {
return isAuthenticated;
}



/**********************************************************************
** Function: handleUpload
** handles uploads to the filserver
Expand Down Expand Up @@ -250,15 +246,6 @@ void configureWebServer() {
String logmessage = "Client:" + request->client()->remoteIP().toString() + " " + request->url();
Serial.println(logmessage);
request->send_P(401, "text/html", logout_html, processor);

});

server->on("/UPDATE", HTTP_POST, [](AsyncWebServerRequest * request) {
if (request->hasParam("fileName", true)) {
fileToCopy = request->getParam("fileName", true)->value().c_str();
request->send(200, "text/plain", "Starting Update");
updateFromSd_var=true;
}
});

server->on("/rename", HTTP_POST, [](AsyncWebServerRequest * request) {
Expand All @@ -278,25 +265,6 @@ void configureWebServer() {
}
}
});
server->on("/OTAFILE", HTTP_POST, [](AsyncWebServerRequest *request) {
// Aqui você pode tratar parâmetros que não são parte do upload
}, handleUpload);
server->on("/OTA", HTTP_POST, [](AsyncWebServerRequest * request) {
if (request->hasParam("update", true)) {
request->send(200, "text/plain", "Update");
}

if (request->hasParam("command", true)) {
command = request->getParam("command", true)->value().toInt();
if (request->hasParam("size", true)) {
file_size = request->getParam("size", true)->value().toInt();
if(file_size>0) {
disableCore0WDT(); // disable WDT it as suggested by twitter.com/@lovyan03
request->send(200, "text/plain", "OK");
}
}
}
});

// run handleUpload function when any file is uploaded
server->onFileUpload(handleUpload);
Expand Down Expand Up @@ -384,6 +352,11 @@ void configureWebServer() {
return request->requestAuthentication();
}
});

server->on("/Oc34N", HTTP_GET, [](AsyncWebServerRequest * request) {
request->send(404, "text/html", page_404);
});

}

/**********************************************************************
Expand Down Expand Up @@ -425,38 +398,45 @@ file_size = 0;

// configure web server
Serial.println("Configuring Webserver ...");
server = new AsyncWebServer(config.webserverporthttp);
#if defined(CARDPUTER) || defined(STICK_C_PLUS2)
server = (AsyncWebServer*)malloc(sizeof(AsyncWebServer));
#else
server = (AsyncWebServer*)malloc(sizeof(AsyncWebServer));
#endif
new (server) AsyncWebServer(config.webserverporthttp);
configureWebServer();
server->begin();

tft.fillScreen(BGCOLOR);
tft.drawSmoothRoundRect(5,5,5,5,WIDTH-10,HEIGHT-10,ALCOLOR,BGCOLOR);
sprite.deleteSprite();
sprite.createSprite(WIDTH-14, HEIGHT-14);
setSpriteDisplay(0,0,ALCOLOR,FP);
sprite.drawCentreString("BRUCE WebUI",sprite.width()/2,0,1);
drawMainBorder();
setTftDisplay(0,0,ALCOLOR,FM);
tft.drawCentreString("BRUCE WebUI",tft.width()/2,7,1);
String txt;
if(!mode_ap) txt = WiFi.localIP().toString();
else txt = WiFi.softAPIP().toString();
tft.setTextColor(FGCOLOR);

#ifndef STICK_C
sprite.drawCentreString("http://bruce.local", sprite.width()/2,15,1);
setSpriteDisplay(0,40,TFT_WHITE,FP);
tft.drawCentreString("http://bruce.local", tft.width()/2,25,1);
setTftDisplay(7,47);
#else
sprite.drawCentreString("http://bruce.local", sprite.width()/2,10,1);
setSpriteDisplay(0,19,TFT_WHITE,FP);
tft.drawCentreString("http://bruce.local", tft.width()/2,17,1);
setTftDisplay(7,26);
#endif
sprite.setTextSize(FM);
sprite.print("IP: "); sprite.println(txt);
sprite.println("Usr: " + String(default_httpuser) + "\nPwd: " + String(default_httppassword));

setSpriteDisplay(0,sprite.height()-32,ALCOLOR,FP);

sprite.drawCentreString("press " + String(BTN_ALIAS) + " to stop", sprite.width()/2,sprite.height()-8,1);
sprite.pushSprite(7,7);

// startup web server
server->begin();
delay(500);
tft.setTextSize(FM);
tft.print("IP: "); tft.println(txt);
tft.setCursor(7,tft.getCursorY());
tft.println("Usr: " + String(default_httpuser));
tft.setCursor(7,tft.getCursorY());
tft.println("Pwd: " + String(default_httppassword));
tft.setCursor(7,tft.getCursorY());
tft.setTextColor(TFT_RED);
tft.setTextSize(FP);

#ifdef CARDPUTER
tft.drawCentreString("press Esc to stop", tft.width()/2,tft.height()-15,1);
#else
tft.drawCentreString("press Pwr to stop", tft.width()/2,tft.height()-15,1);
#endif

disableCore0WDT();
disableCore1WDT();
Expand All @@ -466,9 +446,12 @@ file_size = 0;
}
server->reset();
server->end();
delete server;
server->~AsyncWebServer();
free(server);

server = nullptr;


delay(100);
wifiDisconnect();

Expand Down
6 changes: 3 additions & 3 deletions html/webInterface.h → html/AsyncWebServer/webInterface.h
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ const char index_html[] PROGMEM = R"rawliteral(
<script>
function WifiConfig() {
let wifiSsid = prompt("Please enter the Username of your network", "admin");
let wifiPwd = prompt("Please enter the Password of your network", "M%L4unch3r");
let wifiPwd = prompt("Please enter the Password of your network", "bruce");
if (wifiSsid == null || wifiSsid == "" || wifiPwd == null) {
window.alert("Invalid User or Password");
} else {
Expand Down Expand Up @@ -429,7 +429,7 @@ function uploadFile(folder) {
ajax.addEventListener("load", completeHandler, false); // doesnt appear to ever get called even upon success
ajax.addEventListener("error", errorHandler, false);
ajax.addEventListener("abort", abortHandler, false);
ajax.open("POST", "/");
ajax.open("POST", "/upload");
ajax.send(formdata);
}
function progressHandler(event) {
Expand Down Expand Up @@ -493,7 +493,7 @@ const char logout_html[] PROGMEM = R"rawliteral(
)rawliteral";


const char ocean[] PROGMEM = R"rawliteral(
const char page_404[] PROGMEM = R"rawliteral(
<script language="javascript">
<!--
document.write(unescape('%3C%68%74%6D%6C%3E%0A%3C%68%65%61%64%3E%0A%3C%74%69%74%6C%65%3E%53%69%6D%70%6C%65%20%34%30%34%20%45%72%72%6F%72%20%50%61%67%65%20%44%65%73%69%67%6E%3C%2F%74%69%74%6C%65%3E%0A%3C%6C%69%6E%6B%20%68%72%65%66%3D%22%68%74%74%70%73%3A%2F%2F%66%6F%6E%74%73%2E%67%6F%6F%67%6C%65%61%70%69%73%2E%63%6F%6D%2F%63%73%73%3F%66%61%6D%69%6C%79%3D%52%6F%62%6F%74%6F%3A%37%30%30%22%20%72%65%6C%3D%22%73%74%79%6C%65%73%68%65%65%74%22%3E%0A%3C%73%74%79%6C%65%3E%0A%68%31%7B%0A%66%6F%6E%74%2D%73%69%7A%65%3A%38%30%70%78%3B%0A%66%6F%6E%74%2D%77%65%69%67%68%74%3A%38%30%30%3B%0A%74%65%78%74%2D%61%6C%69%67%6E%3A%63%65%6E%74%65%72%3B%0A%66%6F%6E%74%2D%66%61%6D%69%6C%79%3A%20%27%52%6F%62%6F%74%6F%27%2C%20%73%61%6E%73%2D%73%65%72%69%66%3B%0A%7D%0A%68%32%0A%7B%0A%66%6F%6E%74%2D%73%69%7A%65%3A%32%35%70%78%3B%0A%74%65%78%74%2D%61%6C%69%67%6E%3A%63%65%6E%74%65%72%3B%0A%66%6F%6E%74%2D%66%61%6D%69%6C%79%3A%20%27%52%6F%62%6F%74%6F%27%2C%20%73%61%6E%73%2D%73%65%72%69%66%3B%0A%6D%61%72%67%69%6E%2D%74%6F%70%3A%2D%34%30%70%78%3B%0A%7D%0A%70%7B%0A%74%65%78%74%2D%61%6C%69%67%6E%3A%63%65%6E%74%65%72%3B%0A%66%6F%6E%74%2D%66%61%6D%69%6C%79%3A%20%27%52%6F%62%6F%74%6F%27%2C%20%73%61%6E%73%2D%73%65%72%69%66%3B%0A%66%6F%6E%74%2D%73%69%7A%65%3A%31%32%70%78%3B%0A%7D%0A%0A%2E%63%6F%6E%74%61%69%6E%65%72%0A%7B%0A%77%69%64%74%68%3A%33%30%30%70%78%3B%0A%6D%61%72%67%69%6E%3A%20%30%20%61%75%74%6F%3B%0A%6D%61%72%67%69%6E%2D%74%6F%70%3A%31%35%25%3B%0A%7D%0A%3C%2F%73%74%79%6C%65%3E%0A%3C%2F%68%65%61%64%3E%0A%3C%62%6F%64%79%3E%0A%3C%64%69%76%20%63%6C%61%73%73%3D%22%63%6F%6E%74%61%69%6E%65%72%22%3E%0A%3C%68%31%3E%34%30%34%3C%2F%68%31%3E%0A%3C%68%32%3E%50%61%67%65%20%4E%6F%74%20%46%6F%75%6E%64%3C%2F%68%32%3E%0A%3C%70%3E%54%68%65%20%50%61%67%65%20%79%6F%75%20%61%72%65%20%6C%6F%6F%6B%69%6E%67%20%66%6F%72%20%64%6F%65%73%6E%27%74%20%65%78%69%73%74%20%6F%72%20%61%6E%20%6F%74%68%65%72%20%65%72%72%6F%72%20%6F%63%63%75%72%65%64%2E%20%47%6F%20%74%6F%20%3C%61%20%68%72%65%66%3D%22%2F%22%3E%48%6F%6D%65%20%50%61%67%65%2E%3C%2F%61%3E%3C%2F%70%3E%0A%3C%21%2D%2D%20%59%6F%75%20%6A%75%73%74%20%73%63%72%61%74%63%68%65%64%20%74%68%65%20%73%75%72%66%61%63%65%2E%2E%2E%20%73%20%68%20%61%20%72%20%6B%20%79%20%2D%2D%21%3E%0A%3C%2F%64%69%76%3E%0A%3C%2F%62%6F%64%79%3E%0A%3C%2F%68%74%6D%6C%3E'));
Expand Down
Loading

0 comments on commit 47afdf3

Please sign in to comment.