Skip to content

Commit 177e08c

Browse files
author
Stefan Kremser
committed
Added LedPin Setting to HTML
1 parent eda0036 commit 177e08c

File tree

5 files changed

+49
-38
lines changed

5 files changed

+49
-38
lines changed

esp8266_deauther/Settings.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,8 @@ void Settings::send() {
185185
json += "\"multiAPs\":" + (String)multiAPs + ",";
186186
json += "\"multiAttacks\":" + (String)multiAttacks + ",";
187187
json += "\"macInterval\":" + (String)macInterval + ",";
188-
json += "\"beaconInterval\":" + (String)beaconInterval + "}";
188+
json += "\"beaconInterval\":" + (String)beaconInterval + ",";
189+
json += "\"ledPin\":" + (String)ledPin + "}";
189190
sendToBuffer(json);
190191
sendBuffer();
191192

esp8266_deauther/data.h

Lines changed: 6 additions & 9 deletions
Large diffs are not rendered by default.

esp8266_deauther/esp8266_deauther.ino

Lines changed: 24 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,6 @@
3131
#define selectBtn 14 //GPIO 14 = D5
3232
#define displayBtn 0 //GPIO 0 = FLASH BUTTON
3333

34-
#define buttonDelay 180 //delay in ms
35-
3634
//render settings
3735
#define fontSize 8
3836
#define rowsPerSite 8
@@ -425,7 +423,8 @@ void saveSettings() {
425423
if (server.arg("multiAttacks") == "false") settings.multiAttacks = false;
426424
else settings.multiAttacks = true;
427425
}
428-
426+
427+
if (server.hasArg("ledPin")) settings.ledPin = server.arg("ledPin").toInt();
429428
if(server.hasArg("macInterval")) settings.macInterval = server.arg("macInterval").toInt();
430429

431430
settings.save();
@@ -440,25 +439,13 @@ void resetSettings() {
440439
void setup() {
441440

442441
Serial.begin(115200);
442+
443443
if(debug){
444444
delay(2000);
445445
Serial.println("\nStarting...\n");
446446
}
447-
448-
#ifdef USE_DISPLAY
449-
display.init();
450-
display.setFont(Roboto_Mono_8);
451-
display.flipScreenVertically();
452-
drawInterface();
453-
pinMode(upBtn, INPUT_PULLUP);
454-
pinMode(downBtn, INPUT_PULLUP);
455-
pinMode(selectBtn, INPUT_PULLUP);
456-
pinMode(displayBtn, INPUT_PULLUP);
457-
#endif
458447

459448
attackMode = "START";
460-
pinMode(settings.ledPin, OUTPUT);
461-
digitalWrite(settings.ledPin, HIGH);
462449

463450
EEPROM.begin(4096);
464451
SPIFFS.begin();
@@ -468,11 +455,6 @@ void setup() {
468455
nameList.load();
469456
ssidList.load();
470457

471-
#ifdef resetPin
472-
pinMode(resetPin, INPUT_PULLUP);
473-
if(digitalRead(resetPin) == LOW) settings.reset();
474-
#endif
475-
476458
startWifi();
477459
attack.stopAll();
478460
attack.generate();
@@ -530,6 +512,26 @@ void setup() {
530512
server.on("/enableRandom.json",enableRandom);
531513

532514
server.begin();
515+
516+
#ifdef USE_DISPLAY
517+
display.init();
518+
display.setFont(Roboto_Mono_8);
519+
display.flipScreenVertically();
520+
pinMode(upBtn, INPUT_PULLUP);
521+
pinMode(downBtn, INPUT_PULLUP);
522+
pinMode(selectBtn, INPUT_PULLUP);
523+
if(displayBtn == 0) pinMode(displayBtn, INPUT);
524+
else pinMode(displayBtn, INPUT_PULLUP);
525+
#endif
526+
527+
#ifdef resetPin
528+
pinMode(resetPin, INPUT_PULLUP);
529+
if(digitalRead(resetPin) == LOW) settings.reset();
530+
#endif
531+
532+
pinMode(settings.ledPin, OUTPUT);
533+
digitalWrite(settings.ledPin, HIGH);
534+
533535
}
534536

535537
void loop() {
@@ -600,11 +602,11 @@ void loop() {
600602
apScan.select(curRow - 3);
601603
}
602604
}
605+
// ===== DISPLAY =====
603606
else if (buttonPressed == 3) {
604607
displayOn = !displayOn;
605608
display.clear();
606609
display.display();
607-
Serial.println("BUTTON PRESSED!");
608610
}
609611
}
610612
drawInterface();

web_server/html/js/settings.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ var cMac = getE('cMac');
1818
var cName = getE('cName');
1919
var macInterval = getE('macInterval');
2020
var beaconInterval = getE('beaconInterval');
21+
var ledPin = getE('ledPin');
2122
var res;
2223

2324
function getData() {
@@ -44,6 +45,7 @@ function getData() {
4445
multiAttacks.checked = res.multiAttacks;
4546
macInterval.value = res.macInterval;
4647
beaconInterval.checked = res.beaconInterval;
48+
ledPin.value = res.ledPin;
4749
});
4850
}
4951

@@ -66,6 +68,7 @@ function saveSettings() {
6668
url += "&multiAttacks="+multiAttacks.checked;
6769
url += "&macInterval="+macInterval.value;
6870
url += "&beaconInterval="+beaconInterval.checked;
71+
url += "&ledPin="+ledPin.value;
6972

7073
getResponse(url, function(responseText) {
7174
if (responseText == "true") {

web_server/html/settings.html

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -113,26 +113,34 @@ <h2>Attack</h2>
113113
</div>
114114
<div class="row">
115115
<div class="col-6">
116-
<label for="ssidEnc">WPA2 Beacons</label>
116+
<label for="useLed">Use LED</label>
117117
</div>
118118
<div class="col-6">
119-
<input type="checkbox" id="ssidEnc" value="false">
119+
<input type="checkbox" id="useLed" value="false">
120120
</div>
121121
</div>
122122
<div class="row">
123123
<div class="col-6">
124-
<label for="beaconInterval">1s Beacon Interval (default: 100ms)</label>
124+
<label for="ledPin">LED Pin (restart needed)</label>
125125
</div>
126126
<div class="col-6">
127-
<input type="checkbox" id="beaconInterval" value="false">
127+
<input type="number" id="ledPin" min="0" max="18">
128128
</div>
129129
</div>
130130
<div class="row">
131131
<div class="col-6">
132-
<label for="useLed">Use LED</label>
132+
<label for="ssidEnc">WPA2 Beacons</label>
133133
</div>
134134
<div class="col-6">
135-
<input type="checkbox" id="useLed" value="false">
135+
<input type="checkbox" id="ssidEnc" value="false">
136+
</div>
137+
</div>
138+
<div class="row">
139+
<div class="col-6">
140+
<label for="beaconInterval">1s Beacon Interval (default: 100ms)</label>
141+
</div>
142+
<div class="col-6">
143+
<input type="checkbox" id="beaconInterval" value="false">
136144
</div>
137145
</div>
138146
<div class="row">

0 commit comments

Comments
 (0)