Skip to content

Commit d842c76

Browse files
author
Stefan Kremser
committed
New Web Interface
Completly reworked design! I also improved the way you add/clone SSIDs to the list
1 parent 6f2c99a commit d842c76

23 files changed

+492
-505
lines changed

esp8266_deauther/APScan.cpp

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -119,9 +119,6 @@ String APScan::getAPEncryption(int num) {
119119
String APScan::getAPMac(int num) {
120120
return aps._get(num).toString();
121121
}
122-
bool APScan::getAPSelected(int num) {
123-
return selected[num];
124-
}
125122
bool APScan::isHidden(int num) {
126123
return hidden[num];
127124
}
@@ -185,7 +182,7 @@ void APScan::sendResults() {
185182
json += "\"r\":" + (String)getAPRSSI(i) + ",";
186183
json += "\"e\":" + (String)encryption[i] + ",";
187184
//json += "\"v\":\""+getAPVendor(i)+"\",";
188-
json += "\"se\":" + (String)getAPSelected(i);
185+
json += "\"se\":" + (String)isSelected(i);
189186
json += "}";
190187
if ((i != results - 1) && (i != maxAPScanResults - 1)) json += ",";
191188

@@ -218,7 +215,7 @@ String APScan::getResultsJSON() {
218215
json += "\"r\":" + (String)getAPRSSI(i) + ",";
219216
json += "\"e\":" + (String)encryption[i] + ",";
220217
//json += "\"v\":\""+getAPVendor(i)+"\",";
221-
json += "\"se\":" + (String)getAPSelected(i);
218+
json += "\"se\":" + (String)isSelected(i);
222219
json += "}";
223220
if ((i != results - 1) && (i != maxAPScanResults - 1)) json += ",";
224221
}

esp8266_deauther/APScan.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ class APScan {
3232
String getAPEncryption(int num);
3333
//String getAPVendor(int num);
3434
String getAPMac(int num);
35-
bool getAPSelected(int num);
3635
bool isHidden(int num);
3736
int getAPRSSI(int num);
3837
int getAPChannel(int num);
@@ -57,4 +56,4 @@ class APScan {
5756

5857
};
5958

60-
#endif
59+
#endif

esp8266_deauther/Attack.cpp

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -211,11 +211,7 @@ void Attack::run() {
211211
prevTime[1] = millis();
212212

213213
for (int a = 0; a < ssidList.len; a++) {
214-
String _ssid = ssidList.get(a);
215-
int _ch = channels[a];
216-
217-
buildBeacon(beaconAdrs._get(a), _ssid, _ch, settings.attackEncrypted);
218-
214+
buildBeacon(beaconAdrs._get(a), ssidList.get(a), channels[a], ssidList.isEncrypted(a));
219215
if (send()) packetsCounter[1]++;
220216
}
221217

@@ -376,7 +372,11 @@ size_t Attack::getSize(){
376372
json = "\"ssid\":[";
377373
jsonSize += json.length();
378374
for (int i = 0; i < ssidList.len; i++) {
379-
json = "\"" + ssidList.get(i) + "\"";
375+
json = "[";
376+
json += "\"" + ssidList.get(i) + "\",";
377+
json += String( ssidList.isEncrypted(i) ) + "";
378+
Serial.print(ssidList.isEncrypted(i));
379+
json += "]";
380380
if (i != ssidList.len - 1) json += ",";
381381
jsonSize += json.length();
382382
}
@@ -437,7 +437,10 @@ void Attack::sendResults(){
437437
json = "\"ssid\":[";
438438
sendToBuffer(json);
439439
for (int i = 0; i < ssidList.len; i++) {
440-
json = "\"" + ssidList.get(i) + "\"";
440+
json = "[";
441+
json += "\"" + ssidList.get(i) + "\",";
442+
json += (String)ssidList.isEncrypted(i) + "";
443+
json += "]";
441444
if (i != ssidList.len - 1) json += ",";
442445
sendToBuffer(json);
443446
}

esp8266_deauther/SSIDList.cpp

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,24 +15,26 @@ void SSIDList::load() {
1515
char _nextChar = EEPROM.read(listAdr + (i * SSIDLength) + h);
1616
names[i][h] = _nextChar;
1717
}
18+
encrypted[i] = EEPROM.read(encAdr + i);
1819
}
1920
}
2021

2122
void SSIDList::clear() {
2223
len = 0;
2324
}
2425

25-
void SSIDList::add(String name) {
26+
void SSIDList::add(String name, bool enc) {
2627
if (len < SSIDListLength) {
2728
for (int i = 0; i < SSIDLength; i++) {
2829
if (i < name.length()) names[len][i] = name[i];
2930
else names[len][i] = 0x00;
3031
}
32+
encrypted[len] = enc;
3133
len++;
3234
}
3335
}
3436

35-
void SSIDList::addClone(String name, int num) {
37+
void SSIDList::addClone(String name, int num, bool enc) {
3638
int _restSSIDLen = SSIDLength - name.length();
3739
String _apName;
3840

@@ -52,14 +54,7 @@ void SSIDList::addClone(String name, int num) {
5254
for (int d = 0; d < _restSSIDLen - 2; d++) _apName += " ";
5355
_apName += (String)c;//e.g. "SAMPLEAP 78"
5456
}
55-
add(_apName);
56-
}
57-
}
58-
59-
void SSIDList::edit(int num, String name) {
60-
for (int i = 0; i < SSIDLength; i++) {
61-
if (i < name.length()) names[num][i] = name[i];
62-
else names[num][i] = 0x00;
57+
add(_apName, enc);
6358
}
6459
}
6560

@@ -71,12 +66,17 @@ String SSIDList::get(int num) {
7166
return _name;
7267
}
7368

69+
bool SSIDList::isEncrypted(int num){
70+
return encrypted[num];
71+
}
72+
7473
void SSIDList::remove(int num) {
7574
if (num >= 0 && num < len) {
7675
for (int i = num; i < len - 1; i++) {
7776
for (int h = 0; h < SSIDLength; h++) {
7877
names[i][h] = names[i + 1][h];
7978
}
79+
encrypted[i] = encrypted[i + 1];
8080
}
8181
len--;
8282
}
@@ -89,6 +89,7 @@ void SSIDList::save() {
8989
for (int h = 0; h < SSIDLength; h++) {
9090
EEPROM.write(listAdr + (i * SSIDLength) + h, names[i][h]);
9191
}
92+
EEPROM.write(encAdr + i, encrypted[i]);
9293
}
9394
EEPROM.commit();
9495
if (debug) Serial.println("done");
@@ -99,7 +100,7 @@ void SSIDList::_random() {
99100
for (int i = len; i < SSIDListLength; i++) {
100101
_rName = "";
101102
for (int h = 0; h < SSIDLength; h++) _rName += letters[random(0, sizeof(letters))];
102-
add(_rName);
103+
add(_rName, random(2) > 0.5 );
103104
}
104105
}
105106

esp8266_deauther/SSIDList.h

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
#define listAdr 2048
99
#define lenAdr 2047
10+
#define encAdr 3585
1011
#define SSIDListLength 48
1112
#define SSIDLength 32
1213

@@ -19,10 +20,11 @@ class SSIDList
1920

2021
void load();
2122
void clear();
22-
void add(String name);
23-
void addClone(String name, int num);
23+
void add(String name, bool enc);
24+
void addClone(String name, int num, bool enc);
2425
void edit(int num, String name);
2526
String get(int num);
27+
bool isEncrypted(int num);
2628
void remove(int num);
2729
void _random();
2830
void save();
@@ -31,6 +33,7 @@ class SSIDList
3133

3234
char letters[67] = {0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7a, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5a, 0x20, 0x2c, 0x2e, 0x2d, 0x5f};
3335
char names[SSIDListLength][SSIDLength];
36+
bool encrypted[SSIDListLength];
3437
};
3538

3639
#endif

esp8266_deauther/Settings.cpp

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,6 @@ void Settings::load() {
8080
attackTimeout = eepromReadInt(attackTimeoutAdr);
8181
attackPacketRate = EEPROM.read(attackPacketRateAdr);
8282
clientScanTime = EEPROM.read(clientScanTimeAdr);
83-
attackEncrypted = (bool)EEPROM.read(attackEncryptedAdr);
8483
useLed = (bool)EEPROM.read(useLedAdr);
8584
channelHop = (bool)EEPROM.read(channelHopAdr);
8685
multiAPs = (bool)EEPROM.read(multiAPsAdr);
@@ -110,7 +109,6 @@ void Settings::reset() {
110109
attackTimeout = 5 * 60;
111110
attackPacketRate = 10;
112111
clientScanTime = 15;
113-
attackEncrypted = false;
114112
useLed = true;
115113
channelHop = false;
116114
multiAPs = false;
@@ -150,7 +148,6 @@ void Settings::save() {
150148

151149
EEPROM.write(attackPacketRateAdr, attackPacketRate);
152150
EEPROM.write(clientScanTimeAdr, clientScanTime);
153-
EEPROM.write(attackEncryptedAdr, attackEncrypted);
154151
EEPROM.write(useLedAdr, useLed);
155152
EEPROM.write(channelHopAdr, channelHop);
156153
EEPROM.write(multiAPsAdr, multiAPs);
@@ -183,7 +180,6 @@ void Settings::info() {
183180
Serial.println("attack timeout: " + (String)attackTimeout);
184181
Serial.println("attack packet rate: " + (String)attackPacketRate);
185182
Serial.println("client scan time: " + (String)clientScanTime);
186-
Serial.println("attack SSID encrypted: " + (String)attackEncrypted);
187183
Serial.println("use built-in LED: " + (String)useLed);
188184
Serial.println("channel hopping: " + (String)channelHop);
189185
Serial.println("multiple APs: " + (String)multiAPs);
@@ -208,7 +204,6 @@ size_t Settings::getSize() {
208204
json += "\"attackTimeout\":" + (String)attackTimeout + ",";
209205
json += "\"attackPacketRate\":" + (String)attackPacketRate + ",";
210206
json += "\"clientScanTime\":" + (String)clientScanTime + ",";
211-
json += "\"attackEncrypted\":" + (String)attackEncrypted + ",";
212207
json += "\"useLed\":" + (String)useLed + ",";
213208
json += "\"channelHop\":" + (String)channelHop + ",";
214209
json += "\"multiAPs\":" + (String)multiAPs + ",";
@@ -237,7 +232,6 @@ void Settings::send() {
237232
json += "\"attackTimeout\":" + (String)attackTimeout + ",";
238233
json += "\"attackPacketRate\":" + (String)attackPacketRate + ",";
239234
json += "\"clientScanTime\":" + (String)clientScanTime + ",";
240-
json += "\"attackEncrypted\":" + (String)attackEncrypted + ",";
241235
json += "\"useLed\":" + (String)useLed + ",";
242236
json += "\"channelHop\":" + (String)channelHop + ",";
243237
json += "\"multiAPs\":" + (String)multiAPs + ",";

esp8266_deauther/Settings.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ extern NameList nameList;
3030
#define attackTimeoutAdr 1091
3131
#define attackPacketRateAdr 1093
3232
#define clientScanTimeAdr 1094
33-
#define attackEncryptedAdr 1095
33+
//#define attackEncryptedAdr 1095 <-- address is now free for another setting
3434
#define ssidHiddenAdr 1096
3535
#define apScanHiddenAdr 1097
3636
#define apChannelAdr 1098
@@ -68,7 +68,6 @@ class Settings
6868
unsigned int attackTimeout;
6969
int attackPacketRate;
7070
int clientScanTime;
71-
bool attackEncrypted;
7271
bool useLed;
7372
bool channelHop;
7473
bool multiAPs;

esp8266_deauther/data.h

Lines changed: 14 additions & 14 deletions
Large diffs are not rendered by default.

esp8266_deauther/esp8266_deauther.ino

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ void drawInterface() {
107107
else if (i == 2) display.drawString(3, i * fontSize, "-> " + attackMode + " attack");
108108
else if (i - 3 < apScan.results) {
109109
display.drawString(3, _lrow * fontSize, apScan.getAPName(i - 3));
110-
if (apScan.getAPSelected(i - 3)) {
110+
if (apScan.isSelected(i - 3)) {
111111
display.drawVerticalLine(1, _lrow * fontSize, fontSize);
112112
display.drawVerticalLine(2, _lrow * fontSize, fontSize);
113113
}
@@ -335,18 +335,32 @@ void startAttack() {
335335
}
336336

337337
void addSSID() {
338-
if(server.hasArg("ssid") && server.hasArg("num")){
338+
if(server.hasArg("ssid") && server.hasArg("num") && server.hasArg("enc")){
339339
int num = server.arg("num").toInt();
340340
if(num > 0){
341-
ssidList.addClone(server.arg("ssid"),num);
341+
ssidList.addClone(server.arg("ssid"),num, server.arg("enc") == "true");
342342
}else{
343-
ssidList.add(server.arg("ssid"));
343+
ssidList.add(server.arg("ssid"), server.arg("enc") == "true" || server.arg("enc") == "1");
344344
}
345345
attack.ssidChange = true;
346346
server.send( 200, "text/json", "true");
347347
}else server.send( 200, "text/json", "false");
348348
}
349349

350+
void cloneSelected(){
351+
if(apScan.selectedSum > 0){
352+
int clonesPerSSID = 48/apScan.selectedSum;
353+
ssidList.clear();
354+
for(int i=0;i<apScan.results;i++){
355+
if(apScan.isSelected(i)){
356+
ssidList.addClone(apScan.getAPName(i),clonesPerSSID, apScan.getAPEncryption(i) != "none");
357+
}
358+
}
359+
}
360+
attack.ssidChange = true;
361+
server.send( 200, "text/json", "true");
362+
}
363+
350364
void deleteSSID() {
351365
ssidList.remove(server.arg("num").toInt());
352366
attack.ssidChange = true;
@@ -422,10 +436,6 @@ void saveSettings() {
422436
if (server.arg("randMacAp") == "false") settings.isMacAPRand = false;
423437
else settings.isMacAPRand = true;
424438
}
425-
if (server.hasArg("ssidEnc")) {
426-
if (server.arg("ssidEnc") == "false") settings.attackEncrypted = false;
427-
else settings.attackEncrypted = true;
428-
}
429439
if (server.hasArg("scanTime")) settings.clientScanTime = server.arg("scanTime").toInt();
430440
if (server.hasArg("timeout")) settings.attackTimeout = server.arg("timeout").toInt();
431441
if (server.hasArg("deauthReason")) settings.deauthReason = server.arg("deauthReason").toInt();
@@ -541,6 +551,7 @@ void setup() {
541551
server.on("/clearNameList.json", clearNameList);
542552
server.on("/editNameList.json", editClientName);
543553
server.on("/addSSID.json", addSSID);
554+
server.on("/cloneSelected.json", cloneSelected);
544555
server.on("/deleteSSID.json", deleteSSID);
545556
server.on("/randomSSID.json", randomSSID);
546557
server.on("/clearSSID.json", clearSSID);

web_server/converter.html

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,12 @@
88
<meta name="viewport" content="width=device-width, initial-scale=1">
99
<link rel="stylesheet" href="html/style.css">
1010
<script src="jquery-3.2.1.min.js"></script>
11+
<style>
12+
textarea{
13+
width: 96%;
14+
height: 350px;
15+
}
16+
</style>
1117
</head>
1218
<body>
1319

@@ -22,8 +28,8 @@
2228
<div class="col-12">
2329
<h1 class="header">Text to Byte Array Converter</h1>
2430
<p>
25-
Please use <a href="https://htmlcompressor.com/compressor/" target="_blank">HTMLCompressor</a> first to get your HTML, CSS and JS minified.<br />
26-
Every saved byte can improve the stability of the ESP8266's webserver!<br />
31+
Please use <a href="https://htmlcompressor.com/compressor/" target="_blank">HTMLCompressor</a> (or something similar) first to get your HTML, CSS and JS minified.<br />
32+
Every saved byte can improve the stability of the ESP8266's webserver!
2733
</p>
2834
</div>
2935
</div>
@@ -45,12 +51,6 @@ <h1 class="header">Text to Byte Array Converter</h1>
4551
<p>Length: <span id="info_len">0</span> Bytes</p>
4652
</div>
4753
</div>
48-
49-
<div id="copyright">
50-
version 1.5<br />
51-
Copyright (c) 2017 Stefan Kremser<br />
52-
<a href="https://github.com/spacehuhn" target="_blank">github.com/spacehuhn</a><br />
53-
</div>
5454

5555
</div>
5656

0 commit comments

Comments
 (0)