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

Evil portal #395

Merged
merged 4 commits into from
Nov 18, 2023
Merged
Show file tree
Hide file tree
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
5 changes: 5 additions & 0 deletions esp32_marauder/CommandLine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -497,6 +497,7 @@ void CommandLine::runCommand(String input) {
if (html_sw != -1) {
String target_html_name = cmd_args.get(html_sw + 1);
evil_portal_obj.target_html_name = target_html_name;
evil_portal_obj.using_serial_html = false;
Serial.println("Set html file as " + evil_portal_obj.target_html_name);
}
//else {
Expand All @@ -513,8 +514,12 @@ void CommandLine::runCommand(String input) {
else if (et_command == "sethtml") {
String target_html_name = cmd_args.get(cmd_sw + 2);
evil_portal_obj.target_html_name = target_html_name;
evil_portal_obj.using_serial_html = false;
Serial.println("Set html file as " + evil_portal_obj.target_html_name);
}
else if (et_command == "sethtmlstr") {
evil_portal_obj.setHtmlFromSerial();
}
else if (et_command == "setap") {

}
Expand Down
13 changes: 13 additions & 0 deletions esp32_marauder/EvilPortal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,20 @@ void EvilPortal::setupServer() {
Serial.println("web server up");
}

void EvilPortal::setHtmlFromSerial() {
Serial.println("Setting HTML from serial...");
const char *htmlStr = Serial.readString().c_str();
strncpy(index_html, htmlStr, strlen(htmlStr));
this->has_html = true;
this->using_serial_html = true;
Serial.println("html set");
}

bool EvilPortal::setHtml() {
if (this->using_serial_html) {
Serial.println("html previously set");
return true;
}
Serial.println("Setting HTML...");
#ifndef WRITE_PACKETS_SERIAL
File html_file = sd_obj.getFile("/" + this->target_html_name);
Expand Down
3 changes: 3 additions & 0 deletions esp32_marauder/EvilPortal.h
Original file line number Diff line number Diff line change
Expand Up @@ -101,11 +101,14 @@ class EvilPortal {

String target_html_name = "index.html";

bool using_serial_html;

String get_user_name();
String get_password();
void addLog(String log, int len);
bool begin(LinkedList<ssid>* ssids, LinkedList<AccessPoint>* access_points);
void main(uint8_t scan_mode);
void setHtmlFromSerial();

};

Expand Down
Loading