Skip to content

Commit ecc8539

Browse files
authored
Add files via upload
1 parent e035e7c commit ecc8539

File tree

14 files changed

+24153
-0
lines changed

14 files changed

+24153
-0
lines changed

esp8266_deauther/APScan.cpp

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
#include "APScan.h"
2+
3+
APScan::APScan(){
4+
5+
}
6+
7+
bool APScan::start(){
8+
aps._clear();
9+
selected = -1;
10+
results = WiFi.scanNetworks();
11+
12+
for(int i=0;i<results && i<maxResults;i++){
13+
Mac _ap;
14+
_ap.set(WiFi.BSSID(i)[0],WiFi.BSSID(i)[1],WiFi.BSSID(i)[2],WiFi.BSSID(i)[3],WiFi.BSSID(i)[4],WiFi.BSSID(i)[5]);
15+
aps.add(_ap);
16+
channels[i] = WiFi.channel(i);
17+
rssi[i] = WiFi.RSSI(i);
18+
getEncryption(WiFi.encryptionType(i)).toCharArray(encryption[i],5);
19+
WiFi.SSID(i).toCharArray(names[i],33);
20+
data_getVendor(WiFi.BSSID(i)[0],WiFi.BSSID(i)[1],WiFi.BSSID(i)[2]).toCharArray(vendors[i],9);
21+
}
22+
return true;
23+
}
24+
25+
String APScan::getEncryption(int code){
26+
switch (code) {
27+
case ENC_TYPE_NONE:
28+
return "none";
29+
break;
30+
case ENC_TYPE_WEP:
31+
return "WEP";
32+
break;
33+
case ENC_TYPE_TKIP:
34+
return "WPA";
35+
break;
36+
case ENC_TYPE_CCMP:
37+
return "WPA2";
38+
break;
39+
case ENC_TYPE_AUTO:
40+
return "WPA*";
41+
break;
42+
}
43+
}
44+
45+
String APScan::getAPName(int num){ return names[num]; }
46+
String APScan::getAPEncryption(int num){ return encryption[num]; }
47+
String APScan::getAPVendor(int num){ return vendors[num]; }
48+
String APScan::getAPMac(int num){ return aps._get(num).toString(); }
49+
String APScan::getAPSelected(int num){
50+
if(selected == num) return "true";
51+
else return "false";
52+
}
53+
int APScan::getAPRSSI(int num){ return rssi[num]; }
54+
int APScan::getAPChannel(int num){ return channels[num]; }
55+
56+
Mac APScan::getTarget(){
57+
return aps._get(selected);
58+
}
59+
60+
String APScan::getResults(){
61+
String json = "{ \"aps\":[ ";
62+
for(int i=0;i<results && i<maxResults;i++){
63+
json += "{";
64+
json += "\"id\": "+(String)i+",";
65+
json += "\"channel\": "+(String)getAPChannel(i)+",";
66+
json += "\"mac\": \""+getAPMac(i)+"\",";
67+
json += "\"ssid\": \""+getAPName(i)+"\",";
68+
json += "\"rssi\": "+(String)getAPRSSI(i)+",";
69+
json += "\"encryption\": \""+getAPEncryption(i)+"\",";
70+
json += "\"vendor\": \""+getAPVendor(i)+"\",";
71+
json += "\"selected\": "+getAPSelected(i);
72+
json += "}";
73+
if(i!=results-1) json += ",";
74+
}
75+
json += "] }";
76+
return json;
77+
}
78+
79+
void APScan::select(int num){
80+
if(selected != num) selected = num;
81+
else selected = -1;
82+
}
83+
84+

esp8266_deauther/APScan.h

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
#ifndef APScan_h
2+
#define APScan_h
3+
4+
#define maxResults 30
5+
6+
#include "ESP8266WiFi.h"
7+
#include "Mac.h"
8+
#include "MacList.h"
9+
10+
extern String data_getVendor(uint8_t first,uint8_t second,uint8_t third);
11+
12+
class APScan{
13+
public:
14+
APScan();
15+
16+
bool start();
17+
String getResults();
18+
void select(int num);
19+
20+
String getAPName(int num);
21+
String getAPEncryption(int num);
22+
String getAPVendor(int num);
23+
String getAPMac(int num);
24+
String getAPSelected(int num);
25+
int getAPRSSI(int num);
26+
int getAPChannel(int num);
27+
28+
Mac getTarget();
29+
30+
int results = 0;
31+
int selected = -1;
32+
private:
33+
MacList aps;
34+
int channels[maxResults];
35+
int rssi[maxResults];
36+
char names[maxResults][33];
37+
char encryption[maxResults][5];
38+
char vendors[maxResults][9];
39+
40+
String getEncryption(int code);
41+
};
42+
43+
#endif

0 commit comments

Comments
 (0)