Skip to content

Commit db264ad

Browse files
author
Stefan Kremser
committed
mobile optimization
- set maxResults to 80 (for APScan & ClientScan) - updated HTML & CSS files - set EEPROM size to 4096 - set namelist length to 50
1 parent c948676 commit db264ad

12 files changed

+59
-50
lines changed

esp8266_deauther/APScan.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ String APScan::getResults(){
7070
json += "\"vendor\": \""+getAPVendor(i)+"\",";
7171
json += "\"selected\": "+getAPSelected(i);
7272
json += "}";
73-
if((i!=results-1) && (i!=maxResults-1)) json += ",";
73+
if(i!=results-1) json += ",";
7474
}
7575
json += "] }";
7676
return json;
@@ -81,4 +81,4 @@ void APScan::select(int num){
8181
else selected = -1;
8282
}
8383

84-
84+

esp8266_deauther/APScan.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#ifndef APScan_h
22
#define APScan_h
33

4-
#define maxResults 30
4+
#define maxResults 80
55

66
#include "ESP8266WiFi.h"
77
#include "Mac.h"
@@ -40,4 +40,4 @@ class APScan{
4040
String getEncryption(int code);
4141
};
4242

43-
#endif
43+
#endif

esp8266_deauther/Attack.h

+8-8
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,15 @@ extern "C" {
1212
#include "APScan.h"
1313
#include "ClientScan.h"
1414

15-
#define attackNum 4
15+
#define attackNum 4 //number of defined attacks
1616

17-
#define deauthsPerSecond 10
17+
#define deauthsPerSecond 10 //number of deauthentication & disassociation frames sent per second per target.
1818

19-
#define beaconPerSecond 10
20-
#define randomBeacons 50
21-
#define SSIDLen 32
22-
#define randomBeaconChange 3
23-
#define beaconChannel 10
19+
#define beaconPerSecond 10 //number of beacon frames sent per second
20+
#define randomBeacons 50 //number of generated beacon frames
21+
#define SSIDLen 32 //SSID length of random generated APs (random beacon spam)
22+
#define randomBeaconChange 3 //time in seconds after new beacon frames are generated
23+
#define beaconChannel 10 //channel to send beacon frames on (only for the packet bytes, it will actually sent on the current channel)
2424

2525
extern void PrintHex8(uint8_t *data, uint8_t length);
2626
extern void getRandomVendorMac(uint8_t *buf);
@@ -71,7 +71,7 @@ class Attack
7171

7272
uint8_t beaconNumbers[randomBeacons];
7373

74-
uint8_t packet[512];
74+
uint8_t packet[128];
7575
int packetSize;
7676

7777
int randomBeaconCounter = 0;

esp8266_deauther/ClientScan.h

+1-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#ifndef ClientScan_h
22
#define ClientScan_h
33

4-
#define maxResults 30
4+
#define maxResults 80
55

66
#include "ESP8266WiFi.h"
77
#include "Mac.h"
@@ -38,9 +38,6 @@ class ClientScan{
3838

3939
int results = 0;
4040
int timeout = 0;
41-
42-
uint8_t beaconPacket[512];
43-
int beaconPacketLen = 0;
4441

4542
bool sniffing = false;
4643
private:

esp8266_deauther/MacList.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#ifndef MacList_h
22
#define MacList_h
33

4-
#define listLen 30
4+
#define listLen 80
55

66
#include "Mac.h"
77

@@ -25,4 +25,4 @@ class MacList
2525
void addPacket(Mac adr);
2626
};
2727

28-
#endif
28+
#endif

esp8266_deauther/NameList.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ NameList::NameList(){
55
}
66

77
void NameList::begin(){
8-
EEPROM.begin(512);
9-
if((listLength*nameLength+6)+1>512) Serial.println("ERROR: EEPROM OVERFLOW!");
8+
EEPROM.begin(eepromSize);
9+
if((listLength*nameLength+6)+1>eepromSize) Serial.println("ERROR: EEPROM OVERFLOW!");
1010
}
1111

1212
void NameList::load(){

esp8266_deauther/NameList.h

+4-3
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,13 @@
66
#include "MacList.h"
77

88
#define romAdr 0
9-
#define listLength 20
10-
#define nameLength 14
9+
#define listLength 50
10+
#define nameLength 32
11+
#define eepromSize 4096
1112

1213
/*
1314
The NameList holds and saves all your custom device names in the EEPROM.
14-
You can modify the length above, but be careful the EEPROM has only 512 bytes.
15+
You can modify the length above, but be careful the EEPROM size is limited.
1516
You may have to call nameList.clear() when uploading for the first time.
1617
*/
1718

esp8266_deauther/data.h

+4-4
Large diffs are not rendered by default.

esp8266_deauther/esp8266_deauther.ino

+10-7
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,14 @@ extern "C" {
1515
#include "Attack.h"
1616

1717
const static char *ssid = "pwned";
18-
const static char *password = "deauther";
18+
const static char *password = "deauther"; //must have at least 8 characters
1919

2020
ESP8266WebServer server(80);
2121

2222
/*
2323
I had some troubles implementing singleton classes.
2424
see: https://github.com/esp8266/Arduino/issues/500
25-
They fixed this issue with in the newer SDK version (the one we can't use),
26-
so I used global variables.
25+
They fixed this issue within a newer SDK version - the one we can't use, so I used global variables.
2726
*/
2827

2928
NameList nameList;
@@ -39,9 +38,13 @@ void sniffer(uint8_t *buf, uint16_t len){
3938
void startWifi(){
4039
WiFi.mode(WIFI_STA);
4140
wifi_set_promiscuous_rx_cb(sniffer);
42-
WiFi.softAP(ssid, password);
43-
Serial.println("SSID: "+(String)ssid);
44-
Serial.println("Password: "+(String)password);
41+
WiFi.softAP(ssid, password); //for an open network without a password change to: WiFi.softAP(ssid);
42+
String _ssid = (String)ssid;
43+
String _password = (String)password;
44+
Serial.println("SSID: "+_ssid);
45+
Serial.println("Password: "+_password);
46+
if(_password.length()<8) Serial.println("WARNING: password must have at least 8 characters!");
47+
if(_ssid.length()<1 || _ssid.length()>32) Serial.println("WARNING: SSID length must be between 1 and 32 characters!");
4548
}
4649

4750

@@ -131,7 +134,7 @@ void startClientScan(){
131134
server.send(200, "text/json", "true");
132135
clientScan.start(server.arg("time").toInt());
133136
attack.stop(0);
134-
} else server.send ( 200, "text/json", "false");
137+
} else server.send ( 200, "text/json", "Error: no selected access point");
135138
}
136139

137140
void sendClientResults(){ server.send( 200, "text/json", clientScan.getResults()); }

htmlfiles/clients.html

+5-3
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,11 @@ <h1>Scan for client devices</h1>
4242

4343
<br />
4444

45-
<table>
46-
</table>
4745
</div>
46+
47+
<table>
48+
</table>
49+
4850
</body>
4951
<script>
5052
var table = document.getElementsByTagName('table')[0];
@@ -115,7 +117,7 @@ <h1>Scan for client devices</h1>
115117
getResults(true);
116118
},scanTime.value*1000);
117119
}
118-
else alert("error");
120+
else alert(responseText);
119121
});
120122
}
121123

