Skip to content

Commit d6592d9

Browse files
authored
Merge pull request #12 from LyndLabs/C3-231216
Support Cutie Wardriver (ESP32-C3) + Update Icons
2 parents 629b93c + 99c2992 commit d6592d9

File tree

13 files changed

+871
-216
lines changed

13 files changed

+871
-216
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
.vscode
1+
.vscode/*

.vscode/arduino.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
2-
"configuration": "xtal=80,vt=flash,exception=disabled,stacksmash=disabled,ssl=all,mmu=3232,non32xfer=fast,FlashMode=dout,FlashFreq=40,eesz=4M2M,ip=lm2f,dbg=Disabled,lvl=None____,wipe=none,baud=921600",
3-
"board": "esp8266:esp8266:d1_mini_clone",
2+
"board": "esp32:esp32:XIAO_ESP32C3",
3+
"port": "/dev/ttyACM0",
44
"sketch": "src/Wardriver/Wardriver.ino",
5-
"port": "/dev/ttyUSB0"
5+
"configuration": "CDCOnBoot=default,PartitionScheme=default,CPUFreq=160,FlashMode=dio,FlashFreq=80,FlashSize=4M,UploadSpeed=921600,DebugLevel=none"
66
}

.vscode/c_cpp_properties.json

Lines changed: 586 additions & 40 deletions
Large diffs are not rendered by default.

README.md

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
1-
# Wardriver
2-
Basic wardriving for the ESP8266, compatible with WiGLE. Docs coming soon.
1+
# ESP8266 / ESP32 Wardriver Firmware
2+
Basic Wardriving for Espressif! Compatible with [DevKitty](https://devkitty.io) and [Cutie Wardriver](https://lyndlabs.io) kits by LyndLabs. More info + docs coming soon!
33

4-
## V1.1 Changelog
5-
- [ ] Multithreading
6-
- [ ] ESP32 Support
7-
- [ ] Internal Logging (ESP32-S2)
8-
- [ ] Web UI
4+
## Components
5+
- ESP8266 / ESP32
6+
- SH1106 OLED

img/icons.xbm

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
#define icons_wardriving_width 128
2-
#define icons_wardriving_height 64
3-
static unsigned char icons_wardriving_bits[] = {
1+
#define icons_width 128
2+
#define icons_height 64
3+
static unsigned char icons_bits[] = {
44
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
55
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
66
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
@@ -27,15 +27,15 @@ static unsigned char icons_wardriving_bits[] = {
2727
0x00, 0xc0, 0x7f, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x00, 0x00, 0x00, 0x00,
2828
0x5e, 0xf4, 0x00, 0x00, 0x00, 0xc0, 0x60, 0x00, 0x00, 0x00, 0x00, 0x82,
2929
0x00, 0x00, 0x00, 0x00, 0x21, 0x08, 0x01, 0x00, 0x00, 0xc0, 0x00, 0x00,
30-
0x00, 0x00, 0x00, 0x82, 0x00, 0x00, 0x00, 0x00, 0x5e, 0xf4, 0x00, 0x00,
30+
0x00, 0x00, 0x00, 0xba, 0x00, 0x00, 0x00, 0x00, 0x5e, 0xf4, 0x00, 0x00,
3131
0x00, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x82, 0x00, 0x00, 0x00, 0x00,
32-
0x40, 0x04, 0x00, 0x00, 0x00, 0xe0, 0xff, 0x00, 0x00, 0x00, 0x00, 0x82,
32+
0x40, 0x04, 0x00, 0x00, 0x00, 0xe0, 0xff, 0x00, 0x00, 0x00, 0x00, 0xba,
3333
0x00, 0x00, 0x00, 0x00, 0x40, 0x04, 0x00, 0x00, 0x00, 0xe0, 0xff, 0x00,
3434
0x00, 0x00, 0x00, 0x82, 0x00, 0x00, 0x00, 0x00, 0x80, 0x03, 0x00, 0x00,
35-
0x00, 0xe0, 0xf1, 0x00, 0x00, 0x00, 0x00, 0x82, 0x00, 0x00, 0x00, 0x00,
35+
0x00, 0xe0, 0xf1, 0x00, 0x00, 0x00, 0x00, 0xba, 0x00, 0x00, 0x00, 0x00,
3636
0x40, 0x05, 0x00, 0x00, 0x00, 0xe0, 0xf1, 0x00, 0x00, 0x00, 0x00, 0x82,
3737
0x00, 0x00, 0x00, 0x00, 0xc0, 0x07, 0x00, 0x00, 0x00, 0xe0, 0xfb, 0x00,
38-
0x00, 0x00, 0x00, 0x82, 0x00, 0x00, 0x00, 0x00, 0x20, 0x09, 0x00, 0x00,
38+
0x00, 0x00, 0x00, 0xba, 0x00, 0x00, 0x00, 0x00, 0x20, 0x09, 0x00, 0x00,
3939
0x00, 0xe0, 0xfb, 0x00, 0x00, 0x00, 0x00, 0x82, 0x00, 0x00, 0x00, 0x00,
4040
0x00, 0x01, 0x00, 0x00, 0x00, 0xc0, 0x7f, 0x00, 0x00, 0x00, 0x00, 0xfe,
4141
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
@@ -46,22 +46,22 @@ static unsigned char icons_wardriving_bits[] = {
4646
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
4747
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
4848
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
49-
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0x00,
49+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0e, 0x00,
5050
0x00, 0x00, 0x00, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
51-
0x00, 0x80, 0x40, 0x00, 0x00, 0x00, 0x00, 0x02, 0x02, 0x00, 0x00, 0x00,
52-
0xe0, 0x1f, 0x00, 0x00, 0x00, 0x80, 0x40, 0x00, 0x00, 0x00, 0x00, 0x03,
53-
0x01, 0x00, 0x00, 0x00, 0xf0, 0x3f, 0x00, 0x00, 0x00, 0x80, 0x40, 0x00,
51+
0x00, 0x00, 0x11, 0x00, 0x00, 0x00, 0x00, 0x02, 0x02, 0x00, 0x00, 0x00,
52+
0xe0, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x19, 0x00, 0x00, 0x00, 0x00, 0x03,
53+
0x01, 0x00, 0x00, 0x00, 0xf0, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x11, 0x00,
5454
0x00, 0x00, 0x80, 0x80, 0x00, 0x00, 0x00, 0x00, 0x18, 0x60, 0x00, 0x00,
55-
0x00, 0x80, 0x40, 0x00, 0x00, 0x00, 0x80, 0x40, 0x00, 0x00, 0x00, 0x00,
56-
0x08, 0x40, 0x00, 0x00, 0x00, 0x80, 0x40, 0x00, 0x00, 0x00, 0x80, 0x30,
57-
0x04, 0x00, 0x00, 0x00, 0xc0, 0x0f, 0x00, 0x00, 0x00, 0x80, 0x40, 0x00,
55+
0x00, 0x00, 0x19, 0x00, 0x00, 0x00, 0x80, 0x40, 0x00, 0x00, 0x00, 0x00,
56+
0x08, 0x40, 0x00, 0x00, 0x00, 0x00, 0x11, 0x00, 0x00, 0x00, 0x80, 0x30,
57+
0x04, 0x00, 0x00, 0x00, 0xc0, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x19, 0x00,
5858
0x00, 0x00, 0x80, 0x30, 0x04, 0x00, 0x00, 0x00, 0x60, 0x18, 0x00, 0x00,
59-
0x00, 0x80, 0x40, 0x00, 0x00, 0x00, 0x80, 0x00, 0x04, 0x00, 0x00, 0x00,
60-
0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x40, 0x00, 0x00, 0x00, 0x80, 0x00,
61-
0x04, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x80, 0x4c, 0x00,
59+
0x00, 0x00, 0x11, 0x00, 0x00, 0x00, 0x80, 0x00, 0x04, 0x00, 0x00, 0x00,
60+
0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x20, 0x00, 0x00, 0x00, 0x80, 0x00,
61+
0x04, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x80, 0x30, 0x00,
6262
0x00, 0x00, 0x00, 0x03, 0x03, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00,
63-
0x00, 0x80, 0x40, 0x00, 0x00, 0x00, 0x00, 0x02, 0x01, 0x00, 0x00, 0x00,
64-
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0x00, 0x00, 0x00, 0x00, 0xfc,
63+
0x00, 0x80, 0x20, 0x00, 0x00, 0x00, 0x00, 0x02, 0x01, 0x00, 0x00, 0x00,
64+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x00, 0x00, 0x00, 0x00, 0xfc,
6565
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
6666
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
6767
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,

src/Wardriver/Vars.h

Lines changed: 32 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,60 @@
11
#pragma once
22
#include "Arduino.h"
3-
#include <HardwareSerial.h>
43

5-
#define VERSION 1.2
6-
#define VERSION_STR "v1.2"
4+
// SET BOARD BEFORE COMPILING
5+
#define QT_WARDRIVER
6+
7+
#define VERSION 1.4
8+
#define VERSION_STR "v1.4"
79
#define WIGLE_HEADER "MAC,SSID,AuthMode,FirstSeen,Channel,RSSI,CurrentLatitude,CurrentLongitude,AltitudeMeters,AccuracyMeters,Type"
810

9-
#define SERIAL_BAUD 1152007
11+
#define SERIAL_BAUD 115200
1012
#define GPS_BAUD 9600
1113
#define TIMEZONE_UTC -7
1214
#define SCAN_INTERVAL 500
1315

1416
/* Pin Definitions */
15-
#define SD_CS D8
1617

