mirror of
https://github.com/justcallmekoko/ESP32Marauder.git
synced 2025-12-22 23:26:45 -08:00
EP: allow loading HTML over serial
This commit is contained in:
@@ -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 {
|
||||
@@ -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") {
|
||||
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -83,6 +83,7 @@ class EvilPortal {
|
||||
|
||||
bool has_html;
|
||||
bool has_ap;
|
||||
bool using_serial_html;
|
||||
|
||||
DNSServer dnsServer;
|
||||
|
||||
@@ -106,6 +107,7 @@ class EvilPortal {
|
||||
void addLog(String log, int len);
|
||||
bool begin(LinkedList<ssid>* ssids, LinkedList<AccessPoint>* access_points);
|
||||
void main(uint8_t scan_mode);
|
||||
void setHtmlFromSerial();
|
||||
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user