htmlfiles/index.html

+13-7
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@
2020
height: 15px;
2121
background: #c20000;
2222
}
23+
#wpa_info{
24+
padding-left: 0.34em;
25+
}
26+
2327
</style>
2428
<script src="functions.js"></script>
2529
<meta name="viewport" content="width=device-width, initial-scale=0.8">
@@ -43,13 +47,15 @@ <h1>Scan for WiFi access points</h1>
4347
</p>
4448
<br />
4549

46-
<table>
47-
</table>
48-
<p class="small">
49-
<br />
50-
WPA* = WPA/WPA2 auto mode
51-
</p>
5250
</div>
51+
52+
<table>
53+
</table>
54+
<p class="small" id="wpa_info">
55+
<br />
56+
WPA* = WPA/WPA2 auto mode
57+
</p>
58+
5359
</body>
5460
<script>
5561
var table = document.getElementsByTagName('table')[0];
@@ -85,7 +91,7 @@ <h1>Scan for WiFi access points</h1>
8591
apVendor.innerHTML = "";
8692

8793
var tr = '';
88-
if(res.aps.length > 0) tr += '<tr><th>Ch</th><th>SSID</th><th>RSSI</th><th>Encryption</th><th>Select</th></tr>';
94+
if(res.aps.length > 0) tr += '<tr><th>Ch</th><th>SSID</th><th>RSSI</th><th>Encrypt.</th><th>Select</th></tr>';
8995

9096
for(var i=0;i<res.aps.length;i++){
9197

htmlfiles/style.css

+6-6
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ h1{
1616
button{
1717
background: #00B0FF;
1818
color: #fff;
19-
border: 1px solid #7A7A7A;
20-
border-radius: 12px;
21-
padding: 0.34em 1em;
19+
border: 1px solid #7A7A7A80;
20+
border-radius: 14px;
21+
padding: 0.34em 0.3em;
2222
margin-bottom: 0.6em;
2323
}
2424
button:hover{
@@ -85,7 +85,8 @@ nav a:hover{
8585
table{
8686
padding: 0;
8787
width: 100%;
88-
min-width: 420px;
88+
max-width: 960px;
89+
margin: 0 auto;
8990
border-spacing: 0;
9091
background: #222222;
9192
}
@@ -98,9 +99,8 @@ table td{
9899
background: #f0f0f0;
99100
}
100101
table th, table td{
101-
border: 1px solid #000;
102102
text-align: center;
103-
padding: 0.1em 0.2em;
103+
padding: 0.1em 0;
104104
}
105105
table .selected td{
106106
background: #11a4cc;

0 commit comments

Comments
 (0)