---
title: "EtherSnoop"
url: "https://maker.wiznet.io/Hannah/projects/ethersnoop/"
markdown_url: "https://maker.wiznet.io/Hannah/projects/ethersnoop/md"
type: "UCC: User Created Content"
author: "howie1989"
author_url: "https://github.com/howie1989/EtherSnoop"
editor: "WIZnet"
editor_url: "https://maker.wiznet.io/"
original_author: "howie1989"
original_url: "https://github.com/howie1989/EtherSnoop"
published: "2025-10-29"
language: "en"
hardware: ["WIZnet W55RP20-EVB-Pico"]
likes: 0
views: 411
comments: 0
source: "WIZnet Makers (https://maker.wiznet.io/)"
---

# EtherSnoop

> A portable, real-time network snooping device that captures and displays Cisco Discovery Protocol packets, built on the W55RP20-EVB-PICO with a snazzy OLED

Original author: howie1989 (source: https://github.com/howie1989/EtherSnoop)

## Components

- **WIZnet W55RP20-EVB-Pico** x 1 ([docs](https://wiznet.io/products/powered-by-raspberry-pi/w55rp20-evb-pico))
- Software: **MicroPython** ([docs](http://micropython.org/))

## Article

#### Project Overview

**EtherSnoop** is a **pocket-sized Ethernet discovery tool** built using the **WIZnet W55RP20-EVB-Pico** and **MicroPython**.
It listens to **Cisco Discovery Protocol (CDP)** packets directly at Layer 2 and displays real-time information such as: Switch Name, Port ID, VLAN ID, IOS Version, Assigned IP (via DHCP)

Just plug in an Ethernet cable — **no laptop, no Wireshark, no setup.**
EtherSnoop instantly shows you which switch and port you’re connected to.

**EtherSnoop**은 **WIZnet W55RP20-EVB-Pico**와 **MicroPython**으로 제작한 초소형 **이더넷 탐지기(Ethernet Discovery Tool)** 입니다.
이 장치는 **Cisco Discovery Protocol (CDP)** 패킷을 실시간으로 감지하여 스위치 이름, 포트 ID, IP 주소 등 OLED 화면에 표시합니다:

이더넷 케이블을 꽂는 것만으로, 해당 포트가 어느 스위치와 연결되어 있는지 바로 확인할 수 있습니다.

#### Core Hardware

| Component | Function |
| --- | --- |
| **W55RP20-EVB-Pico** | Dual-core RP2040 MCU with W5500 Ethernet core. Handles SPI–Ethernet interface and MACRAW packet capture. |
| **SSD1306 OLED (128×64)** | Displays switch info, port, VLAN, IOS version, and DHCP-acquired IP. |
| **MicroPython Firmware** | Controls DHCP, packet capture, CDP parsing, and UI updates. |
| **Custom Font Library (**`**FontDrawer**`** + **`**robotl_m10**`**)** | Provides clean, readable OLED rendering for field use. |

This setup makes EtherSnoop a **self-contained Layer-2 analysis tool** —
no external device or host PC is required.

#### Main Features

1. **Network Initialization**

- WIZnet NIC initialized using `WIZNET_PIO_SPI` and `WIZNET5K` driver

- Promiscuous mode enabled via `enable_macraw(0)`

- DHCP request started automatically; IP displayed upon success

** 2. CDP Packet Capture 3. OLED Display Output 4. Smart Event Handling**

- Detects cable plug/unplug in real time

- Automatically resets DHCP state and reinitializes after reconnection

- Processes only **the first valid CDP packet** per session to prevent flooding

1. **네트워크 초기화**

- `WIZNET_PIO_SPI` + `WIZNET5K` 드라이버로 NIC 활성화

- `enable_macraw(0)` 호출로 **Promiscuous 모드 진입**

- DHCP 자동 요청 → IP 할당 후 OLED 표시

** 2. CDP 패킷 감지 및 파싱**

- MACRAW 모드로 **모든 이더넷 프레임 직접 수신**

- CDP 멀티캐스트 MAC(`01:00:0C:CC:CC:CC`) 필터링

** 3. OLED 실시간 출력 4. 스마트 이벤트 제어**

- 케이블 연결/해제 감지

- 해제 시 DHCP 상태 초기화 후 대기

- 첫 번째 CDP 패킷만 표시 → 불필요한 반복 차단

#### Key Technologies

| Technology | Description |
| --- | --- |
| **MACRAW Mode (WIZnet Feature)** | Captures Layer-2 frames directly from the wire without TCP/IP stack interference. Enables pure Ethernet analysis on embedded hardware. |
| **MicroPython + WIZNET_PIO_SPI** | Fast development using Python syntax with native WIZnet hardware acceleration. |
| **CDP TLV Parsing Logic** | Manual parsing of TLV structure to extract Device-ID, Port-ID, VLAN, and IOS version using regular expressions. |
| **Dynamic OLED Interface** | Real-time visual feedback with status-driven screen updates. |
| **Memory Management via GC** | Regular garbage collection (`gc.collect()`) keeps MicroPython heap stable during long runtime. |

This combination highlights **WIZnet’s MACRAW capability in a Python environment**,
which is rarely showcased in compact embedded tools.

| 기술 | 설명 |
| --- | --- |
| **MACRAW 모드 (WIZnet 전용 기능)** | TCP/IP 스택을 우회하고, 이더넷 프레임을 직접 캡처하는 Layer-2 분석 모드 |
| **MicroPython + WIZNET_PIO_SPI** | 파이썬 코드 기반으로 빠르게 네트워크 제어 및 디버깅 구현 |
| **CDP TLV 파싱 로직** | TLV 구조를 직접 해석해 Device-ID, Port-ID, VLAN, IOS 버전 추출 |
| **정규식 기반 버전 문자열 추출** | `"Version ([\d.]+\([^)]+\)\w*)"` 패턴으로 IOS 버전만 정제 표시 |
| **Garbage Collection 관리** | `gc.collect()` 호출로 장시간 동작 시 메모리 누수 방지 |
| **OLED 상태 피드백 시스템** | “Requesting IP…”, “Please Connect Ethernet…” 등 즉시 피드백 제공 |

이 프로젝트는 **WIZnet의 MACRAW 기능을 MicroPython 환경에서 실시간 분석에 적용한 사례입니다. **

#### Applications & Benefits

| Use Case | Benefit |
| --- | --- |
| **Network Troubleshooting** | Instantly identify switch and port for any Ethernet drop. |
| **Field Diagnostics** | Portable and powered by USB; ideal for data centers and rack environments. |
| **Education / Demo Kits** | Demonstrates how MACRAW and CDP work at the packet level. |
| **IoT Network Mapping** | Basis for automated topology discovery or LLDP integration. |

| 적용 분야 | 주요 이점 |
| --- | --- |
| **네트워크 유지보수 / 트러블슈팅** | 연결된 스위치와 포트를 즉시 식별 가능 |
| **현장 점검 및 배선 테스트** | 휴대형 장비로 랙이나 배선실에서 빠른 진단 가능 |
| **교육 / 실습용 키트** | CDP, DHCP, MACRAW 등 네트워크 기본 개념 학습에 적합 |
| **IoT 네트워크 자동 맵핑** | LLDP 확장 시 다양한 네트워크 토폴로지 파악에 활용 가능 |

연결된 스위치와 포트를 즉시 식별 가능하다는 점에서 네트워크 유지보수와 트러블 슈팅 작업을 효율적으로 수행할수있고, CDP, DHCP, MACRAW 등 네트워크 기본 개념을 직접 시각화하고 이해할 수 있어,
교육·실습용 프로젝트로도 높은 가치와 의미를 지닙니다.

---

Source: https://maker.wiznet.io/Hannah/projects/ethersnoop/
