Breadboard
docs
Example project · ESP32

WPA2 secure join (OLED)

Join a password-protected network and watch the real WPA2 4-way handshake happen: the unmodified supplicant runs genuine PBKDF2/AES against the virtual AP. The OLED shows a padlock, the SSID and the leased IP over the encrypted link; the 📡 Sniffer shows EAPOL messages 1–4 then DHCP over CCMP.

The WPA2 secure join (OLED) circuit as rendered by the simulator

What's on the bench

  • Battery
  • ESP32-C3
  • OLED 128×64

The code

This MicroPython script runs on the emulated board every boot; edit it in the Code tab.

from machine import I2C, Pin
import framebuf, time
i = I2C(0, scl=Pin(9), sda=Pin(8))
buf = bytearray(1024)
fb = framebuf.FrameBuffer(buf, 128, 64, framebuf.MONO_VLSB)
for c in b'\xae\xd5\x80\xa8\x3f\xd3\x00\x40\x8d\x14\x20\x00\xa1\xc8\xda\x12\x81\xcf\xd9\xf1\xdb\x40\xa4\xa6\xaf':
    i.writeto(0x3c, bytes([0, c]))
def show():
    i.writeto(0x3c, b'\x00\x21\x00\x7f\x22\x00\x07')
    i.writeto(0x3c, b'\x40' + buf)

import network
w = network.WLAN(network.STA_IF)
w.active(True)
fb.fill(0); fb.text('WPA2 joining...', 0, 28); show()
w.connect('SecureNet', 'hunter2')
while not w.isconnected():
    time.sleep_ms(100)
ip = w.ifconfig()[0]
print('secured', ip)
def padlock(x, y):
    fb.rect(x, y + 6, 14, 10, 1)          # body
    fb.rect(x + 4, y, 6, 8, 1)            # shackle
    fb.fill_rect(x + 6, y + 9, 2, 4, 1)   # keyhole
while True:
    fb.fill(0)
    fb.text('SECURE LINK', 0, 0)
    padlock(110, 0)
    fb.hline(0, 10, 128, 1)
    fb.text('SecureNet  WPA2', 0, 16)
    fb.text('IP ' + ip, 0, 30)
    fb.text('CCMP encrypted', 0, 44)
    show()
    time.sleep_ms(500)