Skip to content

Commit e0c35b6

Browse files
committed
Added the ability to view the AP of sniffed clients
1 parent dcdec41 commit e0c35b6

File tree

4 files changed

+16
-6
lines changed

4 files changed

+16
-6
lines changed

esp8266_deauther/ClientScan.cpp

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ bool ClientScan::stop(){
7676
}
7777

7878
void ClientScan::packetSniffer(uint8_t *buf, uint16_t len){
79+
int cliNbr;
7980
if(sniffing && len>27){
8081
from.set(buf[16],buf[17],buf[18],buf[19],buf[20],buf[21]);
8182
to.set(buf[22],buf[23],buf[24],buf[25],buf[26],buf[27]);
@@ -87,15 +88,19 @@ void ClientScan::packetSniffer(uint8_t *buf, uint16_t len){
8788
if(clientNum == -1 && results < maxClientScanResults){
8889
data_getVendor(to._get(0),to._get(1),to._get(2)).toCharArray(vendors[results],9);
8990
results++;
90-
packets[clients.add(to)]++;
91+
cliNbr = clients.add(to);
92+
packets[cliNbr]++;
93+
connectedToAp[cliNbr] = i;
9194
}else packets[clientNum]++;
92-
/*if(debug){
95+
/*
96+
if(debug){
9397
Serial.print("found: ");
9498
from._print();
9599
Serial.print(" => ");
96100
to._print();
97101
Serial.println("");
98-
}*/
102+
}
103+
*/
99104
}
100105
}
101106
}
@@ -107,6 +112,7 @@ String ClientScan::getClientName(int num){ return nameList.get(clients._get(num)
107112
int ClientScan::getClientPackets(int num){ return packets[clients.getNum(clients._get(num))]; }
108113
String ClientScan::getClientVendor(int num){ return vendors[num]; }
109114
Mac ClientScan::getClientMac(int num){ return clients._get(num); }
115+
int ClientScan::getClientConnectedAp(int num){ return connectedToAp[num]; }
110116
bool ClientScan::getClientSelected(int num){ return selected[num]; }
111117
int ClientScan::getFirstClient(){
112118
for(int i=0;i<maxClientScanResults;i++){
@@ -124,7 +130,8 @@ String ClientScan::getResults(){
124130
json += "\"m\":\""+getClientMac(i).toString()+"\",";
125131
json += "\"n\":\""+(String)nameList.get(getClientMac(i))+"\",";
126132
json += "\"v\":\""+(String)getClientVendor(i)+"\",";
127-
json += "\"s\":"+(String)getClientSelected(i);
133+
json += "\"s\":"+(String)getClientSelected(i)+",";
134+
json += "\"a\":\""+(String)apScan.getAPName(getClientConnectedAp(i))+"\"";
128135
json += "}";
129136
if((i!=results-1) && (i!=maxClientScanResults-1)) json += ",";
130137
}

esp8266_deauther/ClientScan.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ class ClientScan{
3737
String getClientVendor(int num);
3838
Mac getClientMac(int num);
3939
bool getClientSelected(int num);
40+
int getClientConnectedAp(int num);
4041
int getFirstClient();
4142

4243
int results = 0;
@@ -56,6 +57,7 @@ class ClientScan{
5657
char vendors[maxClientScanResults][9];
5758
int packets[maxClientScanResults];
5859
bool selected[maxClientScanResults];
60+
int connectedToAp[maxClientScanResults];
5961

6062
int channels[13];
6163
int channelsNum = 0;

0 commit comments

Comments
 (0)