mirror of
https://github.com/justcallmekoko/ESP32Marauder.git
synced 2025-12-23 07:29:14 -08:00
Check Marauder SD for HTML files
This commit is contained in:
@@ -3,11 +3,24 @@
|
||||
AsyncWebServer server(80);
|
||||
|
||||
EvilPortal::EvilPortal() {
|
||||
}
|
||||
|
||||
void EvilPortal::setup() {
|
||||
this->runServer = false;
|
||||
this->name_received = false;
|
||||
this->password_received = false;
|
||||
this->has_html = false;
|
||||
this->has_ap = false;
|
||||
|
||||
html_files = new LinkedList<String>();
|
||||
|
||||
#ifdef HAS_SD
|
||||
if (sd_obj.supported) {
|
||||
sd_obj.listDirToLinkedList(html_files, "/", "html");
|
||||
|
||||
Serial.println("Evil Portal Found " + (String)html_files->size() + " HTML files");
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
bool EvilPortal::begin(LinkedList<ssid>* ssids, LinkedList<AccessPoint>* access_points) {
|
||||
|
||||
@@ -103,8 +103,11 @@ class EvilPortal {
|
||||
|
||||
bool using_serial_html;
|
||||
|
||||
LinkedList<String>* html_files;
|
||||
|
||||
String get_user_name();
|
||||
String get_password();
|
||||
void setup();
|
||||
void addLog(String log, int len);
|
||||
bool begin(LinkedList<ssid>* ssids, LinkedList<AccessPoint>* access_points);
|
||||
void main(uint8_t scan_mode);
|
||||
|
||||
@@ -100,12 +100,32 @@ File SDInterface::getFile(String path) {
|
||||
}
|
||||
}
|
||||
|
||||
void SDInterface::listDirToLinkedList(LinkedList<String>* file_names, String str_dir, String ext) {
|
||||
if (this->supported) {
|
||||
File dir = SD.open(str_dir);
|
||||
while (true)
|
||||
{
|
||||
File entry = dir.openNextFile();
|
||||
if (!entry)
|
||||
{
|
||||
break;
|
||||
}
|
||||
if (ext != "") {
|
||||
String file_name = entry.name();
|
||||
if (file_name.endsWith(ext)) {
|
||||
file_names->add(file_name);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void SDInterface::listDir(String str_dir){
|
||||
if (this->supported) {
|
||||
File dir = SD.open(str_dir);
|
||||
while (true)
|
||||
{
|
||||
File entry = dir.openNextFile();
|
||||
File entry = dir.openNextFile();
|
||||
if (! entry)
|
||||
{
|
||||
break;
|
||||
|
||||
@@ -40,6 +40,7 @@ class SDInterface {
|
||||
bool initSD();
|
||||
|
||||
void listDir(String str_dir);
|
||||
void listDirToLinkedList(LinkedList<String>* file_names, String str_dir = "/", String ext = "");
|
||||
File getFile(String path);
|
||||
void addPacket(uint8_t* buf, uint32_t len, bool log = false);
|
||||
void openCapture(String file_name = "");
|
||||
|
||||
@@ -311,6 +311,8 @@ void setup()
|
||||
}
|
||||
#endif
|
||||
|
||||
evil_portal_obj.setup();
|
||||
|
||||
#ifdef HAS_BATTERY
|
||||
battery_obj.RunSetup();
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user