Fixed APScan select bug + Attack status bug

- fixed: APScan select wasn't working when Multiple AP selection was disbaled.
- fixed: Attack stati wasn't shown
- improved: design of select,deselect all buttons
This commit is contained in:
Stefan Kremser
2017-05-15 19:36:44 +02:00
parent 98deeb503b
commit 3128dbe83f
5 changed files with 23 additions and 15 deletions

View File

@@ -226,7 +226,8 @@ String APScan::getResultsJSON() {
void APScan::sort() {
if (debug) Serial.println("sorting APs ");
//bubble sort
/* I know, it's bubble sort... but it works and that's the main thing! ;) (feel free to improve it tho) */
for (int i = 0; i < results - 1; i++) {
Serial.println("--------------");
for (int h = 0; h < results - i - 1; h++) {
@@ -269,8 +270,8 @@ void APScan::sort() {
void APScan::select(int num) {
if (debug) Serial.println("select " + (String)num + " - " + !selected[num]);
if(num < 0) {
if (num == -1){
if (settings.multiAPs) {
if(num == -1){
if(settings.multiAPs) {
selectedSum = results;
for (int i = 0; i < results; i++) selected[i] = true;
}
@@ -281,13 +282,13 @@ void APScan::select(int num) {
} else if(!settings.multiAPs) {
for (int i = 0; i < maxAPScanResults; i++){
if(i != num) selected[i] = false;
selected[num] = !selected[num];
selectedSum = 1;
else selected[num] = !selected[num];
}
selectedSum = 1;
} else {
selected[num] = !selected[num];
if (selected[num]) selectedSum--;
if(selected[num]) selectedSum--;
else selectedSum++;
selected[num] = !selected[num];
}
}

View File

@@ -255,14 +255,14 @@ void Attack::start(int num) {
}
void Attack::stop(int num) {
if (isRunning[num]) {
if(isRunning[num]) {
if (debug) Serial.println("stopping " + (String)attackNames[num] + " attack...");
if (num == 0) attackMode = "START";
isRunning[num] = false;
stati[num] = "ready";
prevTime[num] = millis();
refreshLed();
}
stati[num] = "ready";
}
void Attack::stopAll() {

File diff suppressed because one or more lines are too long

View File

@@ -31,6 +31,11 @@
<span id="networksFound">0</span>
<br />
MAC: <span id="apMAC"></span>
<span id="selectAllBtns">
<br />
<button class="marginNull button-primary left" onclick="select(-2)">deselect all</button>
<button class="marginNull button-primary right" onclick="select(-1)">select all</button>
</span>
</p>
<br />

View File

@@ -3,6 +3,7 @@ var networkInfo = getE('networksFound');
var scanInfo = getE('scanInfo');
var apMAC = getE('apMAC');
var startStopScan = getE('startStopScan');
var selectAllBtns = getE('selectAllBtns');
var autoScan = false;
function toggleScan(onoff) {
@@ -32,12 +33,13 @@ function getResults() {
networkInfo.innerHTML = res.aps.length;
apMAC.innerHTML = "";
if (res.multiAPs == 1) selectAllBtns.style.visibility = 'visible';
else selectAllBtns.style.visibility = 'hidden';
var tr = '';
if (res.aps.length > 0) {
tr += '<tr><th>Ch</th><th>SSID</th><th>RSSI</th><th>Encrypt.</th>';
if (res.multiAPs == 1) tr += '<th><button class="marginNull button-primary" onclick="select(-1)">select</button>&nbsp|&nbsp<button class="marginNull button-primary" onclick="select(-2)">deselect</button>&nbspall</th></tr>';
else tr += '<th>Select</th></tr>'
tr += '<th>Select</th></tr>'
}
for (var i = 0; i < res.aps.length; i++) {