A BLE privacy scanner for M5Stack devices
GhostBLE discovers nearby Bluetooth Low Energy devices, analyzes their privacy posture, and flags potential security concerns. Built for security researchers, tinkerers, and educators interested in BLE privacy, device fingerprinting, and wireless reconnaissance.
A friendly mascot named NibBLEs guides you through the scanning process on the built-in display.
Warning
GhostBLE is intended for legal and authorized security testing, education, and privacy research only. Use of this software for any malicious or unauthorized activities is strictly prohibited. The developers assume no liability for misuse. Use at your own risk.
- Flash the firmware (see Building & Flashing)
- Insert a microSD card (required on Cardputer for logging and XP)
- Power on — NibBLEs greets you on the display
- Long press BtnA (1 second) to start scanning
- Watch devices appear on the display and in the logs
| Device | Platform | Display | Keyboard | SD Card |
|---|---|---|---|---|
| M5Stack Cardputer | ESP32-S3 | 240x135 LCD | Yes | Yes |
| M5StickC Plus 2 | ESP32 | 240x135 LCD | No (2 buttons) | No |
| M5StickS3 | ESP32-S3 | 128x128 LCD | No (2 buttons) | No |
All devices support BLE scanning, GATT connections, GPS wardriving, WiFi dashboard, and PwnBeacon. The Cardputer adds keyboard controls, SD card logging, XP persistence, and screenshot capture.
- Passive BLE scanning — discovers nearby devices with signal strength (RSSI) and estimated distance
- Device info extraction — retrieves names, service UUIDs, and manufacturer-specific data
- GATT connections — connects to devices and reads standard BLE services (Device Info, Battery, Heart Rate, Temperature, Generic Access, Current Time, TX Power, Immediate Alert, Link Loss)
- Rotating MAC detection — flags devices using Resolvable Private Addresses (RPA)
- Cleartext detection — flags devices leaking unencrypted identifiers
- Exposure classification — rates devices into tiers (None, Passive, Active, Consent) with a privacy score
- Detects writable characteristics (potential for unauthorized writes)
- Identifies DFU and UART services (expanded attack surface)
- Checks for encryption on sensitive services
- Builds device fingerprints from advertised UUIDs and GATT profiles
- Flipper Zero — detected by known service UUIDs (black, white, transparent variants)
- CatHack / Apple Juice — BLE spam tool detection
- Tesla — detected via iBeacon UUID, GATT service, and name pattern matching
- LightBlue — app-based BLE testing tool
- PwnBeacon / Pwnagotchi — detects and reads PwnGrid beacons (identity, face, pwnd counters, messages)
GhostBLE acts as both a PwnBeacon client (scanner) and server (advertiser), compatible with PwnBook and Palnagotchi:
- Advertises as a PwnBeacon with SHA-256 fingerprint, identity JSON, face, and device name
- Detects nearby PwnBeacon peers via advertisement service data
- Reads full peer info via GATT (identity, face, name, message)
- Signal/ping characteristic for peer interaction
- Pwnd counters update dynamically during scanning
Decodes manufacturer data for Apple, Google, Samsung, Epson, and more. Also parses iBeacon advertisements (UUID, major, minor, TX power, distance).
- Dual GPS support — Grove UART and LoRa cap GPS (Cardputer only for LoRa)
- WiGLE CSV export — log devices with location for mapping and analysis
All findings are logged to multiple channels simultaneously:
| Channel | Details |
|---|---|
| Serial | 115200 baud, structured output |
| SD card | Per-category log files (Cardputer only) |
| Web dashboard | Real-time via WiFi AP and WebSocket |
Logs are organized into categories: Scan, GATT, Privacy, Security, Beacon, Control, GPS, System, Target, and Notify. Each device gets a session ID for cross-log correlation.
GhostBLE gamifies the scanning process with experience points:
| Event | XP |
|---|---|
| Device discovered | +0.1 |
| GATT connection success | +0.5 |
| Characteristic subscription | +1.0 |
| PwnBeacon detected | +1.0 |
| UINT/FLOAT payload decoded | +1.0 |
| Notify data received | +1.5 |
| Manufacturer data decoded | +2.0 |
| Suspicious device found | +2.0 |
| Known characteristic decoded | +2.5 |
| iBeacon parsed | +3.0 |
XP is persisted to the SD card (Cardputer) and shown on the display with level progression.
NibBLEs is the on-screen mascot with context-sensitive expressions and speech bubbles:
- Expressions — happy, sad, angry, glasses (detective), thug life, sleeping, hearts, and more
- Speech bubbles — context-aware messages for idle, scan start, wardriving, suspicious finds, and level-ups
- Screenshot capture — press ENTER on Cardputer to save the current display to SD
| Key | Action |
|---|---|
| Long press BtnA (1s) | Toggle BLE scanning on/off |
| ENTER | Capture screenshot to SD card |
| FN | Toggle WiFi AP and web server |
| TAB | Toggle wardriving mode |
| DEL | Switch GPS source (Grove / LoRa) |
| H | Help Control |
| Button | Action |
|---|---|
| BtnA short press | Toggle WiFi AP and web server |
| BtnA long press (1s) | Toggle BLE scanning on/off |
| BtnB short press | Toggle wardriving mode |
| BtnB long press (1s) | Switch GPS source |
- Enable WiFi (press FN on Cardputer or BtnA on StickC/StickS3)
- Connect to WiFi AP
GhostBLE(password:ghostble123!) - Open
192.168.4.1in a browser - View real-time device discovery logs via WebSocket
# Cardputer
pio run -e ghostble -t upload
# M5StickC Plus 2
pio run -e ghostble-stickcplus2 -t upload
# M5StickS3
pio run -e ghostble-sticks3 -t upload- Install the M5Stack board package via Board Manager
- Select the appropriate board for your device
- Install the required libraries via Library Manager:
M5Cardputer/M5StickCPlus2/M5Unified— hardware abstraction (depends on device)NimBLE-Arduino— BLE stackESPAsyncWebServer,AsyncTCP— web dashboardTinyGPSPlus— GPS parsing
- Open
GhostBLE.ino, compile, and upload
<NoName> MAC: d3:c9:9d:fa:d9:9a | Rotating: Yes | Cleartext: Yes
Trying to connect to address: d3:c9:9d:fa:d9:9a
Attribute discovery failed: d3:c9:9d:fa:d9:9a
Scan Summary:
- Spotted: 4
- Sniffed: 2
- Suspicious: 0
GhostBLE/
├── GhostBLE.ino # Main sketch (setup, loop, WiFi, controls)
├── platformio.ini # PlatformIO build configuration
├── boards/ # Custom board definitions (Cardputer, StickC+2, StickS3)
└── src/
├── GATTServices/ # BLE service readers (9 standard + PwnBeacon)
├── analyzer/ # Exposure analysis & security scoring
├── config/ # Hardware config, known device UUIDs
├── globals/ # Shared state variables
├── gps/ # GPS manager (Grove + LoRa cap)
├── helper/ # BLE decoders, manufacturer lookup, UI, speech bubbles
├── images/ # Sprite assets for NibBLEs mascot
├── logger/ # Unified multi-target logging
├── models/ # Data structures (DeviceInfo)
├── privacyCheck/ # MAC type detection, cleartext analysis
├── scanner/ # Core BLE scanning and GATT operations
├── target/ # Known device detection (Flipper, Tesla, PwnBeacon)
├── wardriving/ # WiGLE CSV export
└── xp/ # Experience points system
PRs and suggestions welcome! This is a learning-focused BLE project, and your ideas are appreciated.
MIT License