handshake-capture-c6 v1.0.4: persist captured BSSIDs, PCAP EAPOL recount

- /cap_bssids.txt append on save; handshakeLoadPersistedBssids after SD mount
- Boot order: SD then load file then first WiFi scan (reds match SD)
- Pre-save walk of in-memory PCAP counting EAPOL-Key frames
- SD_AppendLine / SD_ForEachLine; drop g_sd_ready clear on write fail
- README + MUST_DO updates

Made-with: Cursor
This commit is contained in:
drjones
2026-03-23 09:35:18 -07:00
parent 7e93324288
commit 8121137b68
7 changed files with 170 additions and 10 deletions

View File

@@ -69,12 +69,49 @@ bool SD_WriteFileAtomic(const char* path, const uint8_t* data, size_t len) {
ok = (file.write(data, len) == len);
file.close();
}
if (!ok) {
g_sd_ready = false;
}
endSDOperation();
if (len >= 1024) yield();
return ok;
}
bool SD_AppendLine(const char* path, const char* line) {
if (path == nullptr || line == nullptr) return false;
beginSDOperation();
bool ok = false;
File f = SD.open(path, FILE_APPEND);
if (f) {
size_t n = strlen(line);
ok = (f.write((const uint8_t*)line, n) == n);
f.close();
}
endSDOperation();
return ok;
}
bool SD_ForEachLine(const char* path, SD_LineCallback cb, void* user) {
if (path == nullptr || cb == nullptr) return false;
beginSDOperation();
if (!SD.exists(path)) {
endSDOperation();
return true;
}
File f = SD.open(path, FILE_READ);
if (!f) {
endSDOperation();
return false;
}
char buf[80];
while (f.available()) {
int n = f.readBytesUntil('\n', buf, (int)sizeof(buf) - 1);
if (n < 0) n = 0;
buf[n] = '\0';
while (n > 0 && (buf[n - 1] == '\r' || buf[n - 1] == ' ')) {
buf[--n] = '\0';
}
if (n > 0) cb(buf, user);
}
f.close();
endSDOperation();
return true;
}