思路
将esp8266的mac改为一个已经连上校园网的设备的mac
实现
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
| #include <ESP8266WiFi.h>
uint8_t newMACAddress[] = {0x4c,0xe0,0xdb,0x5c,0x3d,0xe8};
void setup(){ Serial.begin(9600); Serial.println(); WiFi.mode(WIFI_STA); Serial.print("[OLD] ESP8266 Board MAC Address: "); Serial.println(WiFi.macAddress());
wifi_set_macaddr(STATION_IF, &newMACAddress[0]); Serial.print("[NEW] ESP8266 Board MAC Address: "); Serial.println(WiFi.macAddress()); } void loop(){ Serial.println(WiFi.macAddress()); }
|
注意:reset后mac会变回默认地址
然后,搞不赢。。。。
翻了翻各个论坛,发现他们也没有解决方案。。。。。。。
下次试试模拟网络请求?
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
| #include <ESP8266WiFi.h> #include <DNSServer.h> #include <ESP8266WebServer.h> #include <WiFiManager.h> uint8_t newMACAddress[] = {0x4c,0xe0,0xdb,0x5c,0x3d,0xe8}; void setup() { Serial.begin(9600); WiFiManager wifiManager; wifi_set_macaddr(STATION_IF, &newMACAddress[0]); wifiManager.resetSettings(); wifiManager.autoConnect("AutoConnectAP"); Serial.println(""); Serial.print("ESP8266 Connected to "); Serial.println(WiFi.SSID()); Serial.print("IP address:\t"); Serial.println(WiFi.localIP()); }
void loop() {}
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44
| #include <ESP8266WiFi.h> #include <DNSServer.h> #include <ESP8266WebServer.h> #include <WiFiManager.h> ESP8266WebServer esp8266_server(80); uint8_t newMACAddress[] = {0x4c,0xe0,0xdb,0x5c,0x3d,0xe8}; void setup() { Serial.begin(9600); WiFiManager wifiManager; wifi_set_macaddr(STATION_IF, &newMACAddress[0]); wifiManager.resetSettings(); wifiManager.autoConnect("AutoConnectAP"); Serial.println(""); Serial.print("ESP8266 Connected to "); Serial.println(WiFi.SSID()); Serial.print("IP address:\t"); Serial.println(WiFi.localIP()); esp8266_server.begin(); esp8266_server.on("/", handleRoot); esp8266_server.onNotFound(handleNotFound);
Serial.println("HTTP esp8266_server started"); }
void loop(void){ esp8266_server.handleClient(); }
void handleRoot() { esp8266_server.send(200, "text/plain", "Hello from ESP8266"); }
void handleNotFound(){ esp8266_server.send(404, "text/plain", "404: Not found"); }
|