Get Online in McDonald's with ESP8266

McDonald's used to be the largest chain of free restrooms in the world. Nowadays, they are the largest chain of free WiFi across the United States. Every McDonald's I've been to offers AT&T WiFi services. I can walk in, connect to "attwifi" on my phone, accept the license agreement, and I'm online.

attwifi captive portal in McDonald's

The license agreement page is called a captive portal, a web page displayed to newly connected users before they are granted broader access to network resource. While it's trivial to click through the captive portal on a smartphone, if you are wearing an ESP8266 as a connected jewelry, it would not connect successfully. When I encountered a captive portal in my apartment WiFi, I made an Arduino sketch to send the packets I found through Fiddler, but McDonald's WiFi is different:

  • Each McDonald's store hosts their captive portal on a different domain.
  • The form submission step needs several parameters from the HTML, but does not use cookies.

attwifi captive portal form HTML

"Wireshark" on ESP8266: PacketDump

I dived into the open source lwip library in ESP8266 Arduino Core, and figured out how to observe raw Ethernet packets.

PacketDump.ino demo

lwip's struct netif

lwip declares a network interface structure in lwip/netif.h:

struct netif {
  struct netif *next;

  ip_addr_t ip_addr;
  ip_addr_t netmask;
  ip_addr_t gw;

  netif_input_fn input;
  netif_output_fn output;
  netif_linkoutput_fn linkoutput;

  u16_t mtu;
  u8_t hwaddr_len;
  u8_t hwaddr[NETIF_MAX_HWADDR_LEN];
  u8_t flags;
  char name[2];
  u8_t num;

  // (some fields are omitted)






Yate = Yet Another Telephony Engine,是一款开源的VoIP网络电话软件。它可以作为服务器、也可以作为客户端使用。yate2可以在Linux下运行、也可以在Windows下运行。yate2下载地址

用Lua语言编写Wireshark dissector插件


Wireshark is the world's foremost network protocol analyzer, and is the de facto (and often de jure) standard across many industries and educational institutions.

Wireshark development thrives thanks to the contributions of networking experts across the globe. It is the continuation of a project that started in 1998.


  1. 发布你的网络协议,等到有1,000,000人每天使用你的协议时,Wireshark就会支持你的协议
  2. 编写一个Wireshark插件,自己动手、丰衣足食