Skip to main content

BLE testing toolkit built on Bumble with interactive menu, GATT ops, and HCI capture

Project description

Bumble BLE Testing Framework

A comprehensive BLE (Bluetooth Low Energy) testing toolkit built on the Bumble Bluetooth stack

Features:

  • ๐Ÿ” Interactive menu-driven interface
  • ๐Ÿ“ก BLE scanning and device discovery
  • ๐Ÿ”— GATT operations (read/write/notify)
  • ๐Ÿ” Pairing and persistent bonding
  • ๐Ÿ“Š Live HCI packet capture (Ellisys + BTSnoop)
  • ๐Ÿ Python API for automation

๐Ÿš€ Start Guide

Choose one workflow:

Option A: Install from Package/Release (Fastest)

If you install the package (for example pip install HCIEMU), these commands are available:

Install method recommendation:

  • Use pip inside a virtual environment for project development and reproducible dependencies.
  • Use pipx for global command-line usage (HCI, BRIDGE) without polluting system Python.

Examples:

# Inside an active venv
pip install HCIEMU

# Global CLI install (isolated)
pipx install HCIEMU
  • HCI - Launch the interactive menu app.
  • BRIDGE - Launch bridge with defaults (usb:0 -> tcp-server:127.0.0.1:9001).
  • BRIDGE <source> <target> - Launch bridge with custom endpoints.
  • hciemu - Alias of HCI.
  • bumble-hci-menu - Alias of HCI.

Windows example:

# Terminal 1
BRIDGE

# Terminal 2
HCI

Custom bridge example:

BRIDGE serial:COM5,115200 tcp-server:127.0.0.1:9001

Option B: Clone the Repository (Development/Source Mode)

git clone <repository-url>
cd bumble_hci

Windows quick run:

setup.bat
BRIDGE.bat
HCI.bat

Source-mode commands also work directly:

python src/main.py
bumble-hci-bridge usb:0 tcp-server:127.0.0.1:9001

Linux/macOS setup details: SETUP.md


๐Ÿ“– Documentation

For Users:

For Developers:

Setup & Contributing:


๐Ÿ“ Project Structure

bumble_hci/
โ”œโ”€โ”€ ๐Ÿ“‹ README.md              โ† You are here
โ”œโ”€โ”€ ๐Ÿ“‹ requirements.txt       โ† Python dependencies
โ”œโ”€โ”€ ๐Ÿ“‹ setup.py               โ† Package configuration
โ”œโ”€โ”€ ๐Ÿ”ง setup.bat              โ† First-time setup (Windows)
โ”œโ”€โ”€ ๐Ÿ”ง run.bat                โ† Run application (Windows)
โ”‚
โ”œโ”€โ”€ ๐Ÿ“‚ src/                   โ† Application source code
โ”‚   โ”œโ”€โ”€ main.py               โ† Main interactive menu
โ”‚   โ”œโ”€โ”€ connector.py          โ† BLE operations
โ”‚   โ”œโ”€โ”€ scanner.py            โ† Device scanning
โ”‚   โ”œโ”€โ”€ hci_snooper.py        โ† HCI packet capture
โ”‚   โ””โ”€โ”€ utils.py              โ† Utilities
โ”‚
โ”œโ”€โ”€ ๐Ÿ“‚ docs/                  โ† Documentation
โ”‚   โ”œโ”€โ”€ USER_MANUAL.md        โ† User guide (START HERE!)
โ”‚   โ”œโ”€โ”€ TECHNICAL_REFERENCE.md โ† Developer guide
โ”‚   โ””โ”€โ”€ development/          โ† Historical dev docs
โ”‚
โ”œโ”€โ”€ ๐Ÿ“‚ examples/              โ† Code examples
โ”‚   โ”œโ”€โ”€ basic_connection.py
โ”‚   โ”œโ”€โ”€ scan_devices.py
โ”‚   โ””โ”€โ”€ hci_capture.py
โ”‚
โ”œโ”€โ”€ ๐Ÿ“‚ tests/                 โ† Test suite
โ”œโ”€โ”€ ๐Ÿ“‚ scripts/               โ† Utility scripts
โ”œโ”€โ”€ ๐Ÿ“‚ configs/               โ† Configuration files
โ”‚   โ””โ”€โ”€ bumble_bonds.json     โ† Persistent bonds
โ”œโ”€โ”€ ๐Ÿ“‚ logs/                  โ† HCI captures & logs
โ””โ”€โ”€ ๐Ÿ“‚ resources/             โ† UUID lookups, configs


๐ŸŽฏ Key Features

BLE Operations

  • Scan - Discover nearby BLE devices with RSSI
  • Connect - Establish connections to BLE peripherals
  • GATT - Browse services, read/write characteristics
  • Notify - Subscribe to characteristic notifications

Apple Services

  • ANCS - Apple Notification Center Service: receive and act on iOS notifications
  • AMS - Apple Media Service: monitor and control iOS media playback