17-
#if defined(ESP8266)
18+
#if CONFIG_IDF_TARGET_ESP8266
19+
#warning "Compiling for ESP8266"
1820
#define GPS_RX D4
1921
#define GPS_TX D3
2022
#define SERIAL_VAR ss
2123

2224
#define FS_VAR SD
23-
#elif defined(ESP32)
24-
#define SDA 33
25-
#define SCL 35
25+
#elif CONFIG_IDF_TARGET_ESP32C3
26+
#define SDA SDA
27+
#define SCL SCL
2628

2729
#define SERIAL_VAR Serial1
28-
#define GPS_RX 3 // AO
29-
#define GPS_TX 16 // D4
30+
#define GPS_RX 20
31+
#define GPS_TX 21
3032

31-
#define FS_VAR FFat
33+
#define FS_VAR SD
34+
#define SD_CS 0 // this pin is not actually used for selecting
35+
#elif CONFIG_IDF_TARGET_ESP32S2
36+
#warning "Compiling for ESP32-S2"
37+
#elif CONFIG_IDF_TARGET_ESP32S3
38+
#warning "Compiling for ESP32-S3"
39+
#elif CONFIG_IDF_TARGET_ESP32
40+
#warning "Compiling for ESP32"
41+
#else
42+
#error "Unrecognized ESP."
3243
#endif
3344

