esp32_marauder/WiFiScan.cpp
// Function to send beacons with random ESSID length
Function to send beacons with random ESSID length
Function to send beacons with random ESSID length
void WiFiScan::broadcastSetSSID(uint32_t current_time, char* ESSID) {
  set_channel = random(1,12);
  esp_wifi_set_channel(set_channel, WIFI_SECOND_CHAN_NONE);
  delay(1);
  packet[10] = packet[16] = random(256);
  packet[11] = packet[17] = random(256);
  packet[12] = packet[18] = random(256);
  packet[13] = packet[19] = random(256);
  packet[14] = packet[20] = random(256);
  packet[15] = packet[21] = random(256);
  int ssidLen = strlen(ESSID);
  int fullLen = ssidLen;
  packet[37] = fullLen;
  for(int i = 0; i < ssidLen; i++)
    packet[38 + i] = ESSID[i];
  packet[50 + fullLen] = set_channel;
  uint8_t postSSID[13] = {0x01, 0x08, 0x82, 0x84, 0x8b, 0x96, 0x24, 0x30, 0x48, 0x6c, 
                      0x03, 0x01, 0x04  };
  for(int i = 0; i < 12; i++)
    packet[38 + fullLen + i] = postSSID[i];
  esp_wifi_80211_tx(WIFI_IF_AP, packet, sizeof(packet), false);
  esp_wifi_80211_tx(WIFI_IF_AP, packet, sizeof(packet), false);
  esp_wifi_80211_tx(WIFI_IF_AP, packet, sizeof(packet), false);
  packets_sent = packets_sent + 3;
}
void WiFiScan :: broadcastSetSSID ( uint32_t current_time , char * ESSID ) { set_channel = random ( 1 , 12 ) ; esp_wifi_set_channel ( set_channel , WIFI_SECOND_CHAN_NONE ) ; delay ( 1 ) ; packet [ 10 ] = packet [ 16 ] = random ( 256 ) ; packet [ 11 ] = packet [ 17 ] = random ( 256 ) ; packet [ 12 ] = packet [ 18 ] = random ( 256 ) ; packet [ 13 ] = packet [ 19 ] = random ( 256 ) ; packet [ 14 ] = packet [ 20 ] = random ( 256 ) ; packet [ 15 ] = packet [ 21 ] = random ( 256 ) ; int ssidLen = strlen ( ESSID ) ; int fullLen = ssidLen ; packet [ 37 ] = fullLen ; for ( int i = 0 ; i < ssidLen ; i ++ ) packet [ 38 + i ] = ESSID [ i ] ; packet [ 50 + fullLen ] = set_channel ; uint8_t postSSID [ 13 ] = { 0x01 , 0x08 , 0x82 , 0x84 , 0x8b , 0x96 , 0x24 , 0x30 , 0x48 , 0x6c , 0x03 , 0x01 , 0x04 } ; for ( int i = 0 ; i < 12 ; i ++ ) packet [ 38 + fullLen + i ] = postSSID [ i ] ; esp_wifi_80211_tx ( WIFI_IF_AP , packet , sizeof ( packet ) , false ) ; esp_wifi_80211_tx ( WIFI_IF_AP , packet , sizeof ( packet ) , false ) ; esp_wifi_80211_tx ( WIFI_IF_AP , packet , sizeof ( packet ) , false ) ; packets_sent = packets_sent + 3 ; }
Function to send beacons with random ESSID length
Function to send beacons with random ESSID length
// Randomize SRC MAC ///////////////////////////// //int essid_len = random(6, 10); // random prefix to beacon essid //uint8_t rand_reg[essid_len] = {}; //for (int i = 0; i < essid_len; i++) //  rand_reg[i] = alfa[random(65)]; //int rand_len = sizeof(rand_reg); // Insert random prefix //for (int i = 0; i < rand_len; i++) //  packet[38+i] = rand_reg[i]; // Insert my tag ///////////////////////////// //supported rate /*DSSS (Current Channel)*/ // Add everything that goes after the SSID //esp_wifi_80211_tx(WIFI_IF_AP, packet, sizeof(packet), false); //esp_wifi_80211_tx(WIFI_IF_AP, packet, sizeof(packet), false); //esp_wifi_80211_tx(WIFI_IF_AP, packet, sizeof(packet), false);