Created
April 16, 2016 15:14
-
-
Save kost/1e1b13d5796a6649f82ec1c08cd0a835 to your computer and use it in GitHub Desktop.
ESP8266 WiFi Beacon Generator - Generate SSID beacon frames on ESP8226
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <ESP8266WiFi.h> | |
extern "C" { | |
#include "user_interface.h" | |
} | |
byte channel; | |
int maxssids=10; /* how much SSIDs we have */ | |
char *ssids[] = { | |
"One", | |
"Two", | |
"Three", | |
"Four", | |
"Five", | |
"Six", | |
"Seven", | |
"Eight", | |
"Nine", | |
"Ten" | |
}; | |
byte rnd; | |
byte i; | |
byte count; | |
byte wifipkt[128] = { 0x80, 0x00, 0x00, 0x00, | |
/*4*/ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, | |
/*10*/ 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, | |
/*16*/ 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, | |
/*22*/ 0xc0, 0x6c, | |
/*24*/ 0x83, 0x51, 0xf7, 0x8f, 0x0f, 0x00, 0x00, 0x00, | |
/*32*/ 0x64, 0x00, | |
/*34*/ 0x01, 0x04, | |
/* SSID */ | |
/*36*/ 0x00}; | |
byte pktsuffix[] = { | |
0x01, 0x08, 0x82, 0x84, | |
0x8b, 0x96, 0x24, 0x30, 0x48, 0x6c, 0x03, 0x01, | |
0x04 }; | |
void setup() { | |
delay(500); | |
wifi_set_opmode(STATION_MODE); | |
wifi_promiscuous_enable(1); | |
} | |
void loop() { | |
wifipkt[10] = wifipkt[16] = random(256); | |
wifipkt[11] = wifipkt[17] = random(256); | |
wifipkt[12] = wifipkt[18] = random(256); | |
wifipkt[13] = wifipkt[19] = random(256); | |
wifipkt[14] = wifipkt[20] = random(256); | |
wifipkt[15] = wifipkt[21] = random(256); | |
count=37; | |
rnd=random(maxssids); | |
wifipkt[count++]=strlen(ssids[rnd]); | |
for (i=0; i<strlen(ssids[rnd]); i++) { | |
wifipkt[count++]=ssids[rnd][i]; | |
} | |
for (i=0; i<sizeof(pktsuffix); i++) { | |
wifipkt[count++]=pktsuffix[i]; | |
} | |
channel = random(1,12); | |
wifi_set_channel(channel); | |
wifipkt[count-1] = channel; | |
wifi_send_pkt_freedom(wifipkt, count, 0); | |
wifi_send_pkt_freedom(wifipkt, count, 0); | |
wifi_send_pkt_freedom(wifipkt, count, 0); | |
delay(1); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi
Do you have sample for generating WEP/WPA beacon?
I am trying to change the control frame but no luck.