@@ -69,6 +69,9 @@ void Attack::stop() {
6969 deauth.tc = 0 ;
7070 beacon.tc = 0 ;
7171 probe.tc = 0 ;
72+ deauth.active = false ;
73+ beacon.active = false ;
74+ probe.active = false ;
7275 prntln (A_STOP);
7376 }
7477}
@@ -244,7 +247,7 @@ void Attack::deauthAllUpdate() {
244247void Attack::probeUpdate () {
245248 if (probe.active && (probe.maxPkts > 0 ) && (probe.packetCounter < probe.maxPkts )) {
246249 if (probe.time <= currentTime - (1000 / probe.maxPkts )) {
247- if (settings::getAttackSettings ().attack_all_ch ) setWifiChannel (probe.tc % 11 );
250+ if (settings::getAttackSettings ().attack_all_ch ) setWifiChannel (probe.tc % 11 , true );
248251 probe.tc += sendProbe (probe.tc );
249252
250253 if (probe.tc >= ssids.count ()) probe.tc = 0 ;
@@ -300,7 +303,7 @@ bool Attack::deauthDevice(uint8_t* apMac, uint8_t* stMac, uint8_t reason, uint8_
300303 // send deauth frame
301304 deauthpkt[0 ] = 0xc0 ;
302305
303- if (sendPacket (deauthpkt, packetSize, ch, 1 )) {
306+ if (sendPacket (deauthpkt, packetSize, ch, 1 , true )) {
304307 success = true ;
305308 deauth.packetCounter ++;
306309 }
@@ -312,7 +315,7 @@ bool Attack::deauthDevice(uint8_t* apMac, uint8_t* stMac, uint8_t reason, uint8_
312315
313316 disassocpkt[0 ] = 0xa0 ;
314317
315- if (sendPacket (disassocpkt, packetSize, ch, 1 )) {
318+ if (sendPacket (disassocpkt, packetSize, ch, 1 , false )) {
316319 success = true ;
317320 deauth.packetCounter ++;
318321 }
@@ -327,15 +330,15 @@ bool Attack::deauthDevice(uint8_t* apMac, uint8_t* stMac, uint8_t reason, uint8_
327330 // send deauth frame
328331 disassocpkt[0 ] = 0xc0 ;
329332
330- if (sendPacket (disassocpkt, packetSize, ch, 1 )) {
333+ if (sendPacket (disassocpkt, packetSize, ch, 1 , false )) {
331334 success = true ;
332335 deauth.packetCounter ++;
333336 }
334337
335338 // send disassociate frame
336339 disassocpkt[0 ] = 0xa0 ;
337340
338- if (sendPacket (disassocpkt, packetSize, ch, 1 )) {
341+ if (sendPacket (disassocpkt, packetSize, ch, 1 , false )) {
339342 success = true ;
340343 deauth.packetCounter ++;
341344 }
@@ -347,7 +350,7 @@ bool Attack::deauthDevice(uint8_t* apMac, uint8_t* stMac, uint8_t reason, uint8_
347350}
348351
349352bool Attack::sendBeacon (uint8_t tc) {
350- if (settings::getAttackSettings ().attack_all_ch ) setWifiChannel (tc % 11 );
353+ if (settings::getAttackSettings ().attack_all_ch ) setWifiChannel (tc % 11 , true );
351354 mac[5 ] = tc;
352355 return sendBeacon (mac, ssids.getName (tc).c_str (), wifi_channel, ssids.getWPA2 (tc));
353356}
@@ -380,7 +383,7 @@ bool Attack::sendBeacon(uint8_t* mac, const char* ssid, uint8_t ch, bool wpa2) {
380383 tmpPacket[37 ] = ssidLen; // update SSID length byte
381384 memcpy (&tmpPacket[38 + ssidLen], &beaconPacket[70 ], wpa2 ? 39 : 13 ); // copy second half of packet into buffer
382385
383- bool success = sendPacket (tmpPacket, tmpPacketSize, ch, 1 );
386+ bool success = sendPacket (tmpPacket, tmpPacketSize, ch, 1 , false );
384387
385388 if (success) {
386389 beacon.time = currentTime;
@@ -394,7 +397,7 @@ bool Attack::sendBeacon(uint8_t* mac, const char* ssid, uint8_t ch, bool wpa2) {
394397}
395398
396399bool Attack::sendProbe (uint8_t tc) {
397- if (settings::getAttackSettings ().attack_all_ch ) setWifiChannel (tc % 11 );
400+ if (settings::getAttackSettings ().attack_all_ch ) setWifiChannel (tc % 11 , true );
398401 mac[5 ] = tc;
399402 return sendProbe (mac, ssids.getName (tc).c_str (), wifi_channel);
400403}
@@ -408,7 +411,7 @@ bool Attack::sendProbe(uint8_t* mac, const char* ssid, uint8_t ch) {
408411 memcpy (&probePacket[10 ], mac, 6 );
409412 memcpy (&probePacket[26 ], ssid, ssidLen);
410413
411- if (sendPacket (probePacket, packetSize, ch, 1 )) {
414+ if (sendPacket (probePacket, packetSize, ch, 1 , false )) {
412415 probe.time = currentTime;
413416 probe.packetCounter ++;
414417 return true ;
@@ -417,11 +420,11 @@ bool Attack::sendProbe(uint8_t* mac, const char* ssid, uint8_t ch) {
417420 return false ;
418421}
419422
420- bool Attack::sendPacket (uint8_t * packet, uint16_t packetSize, uint8_t ch, uint16_t tries) {
423+ bool Attack::sendPacket (uint8_t * packet, uint16_t packetSize, uint8_t ch, uint16_t tries, bool force_ch ) {
421424 // Serial.println(bytesToStr(packet, packetSize));
422425
423426 // set channel
424- setWifiChannel (ch);
427+ setWifiChannel (ch, force_ch );
425428
426429 // sent out packet
427430 bool sent = wifi_send_pkt_freedom (packet, packetSize, 0 ) == 0 ;
0 commit comments