Check Marauder SD for HTML files

This commit is contained in:
Just Call Me Koko
2023-11-22 16:32:17 -05:00
parent 4200093a11
commit 61861c83ab
5 changed files with 40 additions and 1 deletions

View File

@@ -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) {

View File

@@ -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);

View File

@@ -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;

View File

@@ -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 = "");

View File

@@ -311,6 +311,8 @@ void setup()
}
#endif
evil_portal_obj.setup();
#ifdef HAS_BATTERY
battery_obj.RunSetup();
#endif