Notifications
Clear all
Topic starter 16/08/2025 11:14 pm
Here’s a breakdown of what GattTool is and how it’s used:
🧠 What Is GattTool?
GattTool is a command-line utility used to interact with Bluetooth Low Energy (BLE) devices via the Generic Attribute Profile (GATT). It’s part of the BlueZ stack, which is the official Linux Bluetooth protocol stack.
- GATT (Generic Attribute Profile) defines how BLE devices exchange data using concepts like services and characteristics.
- GattTool lets you connect to BLE devices, discover their services, and read/write data from their characteristics.
🛠️ Key Features of GattTool
- Interactive Mode: Launch with
gatttool -I
to enter a REPL-like environment where you can issue commands. - Non-Interactive Mode: Run single commands directly from the terminal for scripting or automation.
- Service Discovery: Use commands like
primary
to list available services. - Characteristic Access: Use
characteristics
to list readable/writable attributes. - Read/Write Operations: Read sensor data or send commands to BLE devices.
🧪 Example Workflow
-
Scan for BLE Devices:
hcitool lescan
This gives you the MAC address of nearby BLE devices.
-
Connect to a Device:
gatttool -b XX:XX:XX:XX:XX:XX -I
Replace
XX:XX:XX:XX:XX:XX
with your device’s MAC address. -
Discover Services:
[LE]> connect [LE]> primary
-
Read a Characteristic:
[LE]> char-read-hnd 0x0025
-
Write to a Characteristic:
[LE]> char-write-req 0x0029 01
📦 Installation
GattTool is included in the BlueZ package, which is typically available on Linux systems. You may need to compile BlueZ manually if you’re using a custom setup like Intel Edison.
🔍 Use Cases
- Reading sensor data from BLE-enabled devices (e.g., temperature, heart rate).
- Controlling smart devices like bulbs or wearables.
- Reverse engineering BLE protocols for security research.