Skip to content

Commit 7be4d74

Browse files
author
Stefan Kremser
committed
fix for invalid Json bug
JSON bug episode 2 - attack of the json bugs :D no? Ok.. :(
1 parent cf2789e commit 7be4d74

File tree

5 files changed

+11
-19
lines changed

5 files changed

+11
-19
lines changed

esp8266_deauther/APScan.cpp

+1-1
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) json += ",";
73+
if((i!=results-1) && (i!=maxResults-1)) json += ",";
7474
}
7575
json += "] }";
7676
return json;

esp8266_deauther/Attack.cpp

+5-14
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ String Attack::getResults(){
131131
void Attack::run(){
132132
currentMillis = millis();
133133

134-
if(running[0]){
134+
if(running[0]){//deauth all
135135
if((currentMillis - previousMillis[0]) >= 1000/deauthsPerSecond){
136136

137137
int clientsSelected = 0;
@@ -171,7 +171,7 @@ void Attack::run(){
171171
}
172172

173173
}
174-
if(running[1]){
174+
if(running[1]){//deauth selected
175175
if((currentMillis - previousMillis[1]) >= 1000/deauthsPerSecond){
176176

177177
//send deauth
@@ -207,7 +207,7 @@ void Attack::run(){
207207

208208
}
209209

210-
if(running[2] || running[3]){
210+
if(running[2] || running[3]){//beacon spam
211211

212212
if((currentMillis - previousMillis[3]) >= 1000/beaconPerSecond){
213213
previousMillis[3] = millis();
@@ -216,7 +216,7 @@ void Attack::run(){
216216
for(int i=0;i<randomBeacons;i++){
217217
//unsigned long startTime = millis();
218218
randomBeaconCounter++;
219-
generatePacket();
219+
generateBeaconPacket();
220220

221221
if(wifi_send_pkt_freedom(packet, packetSize, 0) == -1){/*
222222
Serial.print(packetSize);
@@ -238,14 +238,7 @@ void Attack::run(){
238238
}
239239
}
240240

241-
void Attack::generatePacket(){/*
242-
if(running[0]){
243-
244-
}
245-
if(running[1]){
246-
247-
}
248-
else if(running[2] || running[3]){*/
241+
void Attack::generateBeaconPacket(){
249242

250243
if(currentMillis - previousRandomBeaconMillis >= randomBeaconChange*1000){
251244
generate(oldRandomBeacon);
@@ -310,8 +303,6 @@ void Attack::generatePacket(){/*
310303

311304
//set MAC
312305
for(int i=0;i<6;i++) packet[10+i] = packet[16+i] = beaconMACs[randomBeaconCounter][i];
313-
314-
//}
315306
}
316307

317308
void Attack::stopAll(){

esp8266_deauther/Attack.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ extern "C" {
1717
#define deauthsPerSecond 10 //number of deauthentication & disassociation frames sent per second per target.
1818

1919
#define beaconPerSecond 10 //number of beacon frames sent per second
20-
#define randomBeacons 50 //number of generated beacon frames
20+
#define randomBeacons 80 //number of generated beacon frames
2121
#define SSIDLen 32 //SSID length of random generated APs (random beacon spam)
2222
#define randomBeaconChange 3 //time in seconds after new beacon frames are generated
2323
#define beaconChannel 10 //channel to send beacon frames on (only for the packet bytes, it will actually sent on the current channel)
@@ -40,7 +40,7 @@ class Attack
4040
void stopAll();
4141
void stop(int num);
4242
private:
43-
void generatePacket();
43+
void generateBeaconPacket();
4444
bool send(uint8_t buf[], int len);
4545

4646
const String attackNames[attackNum] = {"deauth selected","deauth all","beacon spam","random beacon spam"};
@@ -80,7 +80,7 @@ class Attack
8080
uint8_t beaconPacket_header[36] = {
8181
0x80, 0x00,
8282
0x00, 0x00, //beacon
83-
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, //destination: broadcast
83+
0x80, 0x7a, 0xbf, 0x3f, 0x8c, 0xac, //destination: broadcast
8484
0x01, 0x02, 0x03, 0x04, 0x05, 0x06, //source
8585
0x01, 0x02, 0x03, 0x04, 0x05, 0x06, //source
8686
0xc0, 0x6c,

esp8266_deauther/ClientScan.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ String ClientScan::getResults(){
9898
json += "\"vendor\": \""+(String)getClientVendor(i)+"\",";
9999
json += "\"selected\": "+(String)getClientSelected(i);
100100
json += "}";
101-
if(i!=results-1) json += ",";
101+
if((i!=results-1) && (i!=maxResults-1)) json += ",";
102102
}
103103
json += "] }";
104104
return json;

esp8266_deauther/NameList.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ void NameList::save(){
4545

4646
void NameList::add(Mac client, String name){
4747
if(clients.add(client)) len++;
48+
else Serial.println("WARNING: name list is full!");
4849
uint8_t _buf[nameLength];
4950
name.getBytes(_buf,nameLength);
5051
for(int i=0;i<nameLength;i++){

0 commit comments

Comments
 (0)