Security & Bonding

  • Pairing - Support for multiple pairing methods
  • Bonding - Persistent bond storage (survives restart)
  • Encryption - Manual encryption control
  • SMP Security Request - Initiate security from the peripheral side

HCI Packet Capture

  • Live Capture - Real-time HCI packet streaming
  • Ellisys Integration - UDP injection for Ellisys Bluetooth Analyzer
  • BTSnoop Format - Standard .log/.btsnoop file output
  • Protocol Analysis - Decode and analyze BLE protocol

Developer Tools

  • Python API - Programmatic access to all features
  • Examples - Ready-to-use code samples
  • Rich UI - Colorful terminal interface with tables

๐Ÿ’ก Usage Examples

Interactive Menu

python src/main.py
โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•
  BUMBLE BLE Testing - Main Menu
โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•

  [1] Scan for BLE Devices
  [2] Connect to Device
  [3] Disconnect

  --- ATT / GATT (21-40) ---
  [21] Discover GATT Services
  [22] Read Characteristic
  [23] Write Characteristic
  [35] Apple Services (ANCS / AMS)

  --- SMP (41-50) ---
  [41] Pair / Encrypt Connection
  [42] Send SMP Security Request
  [43] SMP Settings
  [44] Unpair / Delete Bonding

  --- Advertising (51-60) ---
  [51] Advertising Menu

  --- L2CAP (61-80) ---
  [61] L2CAP Operations (CBFC/ECBFC)

Programmatic Usage

See examples/ for complete code samples:

from connector import BLEConnector

# Scan for devices
connector = BLEConnector("tcp-client:127.0.0.1:9001")
devices = await connector.scan(duration=10)

# Connect and read
await connector.connect("AA:BB:CC:DD:EE:FF")
value = await connector.read_characteristic(0x0012)

๐Ÿ› ๏ธ Requirements

  • Python 3.8+
  • Bluetooth USB adapter (or built-in Bluetooth)
  • USB driver: WinUSB (Windows - via Zadig)
  • Bumble - Installed via pip install bumble

See SETUP.md for complete requirements and installation.


๐Ÿ“ฆ Installation

Quick Install (Windows)

# Clone repository
git clone <repository-url>
cd bumble_hci

# Run setup
setup.bat

Manual Install (Any Platform)

# Create virtual environment
python -m venv venv
source venv/bin/activate  # Linux/macOS
# or
venv\Scripts\activate.ps1  # Windows

# Install dependencies
pip install -r requirements.txt

Full instructions: SETUP.md


๐Ÿ”ง Configuration

HCI Transport

Default: tcp-client:127.0.0.1:9001

Requires bumble-hci-bridge running:

bumble-hci-bridge usb:0 tcp-server:127.0.0.1:9001

Bond Storage

Bonds saved to: configs/bumble_bonds.json

HCI Capture

Files saved to: logs/hci_capture.log (BTSnoop format)
Ellisys: UDP port 24352


๐Ÿงช Testing

# Run all tests
python -m pytest tests/

# Run specific test
python tests/test_connection.py
python tests/test_ellisys_udp.py

# Check bonding status
python scripts/check_bonding.py

๐Ÿ“š Learn More

Documentation:

Guides:

Examples:


๐Ÿค Contributing

Contributions welcome! See CONTRIBUTING.md


๐Ÿ“„ License

MIT License - see LICENSE


๐Ÿ™ Acknowledgments

Built with Bumble - A Python Bluetooth stack by Google


Questions? Check the FAQ or open an issue.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

hciemu-1.2.0.tar.gz (92.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

hciemu-1.2.0-py3-none-any.whl (92.7 kB view details)

Uploaded Python 3

File details

Details for the file hciemu-1.2.0.tar.gz.

File metadata

  • Download URL: hciemu-1.2.0.tar.gz
  • Upload date:
  • Size: 92.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for hciemu-1.2.0.tar.gz
Algorithm Hash digest
SHA256 810aae1f55886108f1dd5817f42496308d64109631d07f61ae9f2a3c1726bdc9
MD5 96029b8aa46b0b72d7c3e61330438603
BLAKE2b-256 e1a5c41b40115c9840f82036afb15cc30f0a222ddefc792dda6b6c3584f692ca

See more details on using hashes here.

Provenance

The following attestation bundles were made for hciemu-1.2.0.tar.gz:

Publisher: publish.yml on demoham-x/hci_emu

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file hciemu-1.2.0-py3-none-any.whl.

File metadata

  • Download URL: hciemu-1.2.0-py3-none-any.whl
  • Upload date:
  • Size: 92.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for hciemu-1.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 22ea35dbdfc1adf169fb61bdece1b3dc22cf1b518929be6c4dd65ed7abb0f6ed
MD5 1add199a3842f4819bdee8ad9a2dad67
BLAKE2b-256 8a510bd968d138d4b40605837adc98626ccbee40b2c30c83d0997c399899c068

See more details on using hashes here.

Provenance

The following attestation bundles were made for hciemu-1.2.0-py3-none-any.whl:

Publisher: publish.yml on demoham-x/hci_emu

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page