34-
35-
#if defined(ESP8266)
45+
#if defined(DNS_DRIVEBY)
3646
#define LOG_PREFIX "DNS_Driveby"
3747
#define DEVICE "DNS Driveby"
3848
#define MODEL "Developer Kit"
3949
#define BOARD "ESP8266"
40-
41-
#elif defined(ESP32)
50+
51+
#elif defined(bruh)
52+
#define LOG_PREFIX "QT-Py"
53+
#define DEVICE "QT-Py_Wardriver"
54+
#define MODEL "QT-Py_Wardriver"
55+
#define BOARD "ESP32-C3"
56+
57+
#elif defined(QT_WARDRIVER)
4258
#define LOG_PREFIX "Nugget"
4359
#define DEVICE "Nugget"
4460
#define MODEL "DevKitty"

src/Wardriver/Wardriver.ino

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,13 @@
33

44
void setup() {
55
Serial.begin(115200);
6-
pinMode(A0, INPUT);
7-
ESP.wdtDisable();
6+
Serial.println();
7+
// pinMode(A0, INPUT);
8+
9+
// ESP.wdtDisable();
810

911
Wardriver::init();
10-
ESP.wdtEnable(0);
12+
// ESP.wdtEnable(0);
1113
}
1214

1315
void loop() {

src/Wardriver/src/Filesys.cpp

Lines changed: 13 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -7,88 +7,29 @@ unsigned long startInit;
77
unsigned long finishInit;
88

99
/* FatFS logging or SD Card*/
10-
#if defined(ESP8266)
11-
// #include <SD.h>
12-
#elif defined(ESP32)
13-
#include "FFat.h"
14-
#include "cdcusb.h"
15-
#include "mscusb.h"
16-
#include "flashdisk.h"
17-
#include "FS.h"
18-
19-
FlashUSB fat1;
20-
CDCusb CDCUSBSerial;
21-
char *l1 = "ffat";
22-
23-
class Device: public USBCallbacks {
24-
void onMount() {
25-
Serial.println("Mount");
26-
finishInit = millis();
27-
}
28-
void onUnmount() { Serial.println("Unmount"); }
29-
void onSuspend(bool remote_wakeup_en) { Serial.println("Suspend"); }
30-
void onResume() { Serial.println("Resume"); }
31-
};
32-
33-
void echo_all(char c) {
34-
CDCUSBSerial.write(c);
35-
Serial.write(c);
36-
}
37-
#endif
38-
10+
#include <SD.h>
3911

40-
char fullFilename[30];
12+
char fullFilename[100];
4113
File file;
4214

4315
Filesys::Filesys() {
4416

4517
}
4618

47-
void Filesys::init(Filesys::ScreenUpdateCallback callback) {
48-
49-
#if defined (ESP8266)
19+
void Filesys::init(ScreenUpdateCallback callback) {
5020
bool sdSuccess = SD.begin(SD_CS);
5121
if (!sdSuccess) {
5222
callback("SD Card: NOT FOUND");
5323

5424
while (!sdSuccess) {
5525
sdSuccess = SD.begin(SD_CS);
56-
ESP.wdtFeed();
26+
//ESP.wdtFeed();
27+
yield();
5728
}
5829
}
5930
callback("SD Card: FOUND!!");
6031

61-
#elif defined (ESP32)
62-
63-
EspTinyUSB::registerDeviceCallbacks(new Device());
64-
65-
callback("FS: Initializing...");
66-
startInit = millis();
67-
if (fat1.init("/fat1", "ffat")) {
68-
if (fat1.begin()) {
69-
Serial.println("MSC lun 1 begin");
70-
}
71-
else {
72-
log_e("LUN 1 failed");
73-
}
74-
}
75-
76-
if (!CDCUSBSerial.begin())
77-
Serial.println("Failed to start CDC USB stack");
78-
79-
callback("FS: Starting FAT...");
80-
while (!FFat.begin()) { delay(0); }
81-
while (!fat1.available()) { delay(0); }
82-
83-
delay(500);
84-
85-
char tmpMsg[30];
86-
sprintf(tmpMsg,"FS: Done in %d ms",(finishInit-startInit));
87-
callback(tmpMsg);
88-
89-
#endif
90-
91-
Filesys::configure();
32+
// Filesys::configure();
9233

9334
}
9435

@@ -113,22 +54,22 @@ void Filesys::configure() {
11354

11455

11556
/* INITLIALIZE LOG FILE & WRITE HEADERS*/
116-
void Filesys::createLog(char * filename, Filesys::ScreenUpdateCallback callback) {
57+
void Filesys::createLog(char *filename, ScreenUpdateCallback callback) {
11758

11859
uint8_t logNum = 0;
11960
char wiglePreHeader[140];
12061
sprintf(wiglePreHeader, "WigleWifi-1.4,appRelease=%f,model=%s,release=%F,device=%s,display=SH1106,board=%s,brand=LyndLabs",VERSION,MODEL,VERSION,DEVICE,BOARD);
121-
62+
12263
// CHECK IF FILE EXISTS
12364
while (true) {
12465
sprintf(fullFilename,"/%s_%s_%i.csv",LOG_PREFIX,filename,logNum);
12566
if (!FS_VAR.exists(fullFilename)) { break; }
126-
logNum++;
67+
logNum++; yield();
12768
}
12869

129-
char tmpMessage[40];
130-
sprintf(tmpMessage,"LOG: Created #%d",logNum);
131-
callback(tmpMessage);
70+
char tmpMessage[50];
71+
sprintf(tmpMessage,"Created: Log #%d",logNum);
72+
callback(fullFilename);
13273

13374
// create temporary file object
13475
File tmpFile = FS_VAR.open(fullFilename, FILE_WRITE);
@@ -140,9 +81,8 @@ void Filesys::createLog(char * filename, Filesys::ScreenUpdateCallback callback)
14081

14182
tmpFile.flush();
14283
#if defined(ESP32)
143-
fat1.flush();
84+
//fat1.flush();
14485
#endif
145-
// callback("LOG: WROTE HEADERS");
14686
}
14787

14888
void Filesys::open() {

0 commit comments

Comments
 (0)