mirror of
https://github.com/SpacehuhnTech/esp8266_deauther.git
synced 2025-12-23 15:38:18 -08:00
Add select / deselect all functionality
Add select / deselect all functionality for appscan and client scan Pass -1 to the "select" methods to pick all the results. Pass any other negative number (in the range of a signed int) to deselect all. + Added "select all" and "deselect all" buttons to apscan.html and stations.html
This commit is contained in:
@@ -135,7 +135,7 @@ int APScan::getFirstTarget() {
|
|||||||
void APScan::sendResults() {
|
void APScan::sendResults() {
|
||||||
if (debug) Serial.print("sending AP scan result JSON ");
|
if (debug) Serial.print("sending AP scan result JSON ");
|
||||||
|
|
||||||
size_t _size = 10; // {"aps":[]}
|
size_t _size = 25; // {"aps":[ ... ],"multiAPs":"1"}
|
||||||
for (int i = 0; i < results && i < maxAPScanResults; i++) {
|
for (int i = 0; i < results && i < maxAPScanResults; i++) {
|
||||||
/*
|
/*
|
||||||
_size++; // {
|
_size++; // {
|
||||||
@@ -185,7 +185,12 @@ void APScan::sendResults() {
|
|||||||
sendToBuffer(json);
|
sendToBuffer(json);
|
||||||
|
|
||||||
}
|
}
|
||||||
json = "]}";
|
|
||||||
|
json = "],\"multiAPs\":\"";
|
||||||
|
if(settings.multiAPs) json += "1";
|
||||||
|
else json += "0";
|
||||||
|
json += "\"}";
|
||||||
|
|
||||||
sendToBuffer(json);
|
sendToBuffer(json);
|
||||||
sendBuffer();
|
sendBuffer();
|
||||||
|
|
||||||
@@ -263,14 +268,27 @@ void APScan::sort() {
|
|||||||
|
|
||||||
void APScan::select(int num) {
|
void APScan::select(int num) {
|
||||||
if (debug) Serial.println("select " + (String)num + " - " + !selected[num]);
|
if (debug) Serial.println("select " + (String)num + " - " + !selected[num]);
|
||||||
if(!settings.multiAPs){
|
if(num < 0) {
|
||||||
|
if (num == -1){
|
||||||
|
if (settings.multiAPs) {
|
||||||
|
selectedSum = results;
|
||||||
|
for (int i = 0; i < results; i++) selected[i] = true;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
selectedSum = 0;
|
||||||
|
for (int i = 0; i < maxAPScanResults; i++) selected[i] = false;
|
||||||
|
}
|
||||||
|
} else if(!settings.multiAPs) {
|
||||||
for (int i = 0; i < maxAPScanResults; i++){
|
for (int i = 0; i < maxAPScanResults; i++){
|
||||||
if(i != num) selected[i] = false;
|
if(i != num) selected[i] = false;
|
||||||
|
selected[num] = !selected[num];
|
||||||
|
selectedSum = 1;
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
selected[num] = !selected[num];
|
||||||
|
if (selected[num]) selectedSum--;
|
||||||
|
else selectedSum++;
|
||||||
}
|
}
|
||||||
selected[num] = !selected[num];
|
|
||||||
if (selected[num]) selectedSum--;
|
|
||||||
else selectedSum++;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool APScan::isSelected(int num) {
|
bool APScan::isSelected(int num) {
|
||||||
|
|||||||
@@ -145,9 +145,19 @@ int ClientScan::getFirstClient() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void ClientScan::select(int num) {
|
void ClientScan::select(int num) {
|
||||||
selected[num] = !selected[num];
|
if(num < 0){
|
||||||
if (selected[num]) selectedResults++;
|
if(num == -1){
|
||||||
else selectedResults--;
|
for(int i=0; i<results; i++){selected[i] = true;}
|
||||||
|
selectedResults = results;
|
||||||
|
} else {
|
||||||
|
for(int i=0; i<results; i++){selected[i] = false;}
|
||||||
|
selectedResults = 0;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
selected[num] = !selected[num];
|
||||||
|
if (selected[num]) selectedResults++;
|
||||||
|
else selectedResults--;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t ClientScan::getSize(){
|
size_t ClientScan::getSize(){
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@@ -33,8 +33,13 @@ function getResults() {
|
|||||||
apMAC.innerHTML = "";
|
apMAC.innerHTML = "";
|
||||||
|
|
||||||
var tr = '';
|
var tr = '';
|
||||||
if (res.aps.length > 0) tr += '<tr><th>Ch</th><th>SSID</th><th>RSSI</th><th>Encrypt.</th><th>Select</th></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> | <button class="marginNull button-primary" onclick="select(-2)">deselect</button> all</th></tr>';
|
||||||
|
else tr += '<th>Select</th></tr>'
|
||||||
|
}
|
||||||
|
|
||||||
for (var i = 0; i < res.aps.length; i++) {
|
for (var i = 0; i < res.aps.length; i++) {
|
||||||
|
|
||||||
if (res.aps[i].se == 1) tr += '<tr class="selected">';
|
if (res.aps[i].se == 1) tr += '<tr class="selected">';
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ function getResults() {
|
|||||||
clientsFound.innerHTML = res.clients.length;
|
clientsFound.innerHTML = res.clients.length;
|
||||||
|
|
||||||
var tr = '';
|
var tr = '';
|
||||||
if (res.clients.length > 0) tr += '<tr><th>Pkts</th><th>Vendor</th><th>Name</th><th>MAC</th><th>AP</th><th>Select</th></tr>';
|
if (res.clients.length > 0) tr += '<tr><th>Pkts</th><th>Vendor</th><th>Name</th><th>MAC</th><th>AP</th><th><button class="marginNull button-primary" onclick="select(-1)">select</button> | <button class="marginNull button-primary" onclick="select(-2)">deselect</button> all</th></tr>';
|
||||||
|
|
||||||
for (var i = 0; i < res.clients.length; i++) {
|
for (var i = 0; i < res.clients.length; i++) {
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user