mirror of
https://github.com/SpacehuhnTech/esp8266_deauther.git
synced 2025-12-23 23:20:00 +01:00
implemented sendAPResults by AP id
This commit is contained in:
@@ -140,6 +140,28 @@ String APScan::getResults(){
|
||||
return json;
|
||||
}
|
||||
|
||||
String APScan::getResult(int i){
|
||||
if(debug) Serial.print("getting AP scan result JSON for ID " + String(i));
|
||||
String json = "{ \"aps\":[ ";
|
||||
if(debug) Serial.print(".");
|
||||
json += "{";
|
||||
json += "\"i\":"+(String)i+",";
|
||||
json += "\"c\":"+(String)getAPChannel(i)+",";
|
||||
json += "\"m\":\""+getAPMac(i)+"\",";
|
||||
json += "\"ss\":\""+getAPName(i)+"\",";
|
||||
json += "\"r\":"+(String)getAPRSSI(i)+",";
|
||||
json += "\"e\":"+(String)encryption[i]+",";
|
||||
//json += "\"v\":\""+getAPVendor(i)+"\",";
|
||||
json += "\"se\":"+(String)getAPSelected(i);
|
||||
json += "}";
|
||||
json += "] }";
|
||||
if(debug){
|
||||
Serial.println(json);
|
||||
Serial.println("done");
|
||||
}
|
||||
return json;
|
||||
}
|
||||
|
||||
void APScan::select(int num){
|
||||
if(debug) Serial.println("seect "+(String)num+" - "+!selected[num]);
|
||||
if(selected[num]){
|
||||
@@ -153,4 +175,4 @@ void APScan::select(int num){
|
||||
|
||||
bool APScan::isSelected(int num){
|
||||
return selected[num];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,6 +19,7 @@ class APScan{
|
||||
|
||||
bool start();
|
||||
String getResults();
|
||||
String getResult(int i);
|
||||
void select(int num);
|
||||
|
||||
String getAPName(int num);
|
||||
@@ -48,4 +49,4 @@ class APScan{
|
||||
bool selected[maxAPScanResults];
|
||||
};
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -136,7 +136,14 @@ void startAPScan(){
|
||||
}
|
||||
}
|
||||
|
||||
void sendAPResults(){ server.send ( 200, "text/json", apScan.getResults()); }
|
||||
void sendAPResults(){
|
||||
if(server.hasArg("apid")) {
|
||||
int apid = server.arg("apid").toInt();
|
||||
server.send ( 200, "text/json", apScan.getResult(apid));
|
||||
} else {
|
||||
server.send ( 200, "text/json", apScan.getResults());
|
||||
}
|
||||
}
|
||||
|
||||
void selectAP(){
|
||||
if(server.hasArg("num")) {
|
||||
@@ -273,4 +280,4 @@ void editClientName(){
|
||||
server.send( 200, "text/json", "true");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user