Meglepi az ESP32-ben?

Hozzászólások

erdekes. de van-e mar logoja, kabalaja, zeneje, weboldala, macskaja? ezek nelkul nem lehet komolyan venni :)

Kicsit más, de ezért is szeretjük az esp-t.

#if(TROLL_E)

void troll() {
  command.replace(F("("), F("["));
  command.replace(F(")"), F("]"));
  crindex();
  jamms = indexx;
  jamme =indexy + 1;
  if (command.indexOf(F("-J")) > -1) { jammscan(); }
  wifi_set_opmode(STATION_MODE);
  wifi_promiscuous_enable(1);
  beaconmode = true; 
}

void RickRoll() {
  for (int i = jamms; i < jamme; i++) {
    if (wsdata[i] != "") {
      sendBeacon(wsdata[i]);
      }
    }
}


void sendBeacon(String ssid) {
    // Randomize channel //
    byte channel = random(1,12); 
    wifi_set_channel(channel);

    uint8_t packet[128] = { 0x80, 0x00, //Frame Control 
                        0x00, 0x00, //Duration
                /*4*/   0xff, 0xff, 0xff, 0xff, 0xff, 0xff, //Destination address 
                /*10*/  0x01, 0x02, 0x03, 0x04, 0x05, 0x06, //Source address - overwritten later
                /*16*/  0x01, 0x02, 0x03, 0x04, 0x05, 0x06, //BSSID - overwritten to the same as the source address
                /*22*/  0xc0, 0x6c, //Seq-ctl
                //Frame body starts here
                /*24*/  0x83, 0x51, 0xf7, 0x8f, 0x0f, 0x00, 0x00, 0x00, //timestamp - the number of microseconds the AP has been active
                /*32*/  0xFF, 0x00, //Beacon interval
                /*34*/  0x01, 0x04, //Capability info
                /* SSID */
                /*36*/  0x00
                };

    int ssidLen = strlen(ssid.c_str());
    packet[37] = ssidLen;

    for(int i = 0; i < ssidLen; i++) {
      packet[38+i] = ssid[i];
    }

    uint8_t postSSID[13] = {0x01, 0x08, 0x82, 0x84, 0x8b, 0x96, 0x24, 0x30, 0x48, 0x6c, //supported rate
                        0x03, 0x01, 0x04 /*DSSS (Current Channel)*/ };

    for(int i = 0; i < 12; i++) {
      packet[38 + ssidLen + i] = postSSID[i];
    }

    packet[50 + ssidLen] = channel;

    // Randomize SRC MAC
    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 packetSize = 51 + ssidLen;

    wifi_send_pkt_freedom(packet, packetSize, 0);
    wifi_send_pkt_freedom(packet, packetSize, 0);
    wifi_send_pkt_freedom(packet, packetSize, 0);
    delay(1);
}

void jammscan() {
  int n = WiFi.scanComplete();
  if(n == -2){
    WiFi.scanNetworks(true, true);
    } else if(n){
    for (int i = 0; i < n; ++i){
      wsdata[jamme + i] = WiFi.SSID(i);
      }
    jamme += n;
    WiFi.scanDelete();
    if(WiFi.scanComplete() == -2){
      WiFi.scanNetworks(true);
    }
  }
}


#endif

https://www.esp8266.org/help/help_OTHER_COMMANDS.html