Added LedPin Setting to HTML

This commit is contained in:
Stefan Kremser
2017-05-31 12:14:25 +02:00
parent eda0036d23
commit 177e08c8dc
5 changed files with 51 additions and 40 deletions

View File

@@ -185,7 +185,8 @@ void Settings::send() {
json += "\"multiAPs\":" + (String)multiAPs + ",";
json += "\"multiAttacks\":" + (String)multiAttacks + ",";
json += "\"macInterval\":" + (String)macInterval + ",";
json += "\"beaconInterval\":" + (String)beaconInterval + "}";
json += "\"beaconInterval\":" + (String)beaconInterval + ",";
json += "\"ledPin\":" + (String)ledPin + "}";
sendToBuffer(json);
sendBuffer();

File diff suppressed because one or more lines are too long

View File

@@ -31,8 +31,6 @@
#define selectBtn 14 //GPIO 14 = D5
#define displayBtn 0 //GPIO 0 = FLASH BUTTON
#define buttonDelay 180 //delay in ms
//render settings
#define fontSize 8
#define rowsPerSite 8
@@ -426,6 +424,7 @@ void saveSettings() {
else settings.multiAttacks = true;
}
if (server.hasArg("ledPin")) settings.ledPin = server.arg("ledPin").toInt();
if(server.hasArg("macInterval")) settings.macInterval = server.arg("macInterval").toInt();
settings.save();
@@ -440,25 +439,13 @@ void resetSettings() {
void setup() {
Serial.begin(115200);
if(debug){
delay(2000);
Serial.println("\nStarting...\n");
}
#ifdef USE_DISPLAY
display.init();
display.setFont(Roboto_Mono_8);
display.flipScreenVertically();
drawInterface();
pinMode(upBtn, INPUT_PULLUP);
pinMode(downBtn, INPUT_PULLUP);
pinMode(selectBtn, INPUT_PULLUP);
pinMode(displayBtn, INPUT_PULLUP);
#endif
attackMode = "START";
pinMode(settings.ledPin, OUTPUT);
digitalWrite(settings.ledPin, HIGH);
EEPROM.begin(4096);
SPIFFS.begin();
@@ -468,11 +455,6 @@ void setup() {
nameList.load();
ssidList.load();
#ifdef resetPin
pinMode(resetPin, INPUT_PULLUP);
if(digitalRead(resetPin) == LOW) settings.reset();
#endif
startWifi();
attack.stopAll();
attack.generate();
@@ -530,6 +512,26 @@ void setup() {
server.on("/enableRandom.json",enableRandom);
server.begin();
#ifdef USE_DISPLAY
display.init();
display.setFont(Roboto_Mono_8);
display.flipScreenVertically();
pinMode(upBtn, INPUT_PULLUP);
pinMode(downBtn, INPUT_PULLUP);
pinMode(selectBtn, INPUT_PULLUP);
if(displayBtn == 0) pinMode(displayBtn, INPUT);
else pinMode(displayBtn, INPUT_PULLUP);
#endif
#ifdef resetPin
pinMode(resetPin, INPUT_PULLUP);
if(digitalRead(resetPin) == LOW) settings.reset();
#endif
pinMode(settings.ledPin, OUTPUT);
digitalWrite(settings.ledPin, HIGH);
}
void loop() {
@@ -600,11 +602,11 @@ void loop() {
apScan.select(curRow - 3);
}
}
// ===== DISPLAY =====
else if (buttonPressed == 3) {
displayOn = !displayOn;
display.clear();
display.display();
Serial.println("BUTTON PRESSED!");
}
}
drawInterface();

View File

@@ -18,6 +18,7 @@ var cMac = getE('cMac');
var cName = getE('cName');
var macInterval = getE('macInterval');
var beaconInterval = getE('beaconInterval');
var ledPin = getE('ledPin');
var res;
function getData() {
@@ -44,6 +45,7 @@ function getData() {
multiAttacks.checked = res.multiAttacks;
macInterval.value = res.macInterval;
beaconInterval.checked = res.beaconInterval;
ledPin.value = res.ledPin;
});
}
@@ -66,6 +68,7 @@ function saveSettings() {
url += "&multiAttacks="+multiAttacks.checked;
url += "&macInterval="+macInterval.value;
url += "&beaconInterval="+beaconInterval.checked;
url += "&ledPin="+ledPin.value;
getResponse(url, function(responseText) {
if (responseText == "true") {

View File

@@ -111,6 +111,22 @@
<input type="number" id="timeout" min="-1" max="65536"> s
</div>
</div>
<div class="row">
<div class="col-6">
<label for="useLed">Use LED</label>
</div>
<div class="col-6">
<input type="checkbox" id="useLed" value="false">
</div>
</div>
<div class="row">
<div class="col-6">
<label for="ledPin">LED Pin (restart needed)</label>
</div>
<div class="col-6">
<input type="number" id="ledPin" min="0" max="18">
</div>
</div>
<div class="row">
<div class="col-6">
<label for="ssidEnc">WPA2 Beacons</label>
@@ -127,14 +143,6 @@
<input type="checkbox" id="beaconInterval" value="false">
</div>
</div>
<div class="row">
<div class="col-6">
<label for="useLed">Use LED</label>
</div>
<div class="col-6">
<input type="checkbox" id="useLed" value="false">
</div>
</div>
<div class="row">
<div class="col-6">
<label for="deauthReason">Deauth Reason-Code</label>