<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://elvis.hcw.ac.at/wiki/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=AMaksimovic</id>
	<title>Elvis Wiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://elvis.hcw.ac.at/wiki/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=AMaksimovic"/>
	<link rel="alternate" type="text/html" href="https://elvis.hcw.ac.at/wiki/index.php/Special:Contributions/AMaksimovic"/>
	<updated>2026-09-10T13:02:50Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.41.5</generator>
	<entry>
		<id>https://elvis.hcw.ac.at/wiki/index.php?title=B-LE_-_GATT_Architectural_Overview&amp;diff=16745</id>
		<title>B-LE - GATT Architectural Overview</title>
		<link rel="alternate" type="text/html" href="https://elvis.hcw.ac.at/wiki/index.php?title=B-LE_-_GATT_Architectural_Overview&amp;diff=16745"/>
		<updated>2024-12-05T16:16:16Z</updated>

		<summary type="html">&lt;p&gt;AMaksimovic: /* Example UUIDs of a Polar Smartwatch */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Description =&lt;br /&gt;
&lt;br /&gt;
This article goes into detail about GATT architectural features and its usage in Bluetooth LE Security designs. The research for this article was initiated during writing the paper on hacking a bluetooth smartwatch. There is an entire documentation on the practical experiment in [[Setting Up Ubertooth on macOS for Bluetooth Hacking]]. The network topology of a B-LE GATT network contains so-called central devices and peripheral devices. One peripheral is only connected to only one central device at a time. A central device can connect to many peripheral devices. The peripheral is also acting as the GATT server. It contains the definitions for profiles, services and characteristics of a device. The central device always initiates the data exchange.&lt;br /&gt;
&lt;br /&gt;
= B-LE GATT Overview =&lt;br /&gt;
&lt;br /&gt;
== GAP - Generic Attribute Profile ==&lt;br /&gt;
&lt;br /&gt;
The Generic attribute profile takes care of discovery, security, connectivity and network technolgies of a device as well as it&#039;s role. These are examples of packages during pairing:&lt;br /&gt;
&lt;br /&gt;
 ADV_IND&lt;br /&gt;
 SCAN_REQ&lt;br /&gt;
 SCAN_RSP&lt;br /&gt;
 CONNECT_IND&lt;br /&gt;
 AUX_SCAN_REQ&lt;br /&gt;
 AUX_SCAN_RSP&lt;br /&gt;
 AUX_CONNECT_REQ&lt;br /&gt;
 AUX_CONNECT_RSP&lt;br /&gt;
 ADV_SCAN_IND&lt;br /&gt;
&lt;br /&gt;
== GATT - Generic Attribute Profile ==&lt;br /&gt;
&lt;br /&gt;
As soon as two Bluetooth Low Energy devices establish a connection they can start transfering data back and forth. This data is formated into Services and Characteristics in a Server/Client relationship.&lt;br /&gt;
&lt;br /&gt;
=== ATT - Attribute Protocol ===&lt;br /&gt;
&lt;br /&gt;
GATT is based on ATT. Each attribute gets it’s own Unique Identifier (UUID) here. It takes care of the data exchange and error handling. These get categorized as characteristics and services with GATT.&lt;br /&gt;
&lt;br /&gt;
=== Profiles ===&lt;br /&gt;
&lt;br /&gt;
Each profile has a set of services according to its profile type. Example profiles are Basic audio profiles, Location and navigation profiles, weight scale profile, heart rate profile, etc...&lt;br /&gt;
&lt;br /&gt;
=== Services ===&lt;br /&gt;
&lt;br /&gt;
A Service can have multiple characteristics. It has it’s own UUID. It has a handle. UUID, permissions and a value.&lt;br /&gt;
&lt;br /&gt;
Example services are [[https://www.bluetooth.com/specifications/assigned-numbers/ Bluetooth Specifications]]:&lt;br /&gt;
&lt;br /&gt;
 Alert Notification Service 0x1811&lt;br /&gt;
 Audio Input Control Service 0x1843&lt;br /&gt;
 Authorization Control Service 0x183D&lt;br /&gt;
 Battery Service 0x180F&lt;br /&gt;
 Binary Sensor Service 0x183B&lt;br /&gt;
 Blood Pressure Service 0x1810&lt;br /&gt;
 Broadcast Audio Scan Service 0x184F&lt;br /&gt;
 Common Audio Service 0x1853&lt;br /&gt;
&lt;br /&gt;
=== Characteristics ===&lt;br /&gt;
&lt;br /&gt;
The characteristics are the lowest-level of the GATT Profiles. They also each use their own UUID.&lt;br /&gt;
These are relevant when it comes to protecting and enhancing security of a Bluetooth Low Energy device.&lt;br /&gt;
The characteristics have a value, properties and human-readable descriptors.&lt;br /&gt;
&lt;br /&gt;
== Example UUIDs of a Polar Smartwatch ==&lt;br /&gt;
&lt;br /&gt;
These captures are from: [[Setting Up Ubertooth on macOS for Bluetooth Hacking]]&lt;br /&gt;
&lt;br /&gt;
Example Device UUID:&lt;br /&gt;
 &lt;br /&gt;
 C6C36C4A-7F8F-52B2-2BD7-C4F6690424E7&lt;br /&gt;
&lt;br /&gt;
Example Service UUIDs:&lt;br /&gt;
&lt;br /&gt;
 Service: 0000180a-0000-1000-8000-00805f9b34fb (Handle: 14): Device Information&lt;br /&gt;
 Service: 0000feee-0000-1000-8000-00805f9b34fb (Handle: 29): Polar Electro Oy&lt;br /&gt;
 Service: 0000180d-0000-1000-8000-00805f9b34fb (Handle: 38): Heart Rate&lt;br /&gt;
 Service: 0000180f-0000-1000-8000-00805f9b34fb (Handle: 42): Battery Service&lt;br /&gt;
&lt;br /&gt;
Example service and their characteristics UUIDs including handles, permissions, properties, values, descriptors:&lt;br /&gt;
&lt;br /&gt;
 Service: 0000180a-0000-1000-8000-00805f9b34fb (Handle: 14): Device Information&lt;br /&gt;
  Characteristic: 00002a29-0000-1000-8000-00805f9b34fb (Handle: 15) - Properties: [&#039;read&#039;]&lt;br /&gt;
  Characteristic: 00002a24-0000-1000-8000-00805f9b34fb (Handle: 17) - Properties: [&#039;read&#039;]&lt;br /&gt;
  Characteristic: 00002a25-0000-1000-8000-00805f9b34fb (Handle: 19) - Properties: [&#039;read&#039;]&lt;br /&gt;
  Characteristic: 00002a27-0000-1000-8000-00805f9b34fb (Handle: 21) - Properties: [&#039;read&#039;]&lt;br /&gt;
  Characteristic: 00002a26-0000-1000-8000-00805f9b34fb (Handle: 23) - Properties: [&#039;read&#039;]&lt;br /&gt;
  Characteristic: 00002a28-0000-1000-8000-00805f9b34fb (Handle: 25) - Properties: [&#039;read&#039;]&lt;br /&gt;
  Characteristic: 00002a23-0000-1000-8000-00805f9b34fb (Handle: 27) - Properties: [&#039;read&#039;]&lt;br /&gt;
 Service: 0000feee-0000-1000-8000-00805f9b34fb (Handle: 29): Polar Electro Oy&lt;br /&gt;
  Characteristic: fb005c51-02e7-f387-1cad-8acd2d8df0c8 (Handle: 30) - Properties: [&#039;write-without-response&#039;, &#039;write&#039;, &#039;notify&#039;]&lt;br /&gt;
  Characteristic: fb005c52-02e7-f387-1cad-8acd2d8df0c8 (Handle: 33) - Properties: [&#039;notify&#039;]&lt;br /&gt;
  Characteristic: fb005c53-02e7-f387-1cad-8acd2d8df0c8 (Handle: 36) - Properties: [&#039;write-without-response&#039;, &#039;write&#039;]&lt;br /&gt;
 Service: 0000180d-0000-1000-8000-00805f9b34fb (Handle: 38): Heart Rate&lt;br /&gt;
  Characteristic: 00002a37-0000-1000-8000-00805f9b34fb (Handle: 39) - Properties: [&#039;notify&#039;]&lt;br /&gt;
 Service: 0000180f-0000-1000-8000-00805f9b34fb (Handle: 42): Battery Service&lt;br /&gt;
  Characteristic: 00002a19-0000-1000-8000-00805f9b34fb (Handle: 43) - Properties: [&#039;read&#039;, &#039;notify&#039;]&lt;br /&gt;
&lt;br /&gt;
== BLE Operations ==&lt;br /&gt;
&lt;br /&gt;
Based on the characteristic&#039;s properties these operations can be executed on the target devices characteristics:&lt;br /&gt;
&lt;br /&gt;
* Read = Read the data of a characteristic&lt;br /&gt;
&lt;br /&gt;
* Write = Write data to a characteristic&lt;br /&gt;
&lt;br /&gt;
* Notify = Get notifications to value changes of a device by subscribing to it&lt;br /&gt;
&lt;br /&gt;
= Further Context =&lt;br /&gt;
&lt;br /&gt;
For further context and practical examples make sure to read:&lt;br /&gt;
&lt;br /&gt;
* Setting Up Ubertooth on macOS for Bluetooth Hacking [https://wiki.elvis.science/index.php?title=Setting_Up_Ubertooth_on_macOS_for_Bluetooth_Hacking]&lt;br /&gt;
&lt;br /&gt;
= Courses =&lt;br /&gt;
&lt;br /&gt;
* [[Selected IT-Security Chapters]] (2024)&lt;br /&gt;
&lt;br /&gt;
= Author =&lt;br /&gt;
Are Maksimović&lt;br /&gt;
&lt;br /&gt;
= References =&lt;br /&gt;
&lt;br /&gt;
* https://bleak.readthedocs.io/en/latest/usage.html&lt;br /&gt;
* https://www.bluetooth.com/de/bluetooth-resources/intro-to-bluetooth-gap-gatt/&lt;br /&gt;
* https://www.bluetooth.com/specifications/assigned-numbers/&lt;br /&gt;
[[Category:Documentation]]&lt;/div&gt;</summary>
		<author><name>AMaksimovic</name></author>
	</entry>
	<entry>
		<id>https://elvis.hcw.ac.at/wiki/index.php?title=B-LE_-_GATT_Architectural_Overview&amp;diff=16744</id>
		<title>B-LE - GATT Architectural Overview</title>
		<link rel="alternate" type="text/html" href="https://elvis.hcw.ac.at/wiki/index.php?title=B-LE_-_GATT_Architectural_Overview&amp;diff=16744"/>
		<updated>2024-12-05T16:14:44Z</updated>

		<summary type="html">&lt;p&gt;AMaksimovic: /* References */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Description =&lt;br /&gt;
&lt;br /&gt;
This article goes into detail about GATT architectural features and its usage in Bluetooth LE Security designs. The research for this article was initiated during writing the paper on hacking a bluetooth smartwatch. There is an entire documentation on the practical experiment in [[Setting Up Ubertooth on macOS for Bluetooth Hacking]]. The network topology of a B-LE GATT network contains so-called central devices and peripheral devices. One peripheral is only connected to only one central device at a time. A central device can connect to many peripheral devices. The peripheral is also acting as the GATT server. It contains the definitions for profiles, services and characteristics of a device. The central device always initiates the data exchange.&lt;br /&gt;
&lt;br /&gt;
= B-LE GATT Overview =&lt;br /&gt;
&lt;br /&gt;
== GAP - Generic Attribute Profile ==&lt;br /&gt;
&lt;br /&gt;
The Generic attribute profile takes care of discovery, security, connectivity and network technolgies of a device as well as it&#039;s role. These are examples of packages during pairing:&lt;br /&gt;
&lt;br /&gt;
 ADV_IND&lt;br /&gt;
 SCAN_REQ&lt;br /&gt;
 SCAN_RSP&lt;br /&gt;
 CONNECT_IND&lt;br /&gt;
 AUX_SCAN_REQ&lt;br /&gt;
 AUX_SCAN_RSP&lt;br /&gt;
 AUX_CONNECT_REQ&lt;br /&gt;
 AUX_CONNECT_RSP&lt;br /&gt;
 ADV_SCAN_IND&lt;br /&gt;
&lt;br /&gt;
== GATT - Generic Attribute Profile ==&lt;br /&gt;
&lt;br /&gt;
As soon as two Bluetooth Low Energy devices establish a connection they can start transfering data back and forth. This data is formated into Services and Characteristics in a Server/Client relationship.&lt;br /&gt;
&lt;br /&gt;
=== ATT - Attribute Protocol ===&lt;br /&gt;
&lt;br /&gt;
GATT is based on ATT. Each attribute gets it’s own Unique Identifier (UUID) here. It takes care of the data exchange and error handling. These get categorized as characteristics and services with GATT.&lt;br /&gt;
&lt;br /&gt;
=== Profiles ===&lt;br /&gt;
&lt;br /&gt;
Each profile has a set of services according to its profile type. Example profiles are Basic audio profiles, Location and navigation profiles, weight scale profile, heart rate profile, etc...&lt;br /&gt;
&lt;br /&gt;
=== Services ===&lt;br /&gt;
&lt;br /&gt;
A Service can have multiple characteristics. It has it’s own UUID. It has a handle. UUID, permissions and a value.&lt;br /&gt;
&lt;br /&gt;
Example services are [[https://www.bluetooth.com/specifications/assigned-numbers/ Bluetooth Specifications]]:&lt;br /&gt;
&lt;br /&gt;
 Alert Notification Service 0x1811&lt;br /&gt;
 Audio Input Control Service 0x1843&lt;br /&gt;
 Authorization Control Service 0x183D&lt;br /&gt;
 Battery Service 0x180F&lt;br /&gt;
 Binary Sensor Service 0x183B&lt;br /&gt;
 Blood Pressure Service 0x1810&lt;br /&gt;
 Broadcast Audio Scan Service 0x184F&lt;br /&gt;
 Common Audio Service 0x1853&lt;br /&gt;
&lt;br /&gt;
=== Characteristics ===&lt;br /&gt;
&lt;br /&gt;
The characteristics are the lowest-level of the GATT Profiles. They also each use their own UUID.&lt;br /&gt;
These are relevant when it comes to protecting and enhancing security of a Bluetooth Low Energy device.&lt;br /&gt;
The characteristics have a value, properties and human-readable descriptors.&lt;br /&gt;
&lt;br /&gt;
== Example UUIDs of a Polar Smartwatch ==&lt;br /&gt;
&lt;br /&gt;
Example Device UUID:&lt;br /&gt;
 &lt;br /&gt;
 C6C36C4A-7F8F-52B2-2BD7-C4F6690424E7&lt;br /&gt;
&lt;br /&gt;
Example Service UUIDs:&lt;br /&gt;
&lt;br /&gt;
 Service: 0000180a-0000-1000-8000-00805f9b34fb (Handle: 14): Device Information&lt;br /&gt;
 Service: 0000feee-0000-1000-8000-00805f9b34fb (Handle: 29): Polar Electro Oy&lt;br /&gt;
 Service: 0000180d-0000-1000-8000-00805f9b34fb (Handle: 38): Heart Rate&lt;br /&gt;
 Service: 0000180f-0000-1000-8000-00805f9b34fb (Handle: 42): Battery Service&lt;br /&gt;
&lt;br /&gt;
Example service and their characteristics UUIDs including handles, permissions, properties, values, descriptors:&lt;br /&gt;
&lt;br /&gt;
 Service: 0000180a-0000-1000-8000-00805f9b34fb (Handle: 14): Device Information&lt;br /&gt;
  Characteristic: 00002a29-0000-1000-8000-00805f9b34fb (Handle: 15) - Properties: [&#039;read&#039;]&lt;br /&gt;
  Characteristic: 00002a24-0000-1000-8000-00805f9b34fb (Handle: 17) - Properties: [&#039;read&#039;]&lt;br /&gt;
  Characteristic: 00002a25-0000-1000-8000-00805f9b34fb (Handle: 19) - Properties: [&#039;read&#039;]&lt;br /&gt;
  Characteristic: 00002a27-0000-1000-8000-00805f9b34fb (Handle: 21) - Properties: [&#039;read&#039;]&lt;br /&gt;
  Characteristic: 00002a26-0000-1000-8000-00805f9b34fb (Handle: 23) - Properties: [&#039;read&#039;]&lt;br /&gt;
  Characteristic: 00002a28-0000-1000-8000-00805f9b34fb (Handle: 25) - Properties: [&#039;read&#039;]&lt;br /&gt;
  Characteristic: 00002a23-0000-1000-8000-00805f9b34fb (Handle: 27) - Properties: [&#039;read&#039;]&lt;br /&gt;
 Service: 0000feee-0000-1000-8000-00805f9b34fb (Handle: 29): Polar Electro Oy&lt;br /&gt;
  Characteristic: fb005c51-02e7-f387-1cad-8acd2d8df0c8 (Handle: 30) - Properties: [&#039;write-without-response&#039;, &#039;write&#039;, &#039;notify&#039;]&lt;br /&gt;
  Characteristic: fb005c52-02e7-f387-1cad-8acd2d8df0c8 (Handle: 33) - Properties: [&#039;notify&#039;]&lt;br /&gt;
  Characteristic: fb005c53-02e7-f387-1cad-8acd2d8df0c8 (Handle: 36) - Properties: [&#039;write-without-response&#039;, &#039;write&#039;]&lt;br /&gt;
 Service: 0000180d-0000-1000-8000-00805f9b34fb (Handle: 38): Heart Rate&lt;br /&gt;
  Characteristic: 00002a37-0000-1000-8000-00805f9b34fb (Handle: 39) - Properties: [&#039;notify&#039;]&lt;br /&gt;
 Service: 0000180f-0000-1000-8000-00805f9b34fb (Handle: 42): Battery Service&lt;br /&gt;
  Characteristic: 00002a19-0000-1000-8000-00805f9b34fb (Handle: 43) - Properties: [&#039;read&#039;, &#039;notify&#039;]&lt;br /&gt;
&lt;br /&gt;
== BLE Operations ==&lt;br /&gt;
&lt;br /&gt;
Based on the characteristic&#039;s properties these operations can be executed on the target devices characteristics:&lt;br /&gt;
&lt;br /&gt;
* Read = Read the data of a characteristic&lt;br /&gt;
&lt;br /&gt;
* Write = Write data to a characteristic&lt;br /&gt;
&lt;br /&gt;
* Notify = Get notifications to value changes of a device by subscribing to it&lt;br /&gt;
&lt;br /&gt;
= Further Context =&lt;br /&gt;
&lt;br /&gt;
For further context and practical examples make sure to read:&lt;br /&gt;
&lt;br /&gt;
* Setting Up Ubertooth on macOS for Bluetooth Hacking [https://wiki.elvis.science/index.php?title=Setting_Up_Ubertooth_on_macOS_for_Bluetooth_Hacking]&lt;br /&gt;
&lt;br /&gt;
= Courses =&lt;br /&gt;
&lt;br /&gt;
* [[Selected IT-Security Chapters]] (2024)&lt;br /&gt;
&lt;br /&gt;
= Author =&lt;br /&gt;
Are Maksimović&lt;br /&gt;
&lt;br /&gt;
= References =&lt;br /&gt;
&lt;br /&gt;
* https://bleak.readthedocs.io/en/latest/usage.html&lt;br /&gt;
* https://www.bluetooth.com/de/bluetooth-resources/intro-to-bluetooth-gap-gatt/&lt;br /&gt;
* https://www.bluetooth.com/specifications/assigned-numbers/&lt;br /&gt;
[[Category:Documentation]]&lt;/div&gt;</summary>
		<author><name>AMaksimovic</name></author>
	</entry>
	<entry>
		<id>https://elvis.hcw.ac.at/wiki/index.php?title=Setting_Up_Ubertooth_on_macOS_for_Bluetooth_Hacking&amp;diff=16743</id>
		<title>Setting Up Ubertooth on macOS for Bluetooth Hacking</title>
		<link rel="alternate" type="text/html" href="https://elvis.hcw.ac.at/wiki/index.php?title=Setting_Up_Ubertooth_on_macOS_for_Bluetooth_Hacking&amp;diff=16743"/>
		<updated>2024-12-05T16:12:38Z</updated>

		<summary type="html">&lt;p&gt;AMaksimovic: /* References */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Summary == &lt;br /&gt;
&lt;br /&gt;
This is a step-by-step guide on how to sniff Bluetooth Low Energy (BLE) packets between a Polar Vantage Smartwatch and a phone using the Ubertooth One. It will go into detail on the setup on a MacBook Air with MacOS using a python environment for the libraries that are used for the setup. Additionally every step of the actual sniff will be outlined. This guide is based on the seminar paper &amp;quot;Smartwatch Hacking Attack&amp;quot; that was written within the FH-course &amp;quot;Selected IT-Security Chapters&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
== Requirements ==&lt;br /&gt;
&lt;br /&gt;
* Hardware tools: Ubertooth One: Firmware version: 2020-12-R1 (API:1.07)&lt;br /&gt;
* Unix-based Operating System: macOS (macOS Sequoia 15.1.1), on a MacBook Air with an Apple M1 chip.&lt;br /&gt;
* Virtual Environment: Python Environment: Python 3.12&lt;br /&gt;
* Packages: libusb, wget, cmake, pkg-config, setuptools, pyqt5, numpy&lt;br /&gt;
* Libraries: libbtbb, bleak&lt;br /&gt;
* Software Tools: Crackle&lt;br /&gt;
&lt;br /&gt;
For the setup this guide was used and adjusted to the given scenario. [[https://ubertooth.readthedocs.io/en/latest/build_guide.html Ubertooth - Build Guide]].&lt;br /&gt;
&lt;br /&gt;
== Description ==&lt;br /&gt;
&lt;br /&gt;
=== Step 1 - Install homebrew ===&lt;br /&gt;
&lt;br /&gt;
Enter these commands in the shell&lt;br /&gt;
&lt;br /&gt;
 /bin/bash -c &amp;quot;$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)&amp;quot;&lt;br /&gt;
 eval &amp;quot;$(/opt/homebrew/bin/brew shellenv)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
=== Step 2 - Install Python Environment ===&lt;br /&gt;
&lt;br /&gt;
Enter these commands in the shell&lt;br /&gt;
&lt;br /&gt;
 python3.12 -m venv myenv&lt;br /&gt;
 source myenv/bin/activate&lt;br /&gt;
&lt;br /&gt;
=== Step 3 - Install libusb, wget, cmake, pkg-config ===&lt;br /&gt;
&lt;br /&gt;
Enter these commands in the shell&lt;br /&gt;
&lt;br /&gt;
 brew install libusb wget cmake pkg-config&lt;br /&gt;
&lt;br /&gt;
=== Step 4 - Install the Bluetooth baseband library ===&lt;br /&gt;
&lt;br /&gt;
Enter these commands in the shell&lt;br /&gt;
&lt;br /&gt;
 wget https://github.com/greatscottgadgets/libbtbb/archive/2020-12-R1.tar.gz -O libbtbb-2020-12-R1.tar.gz&lt;br /&gt;
 tar -xf libbtbb-2020-12-R1.tar.gz&lt;br /&gt;
 cd libbtbb-2020-12-R1&lt;br /&gt;
 mkdir build&lt;br /&gt;
 cd build&lt;br /&gt;
 cmake ..&lt;br /&gt;
 make&lt;br /&gt;
&lt;br /&gt;
If errors occur with installing distutils switch to setuptools instead.&lt;br /&gt;
&lt;br /&gt;
 pip install setuptools&lt;br /&gt;
&lt;br /&gt;
After installing the setuptools also change the &amp;quot;from distutils import setup&amp;quot; line in the the libbtbb-2020-12-R1/build/python/pcaptools/setup.py file to this:&lt;br /&gt;
&lt;br /&gt;
 from setuptools import setup&lt;br /&gt;
&lt;br /&gt;
Also update the version in that same file to this:&lt;br /&gt;
&lt;br /&gt;
 version = &#039;2020.12.R1&#039;&lt;br /&gt;
&lt;br /&gt;
If necessary set the pythonpath in case you have different python versions:&lt;br /&gt;
 &lt;br /&gt;
 export PYTHONPATH=/Users/&amp;lt;username&amp;gt;/myenv/lib/python3.12/site-packages:$PYTHONPATH&lt;br /&gt;
&lt;br /&gt;
Then retry:&lt;br /&gt;
&lt;br /&gt;
 make&lt;br /&gt;
&lt;br /&gt;
 sudo make install&lt;br /&gt;
&lt;br /&gt;
=== Step 5 - Install the Ubertooth repository ===&lt;br /&gt;
&lt;br /&gt;
For this part you can attach the Ubertooth One to the MacBook. BUT DO NOT USE WITHOUT ANTENNA! More information can be found here: [[https://ubertooth.readthedocs.io/en/latest/ubertooth_one.html Ubertooth - Read the docs]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Enter these commands in the shell&lt;br /&gt;
&lt;br /&gt;
 wget https://github.com/greatscottgadgets/ubertooth/releases/download/2020-12-R1/ubertooth-2020-12-R1.tar.xz&lt;br /&gt;
 tar -xf ubertooth-2020-12-R1.tar.xz&lt;br /&gt;
 cd ubertooth-2020-12-R1/host&lt;br /&gt;
 mkdir build&lt;br /&gt;
 cd build&lt;br /&gt;
 cmake ..&lt;br /&gt;
 make&lt;br /&gt;
&lt;br /&gt;
If libusb module not found errors occur go to ubertooth-2020-12-R1/host/CMakeLists.txt an add your libusb-path manually:&lt;br /&gt;
&lt;br /&gt;
 include_directories(/opt/homebrew/include)&lt;br /&gt;
 link_directories(/opt/homebrew/lib)&lt;br /&gt;
&lt;br /&gt;
Additionally again change the &amp;quot;from distutils import setup&amp;quot; line in the the ubertooth-2020-12-R1/host/build/python/specan_ui/setup.py file to this:&lt;br /&gt;
&lt;br /&gt;
 from setuptools import setup&lt;br /&gt;
&lt;br /&gt;
Also update the version in that same file to this:&lt;br /&gt;
&lt;br /&gt;
 version = &#039;2020.12.R1&#039;&lt;br /&gt;
&lt;br /&gt;
Then retry:&lt;br /&gt;
&lt;br /&gt;
 make&lt;br /&gt;
&lt;br /&gt;
 sudo make install&lt;br /&gt;
&lt;br /&gt;
If you get errors regarding the environment variables showing that your library wasnt found you need to set the library path via the MacOs&#039;s dynamic linker.&lt;br /&gt;
&lt;br /&gt;
 export DYLD_LIBRARY_PATH=&amp;quot;/usr/local/lib:$DYLD_LIBRARY_PATH&amp;quot;&lt;br /&gt;
&lt;br /&gt;
or make it persistent in shell configurations: &lt;br /&gt;
&lt;br /&gt;
 ~/.zshrc&lt;br /&gt;
&lt;br /&gt;
Afterwards confirm the ubertooth library is working correctly:&lt;br /&gt;
&lt;br /&gt;
 ubertooth-util&lt;br /&gt;
&lt;br /&gt;
=== Step 6 - Test Ubertooth One commands ===&lt;br /&gt;
&lt;br /&gt;
Test these commands:&lt;br /&gt;
&lt;br /&gt;
 ubertooth-util -H&lt;br /&gt;
 ubertooth-util -v&lt;br /&gt;
 ubertooth-util -p&lt;br /&gt;
 ubertooth-util -s&lt;br /&gt;
&lt;br /&gt;
Update Ubertooth firmware in ubertooth-2020-12-R1/ubertooth-one-firmware-bin:&lt;br /&gt;
&lt;br /&gt;
 sudo ubertooth-dfu -d bluetooth_rxtx.dfu -r&lt;br /&gt;
&lt;br /&gt;
In case the libubertooth library is not loading check if the paths are correct.&lt;br /&gt;
&lt;br /&gt;
In ubertooth-2020-12-R1/host the following command leads to getting a list of sniffed Bluetooth packets with their Lower Address Parts (LAP):&lt;br /&gt;
&lt;br /&gt;
 ubertooth-rx&lt;br /&gt;
&lt;br /&gt;
For collecting Upper Address Parts (UAP) from the captured packets add -z:&lt;br /&gt;
&lt;br /&gt;
 ubertooth-rx -z&lt;br /&gt;
&lt;br /&gt;
Let it run for a while and look at the output. It will be summarized as Survey Results at the end of the output. There you can see the significant part of Bluetooth addresses of devices that were scanned. &lt;br /&gt;
&lt;br /&gt;
=== Step 7 - Use BTLE to follow the connection of the Bluetooth device you found. (Replace with device Bluetooth Address) ===&lt;br /&gt;
&lt;br /&gt;
 ubertooth-btle -f B0:67:B5:CF:E5:10 -r test.pcap&lt;br /&gt;
&lt;br /&gt;
Or create a pipe for viewing the captures directly in Wireshark:&lt;br /&gt;
&lt;br /&gt;
 mkfifo /tmp/pipe&lt;br /&gt;
 ubertooth-btle -f B0:67:B5:CF:E5:10 -c /tmp/pipe&lt;br /&gt;
&lt;br /&gt;
Find packages that involve the Polar Smartwatch&lt;br /&gt;
&lt;br /&gt;
 systime=1728247529 freq=2402 addr=8e89bed6 delta_t=34.320 ms rssi=-60&lt;br /&gt;
 20 1b c9 28 84 1a 9e a0 02 01 06 03 02 ee fe 0d ff 6b 00 72 08 00 00 00 00 00 00 00 00 47 e9 1f &lt;br /&gt;
 Advertising / AA 8e89bed6 (valid)/ 27 bytes&lt;br /&gt;
     Channel Index: 37&lt;br /&gt;
     Type:  ADV_IND&lt;br /&gt;
     AdvA:  a0:9e:1a:84:28:c9 (public)&lt;br /&gt;
     AdvData: 02 01 06 03 02 ee fe 0d ff 6b 00 72 08 00 00 00 00 00 00 00 00&lt;br /&gt;
         Type 01 (Flags)&lt;br /&gt;
            00000110&lt;br /&gt;
                LE General Discoverable Mode&lt;br /&gt;
                BR/EDR Not Supported&lt;br /&gt;
         Type 02 (16-bit Service UUIDs, more available)&lt;br /&gt;
            feee&lt;br /&gt;
         Type ff (Manufacturer Specific Data)&lt;br /&gt;
            Company: Polar Electro OY&lt;br /&gt;
            Data: 72 08 00 00 00 00 00 00 00 00&lt;br /&gt;
     Data:  c9 28 84 1a 9e a0 02 01 06 03 02 ee fe 0d ff 6b 00 72 08 00 00 00 00 00 00 00 00&lt;br /&gt;
     CRC:   47 e9 1f&lt;br /&gt;
&lt;br /&gt;
=== Step 8 - Use Crackle to crack packages ===&lt;br /&gt;
&lt;br /&gt;
Enter these commands:&lt;br /&gt;
&lt;br /&gt;
 git clone https://github.com/mikeryan/crackle.git&lt;br /&gt;
 cd crackle&lt;br /&gt;
 make&lt;br /&gt;
&lt;br /&gt;
Now try cracking your pcap.file&lt;br /&gt;
&lt;br /&gt;
 ./crackle -i &amp;lt;your_file.pcap&amp;gt; -o &amp;lt;your_new_output_file.pcap&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this case it wasnt possible to crack any packages from the smartwatch.&lt;br /&gt;
&lt;br /&gt;
=== Step 9 - Install bleak library ===&lt;br /&gt;
&lt;br /&gt;
 pip install bleak&lt;br /&gt;
&lt;br /&gt;
More information can be found in the bleak library documentation. [[https://bleak.readthedocs.io/en/latest/usage.html Bleak library]] It also includes sample scripts which were used in the following setup.&lt;br /&gt;
&lt;br /&gt;
=== Step 10 - Write python script for reading device UUID ===&lt;br /&gt;
&lt;br /&gt;
Enter these commands in the shell&lt;br /&gt;
&lt;br /&gt;
 mkdir BLE-scripts&lt;br /&gt;
 cd BLE-scripts&lt;br /&gt;
 nano ble_scan.py&lt;br /&gt;
&lt;br /&gt;
Write simple script to read device UUID using BleakScaner.discover() method:&lt;br /&gt;
 &lt;br /&gt;
 import asyncio&lt;br /&gt;
 from bleak import BleakScanner&lt;br /&gt;
 async def scan():&lt;br /&gt;
     devices = await BleakScanner.discover()&lt;br /&gt;
     for d in devices:&lt;br /&gt;
         print(d)&lt;br /&gt;
 asyncio.run(scan())&lt;br /&gt;
&lt;br /&gt;
Run a scan:&lt;br /&gt;
&lt;br /&gt;
 python3 BLE-scripts/ble_scan.py&lt;br /&gt;
&lt;br /&gt;
Here the device UUID of the Polar smartwatch was found:&lt;br /&gt;
&lt;br /&gt;
 C6C36C4A-7F8F-52B2-2BD7-C4F6690424E7: Polar Vantage M 8428C92D&lt;br /&gt;
&lt;br /&gt;
=== Step 11 - Check GATT services  ===&lt;br /&gt;
&lt;br /&gt;
With the gathered device UUID check for the devices services:&lt;br /&gt;
&lt;br /&gt;
 nano BLE-scripts/ble_services.py&lt;br /&gt;
&lt;br /&gt;
 import asyncio&lt;br /&gt;
 from bleak import BleakClient&lt;br /&gt;
 device_uuid = &amp;quot;C6C36C4A-7F8F-52B2-2BD7-C4F6690424E7&amp;quot;&lt;br /&gt;
 async def connect_to_device(device_uuid):&lt;br /&gt;
     async with BleakClient(device_uuid) as client:&lt;br /&gt;
         connected = client.is_connected&lt;br /&gt;
         print(f&amp;quot;Connected: {connected}&amp;quot;)&lt;br /&gt;
         services = client.services&lt;br /&gt;
         if services is None:&lt;br /&gt;
             await client.get_services()&lt;br /&gt;
         for service in services:&lt;br /&gt;
             print(f&amp;quot;Service: {service}&amp;quot;)&lt;br /&gt;
 loop = asyncio.get_event_loop()&lt;br /&gt;
 loop.run_until_complete(connect_to_device(device_uuid))&lt;br /&gt;
&lt;br /&gt;
Run a services scan:&lt;br /&gt;
&lt;br /&gt;
 python3 BLE-scripts/ble_services.py&lt;br /&gt;
&lt;br /&gt;
Now the service UUIDs that were found are going to be listed like this:&lt;br /&gt;
&lt;br /&gt;
 Service: 0000180a-0000-1000-8000-00805f9b34fb (Handle: 14): Device Information&lt;br /&gt;
 Service: 0000feee-0000-1000-8000-00805f9b34fb (Handle: 29): Polar Electro Oy&lt;br /&gt;
 Service: 0000180d-0000-1000-8000-00805f9b34fb (Handle: 38): Heart Rate&lt;br /&gt;
 Service: 0000180f-0000-1000-8000-00805f9b34fb (Handle: 42): Battery Service&lt;br /&gt;
&lt;br /&gt;
=== Step 12 - Get characteristics UUIDs  ===&lt;br /&gt;
&lt;br /&gt;
 nano BLE-scripts/ble_characteristics.py&lt;br /&gt;
&lt;br /&gt;
 import asyncio&lt;br /&gt;
 from bleak import BleakClient&lt;br /&gt;
 device_uuid = &amp;quot;C6C36C4A-7F8F-52B2-2BD7-C4F6690424E7&amp;quot;&lt;br /&gt;
 async def connect_to_device(device_uuid):&lt;br /&gt;
     async with BleakClient(device_uuid) as client:&lt;br /&gt;
         connected = client.is_connected&lt;br /&gt;
         print(f&amp;quot;Connected: {connected}&amp;quot;)&lt;br /&gt;
         services = client.services&lt;br /&gt;
         if services is None:&lt;br /&gt;
             await client.get_services()&lt;br /&gt;
         for service in services:&lt;br /&gt;
             print(f&amp;quot;Service: {service.uuid} (Handle: {service.handle}): {service.description}&amp;quot;)&lt;br /&gt;
             for characteristic in service.characteristics:&lt;br /&gt;
                 print(f&amp;quot;  Characteristic: {characteristic.uuid} (Handle: {characteristic.handle}) - Properties: {cha$&lt;br /&gt;
 loop = asyncio.get_event_loop()&lt;br /&gt;
 loop.run_until_complete(connect_to_device(device_uuid))&lt;br /&gt;
&lt;br /&gt;
Now run the script:&lt;br /&gt;
&lt;br /&gt;
 python3 BLE-scripts/ble_characteristics.py&lt;br /&gt;
&lt;br /&gt;
Expected output:&lt;br /&gt;
&lt;br /&gt;
 Service: 0000180a-0000-1000-8000-00805f9b34fb (Handle: 14): Device Information&lt;br /&gt;
  Characteristic: 00002a29-0000-1000-8000-00805f9b34fb (Handle: 15) - Properties: [&#039;read&#039;]&lt;br /&gt;
  Characteristic: 00002a24-0000-1000-8000-00805f9b34fb (Handle: 17) - Properties: [&#039;read&#039;]&lt;br /&gt;
  Characteristic: 00002a25-0000-1000-8000-00805f9b34fb (Handle: 19) - Properties: [&#039;read&#039;]&lt;br /&gt;
  Characteristic: 00002a27-0000-1000-8000-00805f9b34fb (Handle: 21) - Properties: [&#039;read&#039;]&lt;br /&gt;
  Characteristic: 00002a26-0000-1000-8000-00805f9b34fb (Handle: 23) - Properties: [&#039;read&#039;]&lt;br /&gt;
  Characteristic: 00002a28-0000-1000-8000-00805f9b34fb (Handle: 25) - Properties: [&#039;read&#039;]&lt;br /&gt;
  Characteristic: 00002a23-0000-1000-8000-00805f9b34fb (Handle: 27) - Properties: [&#039;read&#039;]&lt;br /&gt;
 Service: 0000feee-0000-1000-8000-00805f9b34fb (Handle: 29): Polar Electro Oy&lt;br /&gt;
  Characteristic: fb005c51-02e7-f387-1cad-8acd2d8df0c8 (Handle: 30) - Properties: [&#039;write-without-response&#039;, &#039;write&#039;, &#039;notify&#039;]&lt;br /&gt;
  Characteristic: fb005c52-02e7-f387-1cad-8acd2d8df0c8 (Handle: 33) - Properties: [&#039;notify&#039;]&lt;br /&gt;
  Characteristic: fb005c53-02e7-f387-1cad-8acd2d8df0c8 (Handle: 36) - Properties: [&#039;write-without-response&#039;, &#039;write&#039;]&lt;br /&gt;
 Service: 0000180d-0000-1000-8000-00805f9b34fb (Handle: 38): Heart Rate&lt;br /&gt;
  Characteristic: 00002a37-0000-1000-8000-00805f9b34fb (Handle: 39) - Properties: [&#039;notify&#039;]&lt;br /&gt;
 Service: 0000180f-0000-1000-8000-00805f9b34fb (Handle: 42): Battery Service&lt;br /&gt;
  Characteristic: 00002a19-0000-1000-8000-00805f9b34fb (Handle: 43) - Properties: [&#039;read&#039;, &#039;notify&#039;]&lt;br /&gt;
&lt;br /&gt;
=== Step 13 - Read data ===&lt;br /&gt;
&lt;br /&gt;
Now add a script for reading the actual data. Make sure to use the characteristics UUIDs you have found out.&lt;br /&gt;
&lt;br /&gt;
 nano BLE-scripts/ble_read.py&lt;br /&gt;
&lt;br /&gt;
 import asyncio&lt;br /&gt;
 from bleak import BleakClient&lt;br /&gt;
 device_uuid = &amp;quot;C6C36C4A-7F8F-52B2-2BD7-C4F6690424E7&amp;quot;&lt;br /&gt;
 HEART_RATE_CHAR_UUID = &amp;quot;00002a37-0000-1000-8000-00805f9b34fb&amp;quot;&lt;br /&gt;
 BATTERY_LEVEL_CHAR_UUID = &amp;quot;00002a19-0000-1000-8000-00805f9b34fb&amp;quot;&lt;br /&gt;
 async def connect_and_read_data(device_uuid):&lt;br /&gt;
     async with BleakClient(device_uuid) as client:&lt;br /&gt;
         connected = client.is_connected&lt;br /&gt;
         print(f&amp;quot;Connected: {connected}&amp;quot;)&lt;br /&gt;
         if connected:&lt;br /&gt;
             try:&lt;br /&gt;
                 heart_rate = await client.read_gatt_char(HEART_RATE_CHAR_UUID)&lt;br /&gt;
                 heart_rate = int(heart_rate_data[1])&lt;br /&gt;
                 print(f&amp;quot;Heart Rate: {heart_rate} bpm&amp;quot;)&lt;br /&gt;
             except Exception as e:&lt;br /&gt;
                 print(f&amp;quot;Failed to read heart rate: {e}&amp;quot;)&lt;br /&gt;
             try:&lt;br /&gt;
                 battery_level = await client.read_gatt_char(BATTERY_LEVEL_CHAR_UUID)&lt;br /&gt;
                 print(f&amp;quot;Battery Level: {int(battery_level[0])}%&amp;quot;)&lt;br /&gt;
             except Exception as e:&lt;br /&gt;
                 print(f&amp;quot;Failed to read battery level: {e}&amp;quot;)&lt;br /&gt;
 loop = asyncio.get_event_loop()&lt;br /&gt;
 loop.run_until_complete(connect_and_read_data(device_uuid))&lt;br /&gt;
&lt;br /&gt;
Run script:&lt;br /&gt;
&lt;br /&gt;
 python3 BLE-scripts/ble_read.py&lt;br /&gt;
&lt;br /&gt;
In the output the battery level was succesfully read and printed out. The heart rate couldn&#039;t be accessed because it only has the notify property and no option for reading:&lt;br /&gt;
&lt;br /&gt;
 Connected: True&lt;br /&gt;
 Failed to read heart rate: Failed to read characteristic 39: Error Domain=CBATTErrorDomain Code=2 &amp;quot;Reading is not permitted.&amp;quot; UserInfo={NSLocalizedDescription=Reading is not permitted.}&lt;br /&gt;
 Battery Level: 16%&lt;br /&gt;
&lt;br /&gt;
=== Step 14 - Subscribe to heart rate notifications ===&lt;br /&gt;
&lt;br /&gt;
 nano BLE-scripts/ble_subscribe.py&lt;br /&gt;
&lt;br /&gt;
 import asyncio&lt;br /&gt;
 from bleak import BleakClient&lt;br /&gt;
 device_uuid = &amp;quot;C6C36C4A-7F8F-52B2-2BD7-C4F6690424E7&amp;quot;&lt;br /&gt;
 HEART_RATE_CHAR_UUID = &amp;quot;00002a37-0000-1000-8000-00805f9b34fb&amp;quot;&lt;br /&gt;
 def heart_rate_handler(sender, data):&lt;br /&gt;
     heart_rate = int(data[1]) if len(data) &amp;gt; 1 else None&lt;br /&gt;
     print(f&amp;quot;Heart Rate from {sender}: {heart_rate} bpm&amp;quot;)&lt;br /&gt;
 async def connect_and_subscribe(device_uuid):&lt;br /&gt;
     async with BleakClient(device_uuid) as client:&lt;br /&gt;
         connected = client.is_connected&lt;br /&gt;
         print(f&amp;quot;Connected: {connected}&amp;quot;)&lt;br /&gt;
         if connected:&lt;br /&gt;
             try:&lt;br /&gt;
                 await client.start_notify(HEART_RATE_CHAR_UUID, heart_rate_handler)&lt;br /&gt;
                 print(&amp;quot;Subscribed to heart rate notifications.&amp;quot;)&lt;br /&gt;
                 await asyncio.sleep(60)&lt;br /&gt;
                 await client.stop_notify(HEART_RATE_CHAR_UUID)&lt;br /&gt;
                 print(&amp;quot;Stopped heart rate notifications.&amp;quot;)&lt;br /&gt;
             except Exception as e:&lt;br /&gt;
                 print(f&amp;quot;Failed to subscribe to heart rate notifications: {e}&amp;quot;)&lt;br /&gt;
 asyncio.run(connect_and_subscribe(device_uuid))&lt;br /&gt;
&lt;br /&gt;
 python3 BLE-scripts/ble_subscribe.py&lt;br /&gt;
&lt;br /&gt;
It was not possible to get the heart rate data even though the notify property was assigned. That is because typically battery status data is on a lower securiy level than heart rate data. More information on GATT can be found here: https://www.bluetooth.com/de/bluetooth-resources/intro-to-bluetooth-gap-gatt/&lt;br /&gt;
&lt;br /&gt;
This is the output of the failed try:&lt;br /&gt;
&lt;br /&gt;
 Connected: True&lt;br /&gt;
 Subscribed to heart rate notifications.&lt;br /&gt;
 Stopped heart rate notifications.&lt;br /&gt;
&lt;br /&gt;
== Used Hardware ==&lt;br /&gt;
&lt;br /&gt;
* [[Ubertooth One, 2.4 GHz wireless development platform]]&lt;br /&gt;
&lt;br /&gt;
* [[Polar Vantage M]]&lt;br /&gt;
&lt;br /&gt;
* [[Apple iPhone 13 mini]]&lt;br /&gt;
&lt;br /&gt;
* [[MacBook Air M1, 2020]]&lt;br /&gt;
&lt;br /&gt;
* [[Samsung Galaxy J3]]&lt;br /&gt;
&lt;br /&gt;
== Courses ==&lt;br /&gt;
&lt;br /&gt;
* [[Selected IT-Security Chapters]] (2024)&lt;br /&gt;
&lt;br /&gt;
== Author ==&lt;br /&gt;
&lt;br /&gt;
Are Maksimović&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
* https://ubertooth.readthedocs.io/en/latest/&lt;br /&gt;
* https://www.greatscottgadgets.com/ubertoothone/&lt;br /&gt;
* https://codemuch.net/posts/bluetooth-hacking/&lt;br /&gt;
* https://bleak.readthedocs.io/en/latest/usage.html&lt;br /&gt;
* https://www.bluetooth.com/de/bluetooth-resources/intro-to-bluetooth-gap-gatt/&lt;br /&gt;
* https://support.polar.com/en/vantage-m#all&lt;br /&gt;
* https://wiki.elvis.science/index.php?title=B-LE_-_GATT_Architectural_Overview&lt;br /&gt;
&lt;br /&gt;
[[Category:Documentation]]&lt;/div&gt;</summary>
		<author><name>AMaksimovic</name></author>
	</entry>
	<entry>
		<id>https://elvis.hcw.ac.at/wiki/index.php?title=Setting_Up_Ubertooth_on_macOS_for_Bluetooth_Hacking&amp;diff=16742</id>
		<title>Setting Up Ubertooth on macOS for Bluetooth Hacking</title>
		<link rel="alternate" type="text/html" href="https://elvis.hcw.ac.at/wiki/index.php?title=Setting_Up_Ubertooth_on_macOS_for_Bluetooth_Hacking&amp;diff=16742"/>
		<updated>2024-12-05T16:11:31Z</updated>

		<summary type="html">&lt;p&gt;AMaksimovic: /* Step 9 - Install bleak library */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Summary == &lt;br /&gt;
&lt;br /&gt;
This is a step-by-step guide on how to sniff Bluetooth Low Energy (BLE) packets between a Polar Vantage Smartwatch and a phone using the Ubertooth One. It will go into detail on the setup on a MacBook Air with MacOS using a python environment for the libraries that are used for the setup. Additionally every step of the actual sniff will be outlined. This guide is based on the seminar paper &amp;quot;Smartwatch Hacking Attack&amp;quot; that was written within the FH-course &amp;quot;Selected IT-Security Chapters&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
== Requirements ==&lt;br /&gt;
&lt;br /&gt;
* Hardware tools: Ubertooth One: Firmware version: 2020-12-R1 (API:1.07)&lt;br /&gt;
* Unix-based Operating System: macOS (macOS Sequoia 15.1.1), on a MacBook Air with an Apple M1 chip.&lt;br /&gt;
* Virtual Environment: Python Environment: Python 3.12&lt;br /&gt;
* Packages: libusb, wget, cmake, pkg-config, setuptools, pyqt5, numpy&lt;br /&gt;
* Libraries: libbtbb, bleak&lt;br /&gt;
* Software Tools: Crackle&lt;br /&gt;
&lt;br /&gt;
For the setup this guide was used and adjusted to the given scenario. [[https://ubertooth.readthedocs.io/en/latest/build_guide.html Ubertooth - Build Guide]].&lt;br /&gt;
&lt;br /&gt;
== Description ==&lt;br /&gt;
&lt;br /&gt;
=== Step 1 - Install homebrew ===&lt;br /&gt;
&lt;br /&gt;
Enter these commands in the shell&lt;br /&gt;
&lt;br /&gt;
 /bin/bash -c &amp;quot;$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)&amp;quot;&lt;br /&gt;
 eval &amp;quot;$(/opt/homebrew/bin/brew shellenv)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
=== Step 2 - Install Python Environment ===&lt;br /&gt;
&lt;br /&gt;
Enter these commands in the shell&lt;br /&gt;
&lt;br /&gt;
 python3.12 -m venv myenv&lt;br /&gt;
 source myenv/bin/activate&lt;br /&gt;
&lt;br /&gt;
=== Step 3 - Install libusb, wget, cmake, pkg-config ===&lt;br /&gt;
&lt;br /&gt;
Enter these commands in the shell&lt;br /&gt;
&lt;br /&gt;
 brew install libusb wget cmake pkg-config&lt;br /&gt;
&lt;br /&gt;
=== Step 4 - Install the Bluetooth baseband library ===&lt;br /&gt;
&lt;br /&gt;
Enter these commands in the shell&lt;br /&gt;
&lt;br /&gt;
 wget https://github.com/greatscottgadgets/libbtbb/archive/2020-12-R1.tar.gz -O libbtbb-2020-12-R1.tar.gz&lt;br /&gt;
 tar -xf libbtbb-2020-12-R1.tar.gz&lt;br /&gt;
 cd libbtbb-2020-12-R1&lt;br /&gt;
 mkdir build&lt;br /&gt;
 cd build&lt;br /&gt;
 cmake ..&lt;br /&gt;
 make&lt;br /&gt;
&lt;br /&gt;
If errors occur with installing distutils switch to setuptools instead.&lt;br /&gt;
&lt;br /&gt;
 pip install setuptools&lt;br /&gt;
&lt;br /&gt;
After installing the setuptools also change the &amp;quot;from distutils import setup&amp;quot; line in the the libbtbb-2020-12-R1/build/python/pcaptools/setup.py file to this:&lt;br /&gt;
&lt;br /&gt;
 from setuptools import setup&lt;br /&gt;
&lt;br /&gt;
Also update the version in that same file to this:&lt;br /&gt;
&lt;br /&gt;
 version = &#039;2020.12.R1&#039;&lt;br /&gt;
&lt;br /&gt;
If necessary set the pythonpath in case you have different python versions:&lt;br /&gt;
 &lt;br /&gt;
 export PYTHONPATH=/Users/&amp;lt;username&amp;gt;/myenv/lib/python3.12/site-packages:$PYTHONPATH&lt;br /&gt;
&lt;br /&gt;
Then retry:&lt;br /&gt;
&lt;br /&gt;
 make&lt;br /&gt;
&lt;br /&gt;
 sudo make install&lt;br /&gt;
&lt;br /&gt;
=== Step 5 - Install the Ubertooth repository ===&lt;br /&gt;
&lt;br /&gt;
For this part you can attach the Ubertooth One to the MacBook. BUT DO NOT USE WITHOUT ANTENNA! More information can be found here: [[https://ubertooth.readthedocs.io/en/latest/ubertooth_one.html Ubertooth - Read the docs]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Enter these commands in the shell&lt;br /&gt;
&lt;br /&gt;
 wget https://github.com/greatscottgadgets/ubertooth/releases/download/2020-12-R1/ubertooth-2020-12-R1.tar.xz&lt;br /&gt;
 tar -xf ubertooth-2020-12-R1.tar.xz&lt;br /&gt;
 cd ubertooth-2020-12-R1/host&lt;br /&gt;
 mkdir build&lt;br /&gt;
 cd build&lt;br /&gt;
 cmake ..&lt;br /&gt;
 make&lt;br /&gt;
&lt;br /&gt;
If libusb module not found errors occur go to ubertooth-2020-12-R1/host/CMakeLists.txt an add your libusb-path manually:&lt;br /&gt;
&lt;br /&gt;
 include_directories(/opt/homebrew/include)&lt;br /&gt;
 link_directories(/opt/homebrew/lib)&lt;br /&gt;
&lt;br /&gt;
Additionally again change the &amp;quot;from distutils import setup&amp;quot; line in the the ubertooth-2020-12-R1/host/build/python/specan_ui/setup.py file to this:&lt;br /&gt;
&lt;br /&gt;
 from setuptools import setup&lt;br /&gt;
&lt;br /&gt;
Also update the version in that same file to this:&lt;br /&gt;
&lt;br /&gt;
 version = &#039;2020.12.R1&#039;&lt;br /&gt;
&lt;br /&gt;
Then retry:&lt;br /&gt;
&lt;br /&gt;
 make&lt;br /&gt;
&lt;br /&gt;
 sudo make install&lt;br /&gt;
&lt;br /&gt;
If you get errors regarding the environment variables showing that your library wasnt found you need to set the library path via the MacOs&#039;s dynamic linker.&lt;br /&gt;
&lt;br /&gt;
 export DYLD_LIBRARY_PATH=&amp;quot;/usr/local/lib:$DYLD_LIBRARY_PATH&amp;quot;&lt;br /&gt;
&lt;br /&gt;
or make it persistent in shell configurations: &lt;br /&gt;
&lt;br /&gt;
 ~/.zshrc&lt;br /&gt;
&lt;br /&gt;
Afterwards confirm the ubertooth library is working correctly:&lt;br /&gt;
&lt;br /&gt;
 ubertooth-util&lt;br /&gt;
&lt;br /&gt;
=== Step 6 - Test Ubertooth One commands ===&lt;br /&gt;
&lt;br /&gt;
Test these commands:&lt;br /&gt;
&lt;br /&gt;
 ubertooth-util -H&lt;br /&gt;
 ubertooth-util -v&lt;br /&gt;
 ubertooth-util -p&lt;br /&gt;
 ubertooth-util -s&lt;br /&gt;
&lt;br /&gt;
Update Ubertooth firmware in ubertooth-2020-12-R1/ubertooth-one-firmware-bin:&lt;br /&gt;
&lt;br /&gt;
 sudo ubertooth-dfu -d bluetooth_rxtx.dfu -r&lt;br /&gt;
&lt;br /&gt;
In case the libubertooth library is not loading check if the paths are correct.&lt;br /&gt;
&lt;br /&gt;
In ubertooth-2020-12-R1/host the following command leads to getting a list of sniffed Bluetooth packets with their Lower Address Parts (LAP):&lt;br /&gt;
&lt;br /&gt;
 ubertooth-rx&lt;br /&gt;
&lt;br /&gt;
For collecting Upper Address Parts (UAP) from the captured packets add -z:&lt;br /&gt;
&lt;br /&gt;
 ubertooth-rx -z&lt;br /&gt;
&lt;br /&gt;
Let it run for a while and look at the output. It will be summarized as Survey Results at the end of the output. There you can see the significant part of Bluetooth addresses of devices that were scanned. &lt;br /&gt;
&lt;br /&gt;
=== Step 7 - Use BTLE to follow the connection of the Bluetooth device you found. (Replace with device Bluetooth Address) ===&lt;br /&gt;
&lt;br /&gt;
 ubertooth-btle -f B0:67:B5:CF:E5:10 -r test.pcap&lt;br /&gt;
&lt;br /&gt;
Or create a pipe for viewing the captures directly in Wireshark:&lt;br /&gt;
&lt;br /&gt;
 mkfifo /tmp/pipe&lt;br /&gt;
 ubertooth-btle -f B0:67:B5:CF:E5:10 -c /tmp/pipe&lt;br /&gt;
&lt;br /&gt;
Find packages that involve the Polar Smartwatch&lt;br /&gt;
&lt;br /&gt;
 systime=1728247529 freq=2402 addr=8e89bed6 delta_t=34.320 ms rssi=-60&lt;br /&gt;
 20 1b c9 28 84 1a 9e a0 02 01 06 03 02 ee fe 0d ff 6b 00 72 08 00 00 00 00 00 00 00 00 47 e9 1f &lt;br /&gt;
 Advertising / AA 8e89bed6 (valid)/ 27 bytes&lt;br /&gt;
     Channel Index: 37&lt;br /&gt;
     Type:  ADV_IND&lt;br /&gt;
     AdvA:  a0:9e:1a:84:28:c9 (public)&lt;br /&gt;
     AdvData: 02 01 06 03 02 ee fe 0d ff 6b 00 72 08 00 00 00 00 00 00 00 00&lt;br /&gt;
         Type 01 (Flags)&lt;br /&gt;
            00000110&lt;br /&gt;
                LE General Discoverable Mode&lt;br /&gt;
                BR/EDR Not Supported&lt;br /&gt;
         Type 02 (16-bit Service UUIDs, more available)&lt;br /&gt;
            feee&lt;br /&gt;
         Type ff (Manufacturer Specific Data)&lt;br /&gt;
            Company: Polar Electro OY&lt;br /&gt;
            Data: 72 08 00 00 00 00 00 00 00 00&lt;br /&gt;
     Data:  c9 28 84 1a 9e a0 02 01 06 03 02 ee fe 0d ff 6b 00 72 08 00 00 00 00 00 00 00 00&lt;br /&gt;
     CRC:   47 e9 1f&lt;br /&gt;
&lt;br /&gt;
=== Step 8 - Use Crackle to crack packages ===&lt;br /&gt;
&lt;br /&gt;
Enter these commands:&lt;br /&gt;
&lt;br /&gt;
 git clone https://github.com/mikeryan/crackle.git&lt;br /&gt;
 cd crackle&lt;br /&gt;
 make&lt;br /&gt;
&lt;br /&gt;
Now try cracking your pcap.file&lt;br /&gt;
&lt;br /&gt;
 ./crackle -i &amp;lt;your_file.pcap&amp;gt; -o &amp;lt;your_new_output_file.pcap&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this case it wasnt possible to crack any packages from the smartwatch.&lt;br /&gt;
&lt;br /&gt;
=== Step 9 - Install bleak library ===&lt;br /&gt;
&lt;br /&gt;
 pip install bleak&lt;br /&gt;
&lt;br /&gt;
More information can be found in the bleak library documentation. [[https://bleak.readthedocs.io/en/latest/usage.html Bleak library]] It also includes sample scripts which were used in the following setup.&lt;br /&gt;
&lt;br /&gt;
=== Step 10 - Write python script for reading device UUID ===&lt;br /&gt;
&lt;br /&gt;
Enter these commands in the shell&lt;br /&gt;
&lt;br /&gt;
 mkdir BLE-scripts&lt;br /&gt;
 cd BLE-scripts&lt;br /&gt;
 nano ble_scan.py&lt;br /&gt;
&lt;br /&gt;
Write simple script to read device UUID using BleakScaner.discover() method:&lt;br /&gt;
 &lt;br /&gt;
 import asyncio&lt;br /&gt;
 from bleak import BleakScanner&lt;br /&gt;
 async def scan():&lt;br /&gt;
     devices = await BleakScanner.discover()&lt;br /&gt;
     for d in devices:&lt;br /&gt;
         print(d)&lt;br /&gt;
 asyncio.run(scan())&lt;br /&gt;
&lt;br /&gt;
Run a scan:&lt;br /&gt;
&lt;br /&gt;
 python3 BLE-scripts/ble_scan.py&lt;br /&gt;
&lt;br /&gt;
Here the device UUID of the Polar smartwatch was found:&lt;br /&gt;
&lt;br /&gt;
 C6C36C4A-7F8F-52B2-2BD7-C4F6690424E7: Polar Vantage M 8428C92D&lt;br /&gt;
&lt;br /&gt;
=== Step 11 - Check GATT services  ===&lt;br /&gt;
&lt;br /&gt;
With the gathered device UUID check for the devices services:&lt;br /&gt;
&lt;br /&gt;
 nano BLE-scripts/ble_services.py&lt;br /&gt;
&lt;br /&gt;
 import asyncio&lt;br /&gt;
 from bleak import BleakClient&lt;br /&gt;
 device_uuid = &amp;quot;C6C36C4A-7F8F-52B2-2BD7-C4F6690424E7&amp;quot;&lt;br /&gt;
 async def connect_to_device(device_uuid):&lt;br /&gt;
     async with BleakClient(device_uuid) as client:&lt;br /&gt;
         connected = client.is_connected&lt;br /&gt;
         print(f&amp;quot;Connected: {connected}&amp;quot;)&lt;br /&gt;
         services = client.services&lt;br /&gt;
         if services is None:&lt;br /&gt;
             await client.get_services()&lt;br /&gt;
         for service in services:&lt;br /&gt;
             print(f&amp;quot;Service: {service}&amp;quot;)&lt;br /&gt;
 loop = asyncio.get_event_loop()&lt;br /&gt;
 loop.run_until_complete(connect_to_device(device_uuid))&lt;br /&gt;
&lt;br /&gt;
Run a services scan:&lt;br /&gt;
&lt;br /&gt;
 python3 BLE-scripts/ble_services.py&lt;br /&gt;
&lt;br /&gt;
Now the service UUIDs that were found are going to be listed like this:&lt;br /&gt;
&lt;br /&gt;
 Service: 0000180a-0000-1000-8000-00805f9b34fb (Handle: 14): Device Information&lt;br /&gt;
 Service: 0000feee-0000-1000-8000-00805f9b34fb (Handle: 29): Polar Electro Oy&lt;br /&gt;
 Service: 0000180d-0000-1000-8000-00805f9b34fb (Handle: 38): Heart Rate&lt;br /&gt;
 Service: 0000180f-0000-1000-8000-00805f9b34fb (Handle: 42): Battery Service&lt;br /&gt;
&lt;br /&gt;
=== Step 12 - Get characteristics UUIDs  ===&lt;br /&gt;
&lt;br /&gt;
 nano BLE-scripts/ble_characteristics.py&lt;br /&gt;
&lt;br /&gt;
 import asyncio&lt;br /&gt;
 from bleak import BleakClient&lt;br /&gt;
 device_uuid = &amp;quot;C6C36C4A-7F8F-52B2-2BD7-C4F6690424E7&amp;quot;&lt;br /&gt;
 async def connect_to_device(device_uuid):&lt;br /&gt;
     async with BleakClient(device_uuid) as client:&lt;br /&gt;
         connected = client.is_connected&lt;br /&gt;
         print(f&amp;quot;Connected: {connected}&amp;quot;)&lt;br /&gt;
         services = client.services&lt;br /&gt;
         if services is None:&lt;br /&gt;
             await client.get_services()&lt;br /&gt;
         for service in services:&lt;br /&gt;
             print(f&amp;quot;Service: {service.uuid} (Handle: {service.handle}): {service.description}&amp;quot;)&lt;br /&gt;
             for characteristic in service.characteristics:&lt;br /&gt;
                 print(f&amp;quot;  Characteristic: {characteristic.uuid} (Handle: {characteristic.handle}) - Properties: {cha$&lt;br /&gt;
 loop = asyncio.get_event_loop()&lt;br /&gt;
 loop.run_until_complete(connect_to_device(device_uuid))&lt;br /&gt;
&lt;br /&gt;
Now run the script:&lt;br /&gt;
&lt;br /&gt;
 python3 BLE-scripts/ble_characteristics.py&lt;br /&gt;
&lt;br /&gt;
Expected output:&lt;br /&gt;
&lt;br /&gt;
 Service: 0000180a-0000-1000-8000-00805f9b34fb (Handle: 14): Device Information&lt;br /&gt;
  Characteristic: 00002a29-0000-1000-8000-00805f9b34fb (Handle: 15) - Properties: [&#039;read&#039;]&lt;br /&gt;
  Characteristic: 00002a24-0000-1000-8000-00805f9b34fb (Handle: 17) - Properties: [&#039;read&#039;]&lt;br /&gt;
  Characteristic: 00002a25-0000-1000-8000-00805f9b34fb (Handle: 19) - Properties: [&#039;read&#039;]&lt;br /&gt;
  Characteristic: 00002a27-0000-1000-8000-00805f9b34fb (Handle: 21) - Properties: [&#039;read&#039;]&lt;br /&gt;
  Characteristic: 00002a26-0000-1000-8000-00805f9b34fb (Handle: 23) - Properties: [&#039;read&#039;]&lt;br /&gt;
  Characteristic: 00002a28-0000-1000-8000-00805f9b34fb (Handle: 25) - Properties: [&#039;read&#039;]&lt;br /&gt;
  Characteristic: 00002a23-0000-1000-8000-00805f9b34fb (Handle: 27) - Properties: [&#039;read&#039;]&lt;br /&gt;
 Service: 0000feee-0000-1000-8000-00805f9b34fb (Handle: 29): Polar Electro Oy&lt;br /&gt;
  Characteristic: fb005c51-02e7-f387-1cad-8acd2d8df0c8 (Handle: 30) - Properties: [&#039;write-without-response&#039;, &#039;write&#039;, &#039;notify&#039;]&lt;br /&gt;
  Characteristic: fb005c52-02e7-f387-1cad-8acd2d8df0c8 (Handle: 33) - Properties: [&#039;notify&#039;]&lt;br /&gt;
  Characteristic: fb005c53-02e7-f387-1cad-8acd2d8df0c8 (Handle: 36) - Properties: [&#039;write-without-response&#039;, &#039;write&#039;]&lt;br /&gt;
 Service: 0000180d-0000-1000-8000-00805f9b34fb (Handle: 38): Heart Rate&lt;br /&gt;
  Characteristic: 00002a37-0000-1000-8000-00805f9b34fb (Handle: 39) - Properties: [&#039;notify&#039;]&lt;br /&gt;
 Service: 0000180f-0000-1000-8000-00805f9b34fb (Handle: 42): Battery Service&lt;br /&gt;
  Characteristic: 00002a19-0000-1000-8000-00805f9b34fb (Handle: 43) - Properties: [&#039;read&#039;, &#039;notify&#039;]&lt;br /&gt;
&lt;br /&gt;
=== Step 13 - Read data ===&lt;br /&gt;
&lt;br /&gt;
Now add a script for reading the actual data. Make sure to use the characteristics UUIDs you have found out.&lt;br /&gt;
&lt;br /&gt;
 nano BLE-scripts/ble_read.py&lt;br /&gt;
&lt;br /&gt;
 import asyncio&lt;br /&gt;
 from bleak import BleakClient&lt;br /&gt;
 device_uuid = &amp;quot;C6C36C4A-7F8F-52B2-2BD7-C4F6690424E7&amp;quot;&lt;br /&gt;
 HEART_RATE_CHAR_UUID = &amp;quot;00002a37-0000-1000-8000-00805f9b34fb&amp;quot;&lt;br /&gt;
 BATTERY_LEVEL_CHAR_UUID = &amp;quot;00002a19-0000-1000-8000-00805f9b34fb&amp;quot;&lt;br /&gt;
 async def connect_and_read_data(device_uuid):&lt;br /&gt;
     async with BleakClient(device_uuid) as client:&lt;br /&gt;
         connected = client.is_connected&lt;br /&gt;
         print(f&amp;quot;Connected: {connected}&amp;quot;)&lt;br /&gt;
         if connected:&lt;br /&gt;
             try:&lt;br /&gt;
                 heart_rate = await client.read_gatt_char(HEART_RATE_CHAR_UUID)&lt;br /&gt;
                 heart_rate = int(heart_rate_data[1])&lt;br /&gt;
                 print(f&amp;quot;Heart Rate: {heart_rate} bpm&amp;quot;)&lt;br /&gt;
             except Exception as e:&lt;br /&gt;
                 print(f&amp;quot;Failed to read heart rate: {e}&amp;quot;)&lt;br /&gt;
             try:&lt;br /&gt;
                 battery_level = await client.read_gatt_char(BATTERY_LEVEL_CHAR_UUID)&lt;br /&gt;
                 print(f&amp;quot;Battery Level: {int(battery_level[0])}%&amp;quot;)&lt;br /&gt;
             except Exception as e:&lt;br /&gt;
                 print(f&amp;quot;Failed to read battery level: {e}&amp;quot;)&lt;br /&gt;
 loop = asyncio.get_event_loop()&lt;br /&gt;
 loop.run_until_complete(connect_and_read_data(device_uuid))&lt;br /&gt;
&lt;br /&gt;
Run script:&lt;br /&gt;
&lt;br /&gt;
 python3 BLE-scripts/ble_read.py&lt;br /&gt;
&lt;br /&gt;
In the output the battery level was succesfully read and printed out. The heart rate couldn&#039;t be accessed because it only has the notify property and no option for reading:&lt;br /&gt;
&lt;br /&gt;
 Connected: True&lt;br /&gt;
 Failed to read heart rate: Failed to read characteristic 39: Error Domain=CBATTErrorDomain Code=2 &amp;quot;Reading is not permitted.&amp;quot; UserInfo={NSLocalizedDescription=Reading is not permitted.}&lt;br /&gt;
 Battery Level: 16%&lt;br /&gt;
&lt;br /&gt;
=== Step 14 - Subscribe to heart rate notifications ===&lt;br /&gt;
&lt;br /&gt;
 nano BLE-scripts/ble_subscribe.py&lt;br /&gt;
&lt;br /&gt;
 import asyncio&lt;br /&gt;
 from bleak import BleakClient&lt;br /&gt;
 device_uuid = &amp;quot;C6C36C4A-7F8F-52B2-2BD7-C4F6690424E7&amp;quot;&lt;br /&gt;
 HEART_RATE_CHAR_UUID = &amp;quot;00002a37-0000-1000-8000-00805f9b34fb&amp;quot;&lt;br /&gt;
 def heart_rate_handler(sender, data):&lt;br /&gt;
     heart_rate = int(data[1]) if len(data) &amp;gt; 1 else None&lt;br /&gt;
     print(f&amp;quot;Heart Rate from {sender}: {heart_rate} bpm&amp;quot;)&lt;br /&gt;
 async def connect_and_subscribe(device_uuid):&lt;br /&gt;
     async with BleakClient(device_uuid) as client:&lt;br /&gt;
         connected = client.is_connected&lt;br /&gt;
         print(f&amp;quot;Connected: {connected}&amp;quot;)&lt;br /&gt;
         if connected:&lt;br /&gt;
             try:&lt;br /&gt;
                 await client.start_notify(HEART_RATE_CHAR_UUID, heart_rate_handler)&lt;br /&gt;
                 print(&amp;quot;Subscribed to heart rate notifications.&amp;quot;)&lt;br /&gt;
                 await asyncio.sleep(60)&lt;br /&gt;
                 await client.stop_notify(HEART_RATE_CHAR_UUID)&lt;br /&gt;
                 print(&amp;quot;Stopped heart rate notifications.&amp;quot;)&lt;br /&gt;
             except Exception as e:&lt;br /&gt;
                 print(f&amp;quot;Failed to subscribe to heart rate notifications: {e}&amp;quot;)&lt;br /&gt;
 asyncio.run(connect_and_subscribe(device_uuid))&lt;br /&gt;
&lt;br /&gt;
 python3 BLE-scripts/ble_subscribe.py&lt;br /&gt;
&lt;br /&gt;
It was not possible to get the heart rate data even though the notify property was assigned. That is because typically battery status data is on a lower securiy level than heart rate data. More information on GATT can be found here: https://www.bluetooth.com/de/bluetooth-resources/intro-to-bluetooth-gap-gatt/&lt;br /&gt;
&lt;br /&gt;
This is the output of the failed try:&lt;br /&gt;
&lt;br /&gt;
 Connected: True&lt;br /&gt;
 Subscribed to heart rate notifications.&lt;br /&gt;
 Stopped heart rate notifications.&lt;br /&gt;
&lt;br /&gt;
== Used Hardware ==&lt;br /&gt;
&lt;br /&gt;
* [[Ubertooth One, 2.4 GHz wireless development platform]]&lt;br /&gt;
&lt;br /&gt;
* [[Polar Vantage M]]&lt;br /&gt;
&lt;br /&gt;
* [[Apple iPhone 13 mini]]&lt;br /&gt;
&lt;br /&gt;
* [[MacBook Air M1, 2020]]&lt;br /&gt;
&lt;br /&gt;
* [[Samsung Galaxy J3]]&lt;br /&gt;
&lt;br /&gt;
== Courses ==&lt;br /&gt;
&lt;br /&gt;
* [[Selected IT-Security Chapters]] (2024)&lt;br /&gt;
&lt;br /&gt;
== Author ==&lt;br /&gt;
&lt;br /&gt;
Are Maksimović&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
* https://ubertooth.readthedocs.io/en/latest/&lt;br /&gt;
* https://www.greatscottgadgets.com/ubertoothone/&lt;br /&gt;
* https://codemuch.net/posts/bluetooth-hacking/&lt;br /&gt;
* https://bleak.readthedocs.io/en/latest/usage.html&lt;br /&gt;
* https://www.bluetooth.com/de/bluetooth-resources/intro-to-bluetooth-gap-gatt/&lt;br /&gt;
* https://support.polar.com/en/vantage-m#all&lt;br /&gt;
* https://wiki.elvis.science/index.php?title=(Article_title)#Example_UUIDs_of_a_Polar_Smartwatch&lt;br /&gt;
&lt;br /&gt;
[[Category:Documentation]]&lt;/div&gt;</summary>
		<author><name>AMaksimovic</name></author>
	</entry>
	<entry>
		<id>https://elvis.hcw.ac.at/wiki/index.php?title=Setting_Up_Ubertooth_on_macOS_for_Bluetooth_Hacking&amp;diff=16741</id>
		<title>Setting Up Ubertooth on macOS for Bluetooth Hacking</title>
		<link rel="alternate" type="text/html" href="https://elvis.hcw.ac.at/wiki/index.php?title=Setting_Up_Ubertooth_on_macOS_for_Bluetooth_Hacking&amp;diff=16741"/>
		<updated>2024-12-05T16:11:01Z</updated>

		<summary type="html">&lt;p&gt;AMaksimovic: /* Step 5 - Install the Ubertooth repository */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Summary == &lt;br /&gt;
&lt;br /&gt;
This is a step-by-step guide on how to sniff Bluetooth Low Energy (BLE) packets between a Polar Vantage Smartwatch and a phone using the Ubertooth One. It will go into detail on the setup on a MacBook Air with MacOS using a python environment for the libraries that are used for the setup. Additionally every step of the actual sniff will be outlined. This guide is based on the seminar paper &amp;quot;Smartwatch Hacking Attack&amp;quot; that was written within the FH-course &amp;quot;Selected IT-Security Chapters&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
== Requirements ==&lt;br /&gt;
&lt;br /&gt;
* Hardware tools: Ubertooth One: Firmware version: 2020-12-R1 (API:1.07)&lt;br /&gt;
* Unix-based Operating System: macOS (macOS Sequoia 15.1.1), on a MacBook Air with an Apple M1 chip.&lt;br /&gt;
* Virtual Environment: Python Environment: Python 3.12&lt;br /&gt;
* Packages: libusb, wget, cmake, pkg-config, setuptools, pyqt5, numpy&lt;br /&gt;
* Libraries: libbtbb, bleak&lt;br /&gt;
* Software Tools: Crackle&lt;br /&gt;
&lt;br /&gt;
For the setup this guide was used and adjusted to the given scenario. [[https://ubertooth.readthedocs.io/en/latest/build_guide.html Ubertooth - Build Guide]].&lt;br /&gt;
&lt;br /&gt;
== Description ==&lt;br /&gt;
&lt;br /&gt;
=== Step 1 - Install homebrew ===&lt;br /&gt;
&lt;br /&gt;
Enter these commands in the shell&lt;br /&gt;
&lt;br /&gt;
 /bin/bash -c &amp;quot;$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)&amp;quot;&lt;br /&gt;
 eval &amp;quot;$(/opt/homebrew/bin/brew shellenv)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
=== Step 2 - Install Python Environment ===&lt;br /&gt;
&lt;br /&gt;
Enter these commands in the shell&lt;br /&gt;
&lt;br /&gt;
 python3.12 -m venv myenv&lt;br /&gt;
 source myenv/bin/activate&lt;br /&gt;
&lt;br /&gt;
=== Step 3 - Install libusb, wget, cmake, pkg-config ===&lt;br /&gt;
&lt;br /&gt;
Enter these commands in the shell&lt;br /&gt;
&lt;br /&gt;
 brew install libusb wget cmake pkg-config&lt;br /&gt;
&lt;br /&gt;
=== Step 4 - Install the Bluetooth baseband library ===&lt;br /&gt;
&lt;br /&gt;
Enter these commands in the shell&lt;br /&gt;
&lt;br /&gt;
 wget https://github.com/greatscottgadgets/libbtbb/archive/2020-12-R1.tar.gz -O libbtbb-2020-12-R1.tar.gz&lt;br /&gt;
 tar -xf libbtbb-2020-12-R1.tar.gz&lt;br /&gt;
 cd libbtbb-2020-12-R1&lt;br /&gt;
 mkdir build&lt;br /&gt;
 cd build&lt;br /&gt;
 cmake ..&lt;br /&gt;
 make&lt;br /&gt;
&lt;br /&gt;
If errors occur with installing distutils switch to setuptools instead.&lt;br /&gt;
&lt;br /&gt;
 pip install setuptools&lt;br /&gt;
&lt;br /&gt;
After installing the setuptools also change the &amp;quot;from distutils import setup&amp;quot; line in the the libbtbb-2020-12-R1/build/python/pcaptools/setup.py file to this:&lt;br /&gt;
&lt;br /&gt;
 from setuptools import setup&lt;br /&gt;
&lt;br /&gt;
Also update the version in that same file to this:&lt;br /&gt;
&lt;br /&gt;
 version = &#039;2020.12.R1&#039;&lt;br /&gt;
&lt;br /&gt;
If necessary set the pythonpath in case you have different python versions:&lt;br /&gt;
 &lt;br /&gt;
 export PYTHONPATH=/Users/&amp;lt;username&amp;gt;/myenv/lib/python3.12/site-packages:$PYTHONPATH&lt;br /&gt;
&lt;br /&gt;
Then retry:&lt;br /&gt;
&lt;br /&gt;
 make&lt;br /&gt;
&lt;br /&gt;
 sudo make install&lt;br /&gt;
&lt;br /&gt;
=== Step 5 - Install the Ubertooth repository ===&lt;br /&gt;
&lt;br /&gt;
For this part you can attach the Ubertooth One to the MacBook. BUT DO NOT USE WITHOUT ANTENNA! More information can be found here: [[https://ubertooth.readthedocs.io/en/latest/ubertooth_one.html Ubertooth - Read the docs]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Enter these commands in the shell&lt;br /&gt;
&lt;br /&gt;
 wget https://github.com/greatscottgadgets/ubertooth/releases/download/2020-12-R1/ubertooth-2020-12-R1.tar.xz&lt;br /&gt;
 tar -xf ubertooth-2020-12-R1.tar.xz&lt;br /&gt;
 cd ubertooth-2020-12-R1/host&lt;br /&gt;
 mkdir build&lt;br /&gt;
 cd build&lt;br /&gt;
 cmake ..&lt;br /&gt;
 make&lt;br /&gt;
&lt;br /&gt;
If libusb module not found errors occur go to ubertooth-2020-12-R1/host/CMakeLists.txt an add your libusb-path manually:&lt;br /&gt;
&lt;br /&gt;
 include_directories(/opt/homebrew/include)&lt;br /&gt;
 link_directories(/opt/homebrew/lib)&lt;br /&gt;
&lt;br /&gt;
Additionally again change the &amp;quot;from distutils import setup&amp;quot; line in the the ubertooth-2020-12-R1/host/build/python/specan_ui/setup.py file to this:&lt;br /&gt;
&lt;br /&gt;
 from setuptools import setup&lt;br /&gt;
&lt;br /&gt;
Also update the version in that same file to this:&lt;br /&gt;
&lt;br /&gt;
 version = &#039;2020.12.R1&#039;&lt;br /&gt;
&lt;br /&gt;
Then retry:&lt;br /&gt;
&lt;br /&gt;
 make&lt;br /&gt;
&lt;br /&gt;
 sudo make install&lt;br /&gt;
&lt;br /&gt;
If you get errors regarding the environment variables showing that your library wasnt found you need to set the library path via the MacOs&#039;s dynamic linker.&lt;br /&gt;
&lt;br /&gt;
 export DYLD_LIBRARY_PATH=&amp;quot;/usr/local/lib:$DYLD_LIBRARY_PATH&amp;quot;&lt;br /&gt;
&lt;br /&gt;
or make it persistent in shell configurations: &lt;br /&gt;
&lt;br /&gt;
 ~/.zshrc&lt;br /&gt;
&lt;br /&gt;
Afterwards confirm the ubertooth library is working correctly:&lt;br /&gt;
&lt;br /&gt;
 ubertooth-util&lt;br /&gt;
&lt;br /&gt;
=== Step 6 - Test Ubertooth One commands ===&lt;br /&gt;
&lt;br /&gt;
Test these commands:&lt;br /&gt;
&lt;br /&gt;
 ubertooth-util -H&lt;br /&gt;
 ubertooth-util -v&lt;br /&gt;
 ubertooth-util -p&lt;br /&gt;
 ubertooth-util -s&lt;br /&gt;
&lt;br /&gt;
Update Ubertooth firmware in ubertooth-2020-12-R1/ubertooth-one-firmware-bin:&lt;br /&gt;
&lt;br /&gt;
 sudo ubertooth-dfu -d bluetooth_rxtx.dfu -r&lt;br /&gt;
&lt;br /&gt;
In case the libubertooth library is not loading check if the paths are correct.&lt;br /&gt;
&lt;br /&gt;
In ubertooth-2020-12-R1/host the following command leads to getting a list of sniffed Bluetooth packets with their Lower Address Parts (LAP):&lt;br /&gt;
&lt;br /&gt;
 ubertooth-rx&lt;br /&gt;
&lt;br /&gt;
For collecting Upper Address Parts (UAP) from the captured packets add -z:&lt;br /&gt;
&lt;br /&gt;
 ubertooth-rx -z&lt;br /&gt;
&lt;br /&gt;
Let it run for a while and look at the output. It will be summarized as Survey Results at the end of the output. There you can see the significant part of Bluetooth addresses of devices that were scanned. &lt;br /&gt;
&lt;br /&gt;
=== Step 7 - Use BTLE to follow the connection of the Bluetooth device you found. (Replace with device Bluetooth Address) ===&lt;br /&gt;
&lt;br /&gt;
 ubertooth-btle -f B0:67:B5:CF:E5:10 -r test.pcap&lt;br /&gt;
&lt;br /&gt;
Or create a pipe for viewing the captures directly in Wireshark:&lt;br /&gt;
&lt;br /&gt;
 mkfifo /tmp/pipe&lt;br /&gt;
 ubertooth-btle -f B0:67:B5:CF:E5:10 -c /tmp/pipe&lt;br /&gt;
&lt;br /&gt;
Find packages that involve the Polar Smartwatch&lt;br /&gt;
&lt;br /&gt;
 systime=1728247529 freq=2402 addr=8e89bed6 delta_t=34.320 ms rssi=-60&lt;br /&gt;
 20 1b c9 28 84 1a 9e a0 02 01 06 03 02 ee fe 0d ff 6b 00 72 08 00 00 00 00 00 00 00 00 47 e9 1f &lt;br /&gt;
 Advertising / AA 8e89bed6 (valid)/ 27 bytes&lt;br /&gt;
     Channel Index: 37&lt;br /&gt;
     Type:  ADV_IND&lt;br /&gt;
     AdvA:  a0:9e:1a:84:28:c9 (public)&lt;br /&gt;
     AdvData: 02 01 06 03 02 ee fe 0d ff 6b 00 72 08 00 00 00 00 00 00 00 00&lt;br /&gt;
         Type 01 (Flags)&lt;br /&gt;
            00000110&lt;br /&gt;
                LE General Discoverable Mode&lt;br /&gt;
                BR/EDR Not Supported&lt;br /&gt;
         Type 02 (16-bit Service UUIDs, more available)&lt;br /&gt;
            feee&lt;br /&gt;
         Type ff (Manufacturer Specific Data)&lt;br /&gt;
            Company: Polar Electro OY&lt;br /&gt;
            Data: 72 08 00 00 00 00 00 00 00 00&lt;br /&gt;
     Data:  c9 28 84 1a 9e a0 02 01 06 03 02 ee fe 0d ff 6b 00 72 08 00 00 00 00 00 00 00 00&lt;br /&gt;
     CRC:   47 e9 1f&lt;br /&gt;
&lt;br /&gt;
=== Step 8 - Use Crackle to crack packages ===&lt;br /&gt;
&lt;br /&gt;
Enter these commands:&lt;br /&gt;
&lt;br /&gt;
 git clone https://github.com/mikeryan/crackle.git&lt;br /&gt;
 cd crackle&lt;br /&gt;
 make&lt;br /&gt;
&lt;br /&gt;
Now try cracking your pcap.file&lt;br /&gt;
&lt;br /&gt;
 ./crackle -i &amp;lt;your_file.pcap&amp;gt; -o &amp;lt;your_new_output_file.pcap&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this case it wasnt possible to crack any packages from the smartwatch.&lt;br /&gt;
&lt;br /&gt;
=== Step 9 - Install bleak library ===&lt;br /&gt;
&lt;br /&gt;
 pip install bleak&lt;br /&gt;
&lt;br /&gt;
More information can be found in the bleak library documentation. (https://bleak.readthedocs.io/en/latest/usage.html) It also includes sample scripts which were used in the following setup.&lt;br /&gt;
&lt;br /&gt;
=== Step 10 - Write python script for reading device UUID ===&lt;br /&gt;
&lt;br /&gt;
Enter these commands in the shell&lt;br /&gt;
&lt;br /&gt;
 mkdir BLE-scripts&lt;br /&gt;
 cd BLE-scripts&lt;br /&gt;
 nano ble_scan.py&lt;br /&gt;
&lt;br /&gt;
Write simple script to read device UUID using BleakScaner.discover() method:&lt;br /&gt;
 &lt;br /&gt;
 import asyncio&lt;br /&gt;
 from bleak import BleakScanner&lt;br /&gt;
 async def scan():&lt;br /&gt;
     devices = await BleakScanner.discover()&lt;br /&gt;
     for d in devices:&lt;br /&gt;
         print(d)&lt;br /&gt;
 asyncio.run(scan())&lt;br /&gt;
&lt;br /&gt;
Run a scan:&lt;br /&gt;
&lt;br /&gt;
 python3 BLE-scripts/ble_scan.py&lt;br /&gt;
&lt;br /&gt;
Here the device UUID of the Polar smartwatch was found:&lt;br /&gt;
&lt;br /&gt;
 C6C36C4A-7F8F-52B2-2BD7-C4F6690424E7: Polar Vantage M 8428C92D&lt;br /&gt;
&lt;br /&gt;
=== Step 11 - Check GATT services  ===&lt;br /&gt;
&lt;br /&gt;
With the gathered device UUID check for the devices services:&lt;br /&gt;
&lt;br /&gt;
 nano BLE-scripts/ble_services.py&lt;br /&gt;
&lt;br /&gt;
 import asyncio&lt;br /&gt;
 from bleak import BleakClient&lt;br /&gt;
 device_uuid = &amp;quot;C6C36C4A-7F8F-52B2-2BD7-C4F6690424E7&amp;quot;&lt;br /&gt;
 async def connect_to_device(device_uuid):&lt;br /&gt;
     async with BleakClient(device_uuid) as client:&lt;br /&gt;
         connected = client.is_connected&lt;br /&gt;
         print(f&amp;quot;Connected: {connected}&amp;quot;)&lt;br /&gt;
         services = client.services&lt;br /&gt;
         if services is None:&lt;br /&gt;
             await client.get_services()&lt;br /&gt;
         for service in services:&lt;br /&gt;
             print(f&amp;quot;Service: {service}&amp;quot;)&lt;br /&gt;
 loop = asyncio.get_event_loop()&lt;br /&gt;
 loop.run_until_complete(connect_to_device(device_uuid))&lt;br /&gt;
&lt;br /&gt;
Run a services scan:&lt;br /&gt;
&lt;br /&gt;
 python3 BLE-scripts/ble_services.py&lt;br /&gt;
&lt;br /&gt;
Now the service UUIDs that were found are going to be listed like this:&lt;br /&gt;
&lt;br /&gt;
 Service: 0000180a-0000-1000-8000-00805f9b34fb (Handle: 14): Device Information&lt;br /&gt;
 Service: 0000feee-0000-1000-8000-00805f9b34fb (Handle: 29): Polar Electro Oy&lt;br /&gt;
 Service: 0000180d-0000-1000-8000-00805f9b34fb (Handle: 38): Heart Rate&lt;br /&gt;
 Service: 0000180f-0000-1000-8000-00805f9b34fb (Handle: 42): Battery Service&lt;br /&gt;
&lt;br /&gt;
=== Step 12 - Get characteristics UUIDs  ===&lt;br /&gt;
&lt;br /&gt;
 nano BLE-scripts/ble_characteristics.py&lt;br /&gt;
&lt;br /&gt;
 import asyncio&lt;br /&gt;
 from bleak import BleakClient&lt;br /&gt;
 device_uuid = &amp;quot;C6C36C4A-7F8F-52B2-2BD7-C4F6690424E7&amp;quot;&lt;br /&gt;
 async def connect_to_device(device_uuid):&lt;br /&gt;
     async with BleakClient(device_uuid) as client:&lt;br /&gt;
         connected = client.is_connected&lt;br /&gt;
         print(f&amp;quot;Connected: {connected}&amp;quot;)&lt;br /&gt;
         services = client.services&lt;br /&gt;
         if services is None:&lt;br /&gt;
             await client.get_services()&lt;br /&gt;
         for service in services:&lt;br /&gt;
             print(f&amp;quot;Service: {service.uuid} (Handle: {service.handle}): {service.description}&amp;quot;)&lt;br /&gt;
             for characteristic in service.characteristics:&lt;br /&gt;
                 print(f&amp;quot;  Characteristic: {characteristic.uuid} (Handle: {characteristic.handle}) - Properties: {cha$&lt;br /&gt;
 loop = asyncio.get_event_loop()&lt;br /&gt;
 loop.run_until_complete(connect_to_device(device_uuid))&lt;br /&gt;
&lt;br /&gt;
Now run the script:&lt;br /&gt;
&lt;br /&gt;
 python3 BLE-scripts/ble_characteristics.py&lt;br /&gt;
&lt;br /&gt;
Expected output:&lt;br /&gt;
&lt;br /&gt;
 Service: 0000180a-0000-1000-8000-00805f9b34fb (Handle: 14): Device Information&lt;br /&gt;
  Characteristic: 00002a29-0000-1000-8000-00805f9b34fb (Handle: 15) - Properties: [&#039;read&#039;]&lt;br /&gt;
  Characteristic: 00002a24-0000-1000-8000-00805f9b34fb (Handle: 17) - Properties: [&#039;read&#039;]&lt;br /&gt;
  Characteristic: 00002a25-0000-1000-8000-00805f9b34fb (Handle: 19) - Properties: [&#039;read&#039;]&lt;br /&gt;
  Characteristic: 00002a27-0000-1000-8000-00805f9b34fb (Handle: 21) - Properties: [&#039;read&#039;]&lt;br /&gt;
  Characteristic: 00002a26-0000-1000-8000-00805f9b34fb (Handle: 23) - Properties: [&#039;read&#039;]&lt;br /&gt;
  Characteristic: 00002a28-0000-1000-8000-00805f9b34fb (Handle: 25) - Properties: [&#039;read&#039;]&lt;br /&gt;
  Characteristic: 00002a23-0000-1000-8000-00805f9b34fb (Handle: 27) - Properties: [&#039;read&#039;]&lt;br /&gt;
 Service: 0000feee-0000-1000-8000-00805f9b34fb (Handle: 29): Polar Electro Oy&lt;br /&gt;
  Characteristic: fb005c51-02e7-f387-1cad-8acd2d8df0c8 (Handle: 30) - Properties: [&#039;write-without-response&#039;, &#039;write&#039;, &#039;notify&#039;]&lt;br /&gt;
  Characteristic: fb005c52-02e7-f387-1cad-8acd2d8df0c8 (Handle: 33) - Properties: [&#039;notify&#039;]&lt;br /&gt;
  Characteristic: fb005c53-02e7-f387-1cad-8acd2d8df0c8 (Handle: 36) - Properties: [&#039;write-without-response&#039;, &#039;write&#039;]&lt;br /&gt;
 Service: 0000180d-0000-1000-8000-00805f9b34fb (Handle: 38): Heart Rate&lt;br /&gt;
  Characteristic: 00002a37-0000-1000-8000-00805f9b34fb (Handle: 39) - Properties: [&#039;notify&#039;]&lt;br /&gt;
 Service: 0000180f-0000-1000-8000-00805f9b34fb (Handle: 42): Battery Service&lt;br /&gt;
  Characteristic: 00002a19-0000-1000-8000-00805f9b34fb (Handle: 43) - Properties: [&#039;read&#039;, &#039;notify&#039;]&lt;br /&gt;
&lt;br /&gt;
=== Step 13 - Read data ===&lt;br /&gt;
&lt;br /&gt;
Now add a script for reading the actual data. Make sure to use the characteristics UUIDs you have found out.&lt;br /&gt;
&lt;br /&gt;
 nano BLE-scripts/ble_read.py&lt;br /&gt;
&lt;br /&gt;
 import asyncio&lt;br /&gt;
 from bleak import BleakClient&lt;br /&gt;
 device_uuid = &amp;quot;C6C36C4A-7F8F-52B2-2BD7-C4F6690424E7&amp;quot;&lt;br /&gt;
 HEART_RATE_CHAR_UUID = &amp;quot;00002a37-0000-1000-8000-00805f9b34fb&amp;quot;&lt;br /&gt;
 BATTERY_LEVEL_CHAR_UUID = &amp;quot;00002a19-0000-1000-8000-00805f9b34fb&amp;quot;&lt;br /&gt;
 async def connect_and_read_data(device_uuid):&lt;br /&gt;
     async with BleakClient(device_uuid) as client:&lt;br /&gt;
         connected = client.is_connected&lt;br /&gt;
         print(f&amp;quot;Connected: {connected}&amp;quot;)&lt;br /&gt;
         if connected:&lt;br /&gt;
             try:&lt;br /&gt;
                 heart_rate = await client.read_gatt_char(HEART_RATE_CHAR_UUID)&lt;br /&gt;
                 heart_rate = int(heart_rate_data[1])&lt;br /&gt;
                 print(f&amp;quot;Heart Rate: {heart_rate} bpm&amp;quot;)&lt;br /&gt;
             except Exception as e:&lt;br /&gt;
                 print(f&amp;quot;Failed to read heart rate: {e}&amp;quot;)&lt;br /&gt;
             try:&lt;br /&gt;
                 battery_level = await client.read_gatt_char(BATTERY_LEVEL_CHAR_UUID)&lt;br /&gt;
                 print(f&amp;quot;Battery Level: {int(battery_level[0])}%&amp;quot;)&lt;br /&gt;
             except Exception as e:&lt;br /&gt;
                 print(f&amp;quot;Failed to read battery level: {e}&amp;quot;)&lt;br /&gt;
 loop = asyncio.get_event_loop()&lt;br /&gt;
 loop.run_until_complete(connect_and_read_data(device_uuid))&lt;br /&gt;
&lt;br /&gt;
Run script:&lt;br /&gt;
&lt;br /&gt;
 python3 BLE-scripts/ble_read.py&lt;br /&gt;
&lt;br /&gt;
In the output the battery level was succesfully read and printed out. The heart rate couldn&#039;t be accessed because it only has the notify property and no option for reading:&lt;br /&gt;
&lt;br /&gt;
 Connected: True&lt;br /&gt;
 Failed to read heart rate: Failed to read characteristic 39: Error Domain=CBATTErrorDomain Code=2 &amp;quot;Reading is not permitted.&amp;quot; UserInfo={NSLocalizedDescription=Reading is not permitted.}&lt;br /&gt;
 Battery Level: 16%&lt;br /&gt;
&lt;br /&gt;
=== Step 14 - Subscribe to heart rate notifications ===&lt;br /&gt;
&lt;br /&gt;
 nano BLE-scripts/ble_subscribe.py&lt;br /&gt;
&lt;br /&gt;
 import asyncio&lt;br /&gt;
 from bleak import BleakClient&lt;br /&gt;
 device_uuid = &amp;quot;C6C36C4A-7F8F-52B2-2BD7-C4F6690424E7&amp;quot;&lt;br /&gt;
 HEART_RATE_CHAR_UUID = &amp;quot;00002a37-0000-1000-8000-00805f9b34fb&amp;quot;&lt;br /&gt;
 def heart_rate_handler(sender, data):&lt;br /&gt;
     heart_rate = int(data[1]) if len(data) &amp;gt; 1 else None&lt;br /&gt;
     print(f&amp;quot;Heart Rate from {sender}: {heart_rate} bpm&amp;quot;)&lt;br /&gt;
 async def connect_and_subscribe(device_uuid):&lt;br /&gt;
     async with BleakClient(device_uuid) as client:&lt;br /&gt;
         connected = client.is_connected&lt;br /&gt;
         print(f&amp;quot;Connected: {connected}&amp;quot;)&lt;br /&gt;
         if connected:&lt;br /&gt;
             try:&lt;br /&gt;
                 await client.start_notify(HEART_RATE_CHAR_UUID, heart_rate_handler)&lt;br /&gt;
                 print(&amp;quot;Subscribed to heart rate notifications.&amp;quot;)&lt;br /&gt;
                 await asyncio.sleep(60)&lt;br /&gt;
                 await client.stop_notify(HEART_RATE_CHAR_UUID)&lt;br /&gt;
                 print(&amp;quot;Stopped heart rate notifications.&amp;quot;)&lt;br /&gt;
             except Exception as e:&lt;br /&gt;
                 print(f&amp;quot;Failed to subscribe to heart rate notifications: {e}&amp;quot;)&lt;br /&gt;
 asyncio.run(connect_and_subscribe(device_uuid))&lt;br /&gt;
&lt;br /&gt;
 python3 BLE-scripts/ble_subscribe.py&lt;br /&gt;
&lt;br /&gt;
It was not possible to get the heart rate data even though the notify property was assigned. That is because typically battery status data is on a lower securiy level than heart rate data. More information on GATT can be found here: https://www.bluetooth.com/de/bluetooth-resources/intro-to-bluetooth-gap-gatt/&lt;br /&gt;
&lt;br /&gt;
This is the output of the failed try:&lt;br /&gt;
&lt;br /&gt;
 Connected: True&lt;br /&gt;
 Subscribed to heart rate notifications.&lt;br /&gt;
 Stopped heart rate notifications.&lt;br /&gt;
&lt;br /&gt;
== Used Hardware ==&lt;br /&gt;
&lt;br /&gt;
* [[Ubertooth One, 2.4 GHz wireless development platform]]&lt;br /&gt;
&lt;br /&gt;
* [[Polar Vantage M]]&lt;br /&gt;
&lt;br /&gt;
* [[Apple iPhone 13 mini]]&lt;br /&gt;
&lt;br /&gt;
* [[MacBook Air M1, 2020]]&lt;br /&gt;
&lt;br /&gt;
* [[Samsung Galaxy J3]]&lt;br /&gt;
&lt;br /&gt;
== Courses ==&lt;br /&gt;
&lt;br /&gt;
* [[Selected IT-Security Chapters]] (2024)&lt;br /&gt;
&lt;br /&gt;
== Author ==&lt;br /&gt;
&lt;br /&gt;
Are Maksimović&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
* https://ubertooth.readthedocs.io/en/latest/&lt;br /&gt;
* https://www.greatscottgadgets.com/ubertoothone/&lt;br /&gt;
* https://codemuch.net/posts/bluetooth-hacking/&lt;br /&gt;
* https://bleak.readthedocs.io/en/latest/usage.html&lt;br /&gt;
* https://www.bluetooth.com/de/bluetooth-resources/intro-to-bluetooth-gap-gatt/&lt;br /&gt;
* https://support.polar.com/en/vantage-m#all&lt;br /&gt;
* https://wiki.elvis.science/index.php?title=(Article_title)#Example_UUIDs_of_a_Polar_Smartwatch&lt;br /&gt;
&lt;br /&gt;
[[Category:Documentation]]&lt;/div&gt;</summary>
		<author><name>AMaksimovic</name></author>
	</entry>
	<entry>
		<id>https://elvis.hcw.ac.at/wiki/index.php?title=Setting_Up_Ubertooth_on_macOS_for_Bluetooth_Hacking&amp;diff=16740</id>
		<title>Setting Up Ubertooth on macOS for Bluetooth Hacking</title>
		<link rel="alternate" type="text/html" href="https://elvis.hcw.ac.at/wiki/index.php?title=Setting_Up_Ubertooth_on_macOS_for_Bluetooth_Hacking&amp;diff=16740"/>
		<updated>2024-12-05T16:10:23Z</updated>

		<summary type="html">&lt;p&gt;AMaksimovic: /* Requirements */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Summary == &lt;br /&gt;
&lt;br /&gt;
This is a step-by-step guide on how to sniff Bluetooth Low Energy (BLE) packets between a Polar Vantage Smartwatch and a phone using the Ubertooth One. It will go into detail on the setup on a MacBook Air with MacOS using a python environment for the libraries that are used for the setup. Additionally every step of the actual sniff will be outlined. This guide is based on the seminar paper &amp;quot;Smartwatch Hacking Attack&amp;quot; that was written within the FH-course &amp;quot;Selected IT-Security Chapters&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
== Requirements ==&lt;br /&gt;
&lt;br /&gt;
* Hardware tools: Ubertooth One: Firmware version: 2020-12-R1 (API:1.07)&lt;br /&gt;
* Unix-based Operating System: macOS (macOS Sequoia 15.1.1), on a MacBook Air with an Apple M1 chip.&lt;br /&gt;
* Virtual Environment: Python Environment: Python 3.12&lt;br /&gt;
* Packages: libusb, wget, cmake, pkg-config, setuptools, pyqt5, numpy&lt;br /&gt;
* Libraries: libbtbb, bleak&lt;br /&gt;
* Software Tools: Crackle&lt;br /&gt;
&lt;br /&gt;
For the setup this guide was used and adjusted to the given scenario. [[https://ubertooth.readthedocs.io/en/latest/build_guide.html Ubertooth - Build Guide]].&lt;br /&gt;
&lt;br /&gt;
== Description ==&lt;br /&gt;
&lt;br /&gt;
=== Step 1 - Install homebrew ===&lt;br /&gt;
&lt;br /&gt;
Enter these commands in the shell&lt;br /&gt;
&lt;br /&gt;
 /bin/bash -c &amp;quot;$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)&amp;quot;&lt;br /&gt;
 eval &amp;quot;$(/opt/homebrew/bin/brew shellenv)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
=== Step 2 - Install Python Environment ===&lt;br /&gt;
&lt;br /&gt;
Enter these commands in the shell&lt;br /&gt;
&lt;br /&gt;
 python3.12 -m venv myenv&lt;br /&gt;
 source myenv/bin/activate&lt;br /&gt;
&lt;br /&gt;
=== Step 3 - Install libusb, wget, cmake, pkg-config ===&lt;br /&gt;
&lt;br /&gt;
Enter these commands in the shell&lt;br /&gt;
&lt;br /&gt;
 brew install libusb wget cmake pkg-config&lt;br /&gt;
&lt;br /&gt;
=== Step 4 - Install the Bluetooth baseband library ===&lt;br /&gt;
&lt;br /&gt;
Enter these commands in the shell&lt;br /&gt;
&lt;br /&gt;
 wget https://github.com/greatscottgadgets/libbtbb/archive/2020-12-R1.tar.gz -O libbtbb-2020-12-R1.tar.gz&lt;br /&gt;
 tar -xf libbtbb-2020-12-R1.tar.gz&lt;br /&gt;
 cd libbtbb-2020-12-R1&lt;br /&gt;
 mkdir build&lt;br /&gt;
 cd build&lt;br /&gt;
 cmake ..&lt;br /&gt;
 make&lt;br /&gt;
&lt;br /&gt;
If errors occur with installing distutils switch to setuptools instead.&lt;br /&gt;
&lt;br /&gt;
 pip install setuptools&lt;br /&gt;
&lt;br /&gt;
After installing the setuptools also change the &amp;quot;from distutils import setup&amp;quot; line in the the libbtbb-2020-12-R1/build/python/pcaptools/setup.py file to this:&lt;br /&gt;
&lt;br /&gt;
 from setuptools import setup&lt;br /&gt;
&lt;br /&gt;
Also update the version in that same file to this:&lt;br /&gt;
&lt;br /&gt;
 version = &#039;2020.12.R1&#039;&lt;br /&gt;
&lt;br /&gt;
If necessary set the pythonpath in case you have different python versions:&lt;br /&gt;
 &lt;br /&gt;
 export PYTHONPATH=/Users/&amp;lt;username&amp;gt;/myenv/lib/python3.12/site-packages:$PYTHONPATH&lt;br /&gt;
&lt;br /&gt;
Then retry:&lt;br /&gt;
&lt;br /&gt;
 make&lt;br /&gt;
&lt;br /&gt;
 sudo make install&lt;br /&gt;
&lt;br /&gt;
=== Step 5 - Install the Ubertooth repository ===&lt;br /&gt;
&lt;br /&gt;
For this part you can attach the Ubertooth One to the MacBook. BUT DO NOT USE WITHOUT ANTENNA! More information can be found here: https://ubertooth.readthedocs.io/en/latest/ubertooth_one.html&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Enter these commands in the shell&lt;br /&gt;
&lt;br /&gt;
 wget https://github.com/greatscottgadgets/ubertooth/releases/download/2020-12-R1/ubertooth-2020-12-R1.tar.xz&lt;br /&gt;
 tar -xf ubertooth-2020-12-R1.tar.xz&lt;br /&gt;
 cd ubertooth-2020-12-R1/host&lt;br /&gt;
 mkdir build&lt;br /&gt;
 cd build&lt;br /&gt;
 cmake ..&lt;br /&gt;
 make&lt;br /&gt;
&lt;br /&gt;
If libusb module not found errors occur go to ubertooth-2020-12-R1/host/CMakeLists.txt an add your libusb-path manually:&lt;br /&gt;
&lt;br /&gt;
 include_directories(/opt/homebrew/include)&lt;br /&gt;
 link_directories(/opt/homebrew/lib)&lt;br /&gt;
&lt;br /&gt;
Additionally again change the &amp;quot;from distutils import setup&amp;quot; line in the the ubertooth-2020-12-R1/host/build/python/specan_ui/setup.py file to this:&lt;br /&gt;
&lt;br /&gt;
 from setuptools import setup&lt;br /&gt;
&lt;br /&gt;
Also update the version in that same file to this:&lt;br /&gt;
&lt;br /&gt;
 version = &#039;2020.12.R1&#039;&lt;br /&gt;
&lt;br /&gt;
Then retry:&lt;br /&gt;
&lt;br /&gt;
 make&lt;br /&gt;
&lt;br /&gt;
 sudo make install&lt;br /&gt;
&lt;br /&gt;
If you get errors regarding the environment variables showing that your library wasnt found you need to set the library path via the MacOs&#039;s dynamic linker.&lt;br /&gt;
&lt;br /&gt;
 export DYLD_LIBRARY_PATH=&amp;quot;/usr/local/lib:$DYLD_LIBRARY_PATH&amp;quot;&lt;br /&gt;
&lt;br /&gt;
or make it persistent in shell configurations: &lt;br /&gt;
&lt;br /&gt;
 ~/.zshrc&lt;br /&gt;
&lt;br /&gt;
Afterwards confirm the ubertooth library is working correctly:&lt;br /&gt;
&lt;br /&gt;
 ubertooth-util&lt;br /&gt;
&lt;br /&gt;
=== Step 6 - Test Ubertooth One commands ===&lt;br /&gt;
&lt;br /&gt;
Test these commands:&lt;br /&gt;
&lt;br /&gt;
 ubertooth-util -H&lt;br /&gt;
 ubertooth-util -v&lt;br /&gt;
 ubertooth-util -p&lt;br /&gt;
 ubertooth-util -s&lt;br /&gt;
&lt;br /&gt;
Update Ubertooth firmware in ubertooth-2020-12-R1/ubertooth-one-firmware-bin:&lt;br /&gt;
&lt;br /&gt;
 sudo ubertooth-dfu -d bluetooth_rxtx.dfu -r&lt;br /&gt;
&lt;br /&gt;
In case the libubertooth library is not loading check if the paths are correct.&lt;br /&gt;
&lt;br /&gt;
In ubertooth-2020-12-R1/host the following command leads to getting a list of sniffed Bluetooth packets with their Lower Address Parts (LAP):&lt;br /&gt;
&lt;br /&gt;
 ubertooth-rx&lt;br /&gt;
&lt;br /&gt;
For collecting Upper Address Parts (UAP) from the captured packets add -z:&lt;br /&gt;
&lt;br /&gt;
 ubertooth-rx -z&lt;br /&gt;
&lt;br /&gt;
Let it run for a while and look at the output. It will be summarized as Survey Results at the end of the output. There you can see the significant part of Bluetooth addresses of devices that were scanned. &lt;br /&gt;
&lt;br /&gt;
=== Step 7 - Use BTLE to follow the connection of the Bluetooth device you found. (Replace with device Bluetooth Address) ===&lt;br /&gt;
&lt;br /&gt;
 ubertooth-btle -f B0:67:B5:CF:E5:10 -r test.pcap&lt;br /&gt;
&lt;br /&gt;
Or create a pipe for viewing the captures directly in Wireshark:&lt;br /&gt;
&lt;br /&gt;
 mkfifo /tmp/pipe&lt;br /&gt;
 ubertooth-btle -f B0:67:B5:CF:E5:10 -c /tmp/pipe&lt;br /&gt;
&lt;br /&gt;
Find packages that involve the Polar Smartwatch&lt;br /&gt;
&lt;br /&gt;
 systime=1728247529 freq=2402 addr=8e89bed6 delta_t=34.320 ms rssi=-60&lt;br /&gt;
 20 1b c9 28 84 1a 9e a0 02 01 06 03 02 ee fe 0d ff 6b 00 72 08 00 00 00 00 00 00 00 00 47 e9 1f &lt;br /&gt;
 Advertising / AA 8e89bed6 (valid)/ 27 bytes&lt;br /&gt;
     Channel Index: 37&lt;br /&gt;
     Type:  ADV_IND&lt;br /&gt;
     AdvA:  a0:9e:1a:84:28:c9 (public)&lt;br /&gt;
     AdvData: 02 01 06 03 02 ee fe 0d ff 6b 00 72 08 00 00 00 00 00 00 00 00&lt;br /&gt;
         Type 01 (Flags)&lt;br /&gt;
            00000110&lt;br /&gt;
                LE General Discoverable Mode&lt;br /&gt;
                BR/EDR Not Supported&lt;br /&gt;
         Type 02 (16-bit Service UUIDs, more available)&lt;br /&gt;
            feee&lt;br /&gt;
         Type ff (Manufacturer Specific Data)&lt;br /&gt;
            Company: Polar Electro OY&lt;br /&gt;
            Data: 72 08 00 00 00 00 00 00 00 00&lt;br /&gt;
     Data:  c9 28 84 1a 9e a0 02 01 06 03 02 ee fe 0d ff 6b 00 72 08 00 00 00 00 00 00 00 00&lt;br /&gt;
     CRC:   47 e9 1f&lt;br /&gt;
&lt;br /&gt;
=== Step 8 - Use Crackle to crack packages ===&lt;br /&gt;
&lt;br /&gt;
Enter these commands:&lt;br /&gt;
&lt;br /&gt;
 git clone https://github.com/mikeryan/crackle.git&lt;br /&gt;
 cd crackle&lt;br /&gt;
 make&lt;br /&gt;
&lt;br /&gt;
Now try cracking your pcap.file&lt;br /&gt;
&lt;br /&gt;
 ./crackle -i &amp;lt;your_file.pcap&amp;gt; -o &amp;lt;your_new_output_file.pcap&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this case it wasnt possible to crack any packages from the smartwatch.&lt;br /&gt;
&lt;br /&gt;
=== Step 9 - Install bleak library ===&lt;br /&gt;
&lt;br /&gt;
 pip install bleak&lt;br /&gt;
&lt;br /&gt;
More information can be found in the bleak library documentation. (https://bleak.readthedocs.io/en/latest/usage.html) It also includes sample scripts which were used in the following setup.&lt;br /&gt;
&lt;br /&gt;
=== Step 10 - Write python script for reading device UUID ===&lt;br /&gt;
&lt;br /&gt;
Enter these commands in the shell&lt;br /&gt;
&lt;br /&gt;
 mkdir BLE-scripts&lt;br /&gt;
 cd BLE-scripts&lt;br /&gt;
 nano ble_scan.py&lt;br /&gt;
&lt;br /&gt;
Write simple script to read device UUID using BleakScaner.discover() method:&lt;br /&gt;
 &lt;br /&gt;
 import asyncio&lt;br /&gt;
 from bleak import BleakScanner&lt;br /&gt;
 async def scan():&lt;br /&gt;
     devices = await BleakScanner.discover()&lt;br /&gt;
     for d in devices:&lt;br /&gt;
         print(d)&lt;br /&gt;
 asyncio.run(scan())&lt;br /&gt;
&lt;br /&gt;
Run a scan:&lt;br /&gt;
&lt;br /&gt;
 python3 BLE-scripts/ble_scan.py&lt;br /&gt;
&lt;br /&gt;
Here the device UUID of the Polar smartwatch was found:&lt;br /&gt;
&lt;br /&gt;
 C6C36C4A-7F8F-52B2-2BD7-C4F6690424E7: Polar Vantage M 8428C92D&lt;br /&gt;
&lt;br /&gt;
=== Step 11 - Check GATT services  ===&lt;br /&gt;
&lt;br /&gt;
With the gathered device UUID check for the devices services:&lt;br /&gt;
&lt;br /&gt;
 nano BLE-scripts/ble_services.py&lt;br /&gt;
&lt;br /&gt;
 import asyncio&lt;br /&gt;
 from bleak import BleakClient&lt;br /&gt;
 device_uuid = &amp;quot;C6C36C4A-7F8F-52B2-2BD7-C4F6690424E7&amp;quot;&lt;br /&gt;
 async def connect_to_device(device_uuid):&lt;br /&gt;
     async with BleakClient(device_uuid) as client:&lt;br /&gt;
         connected = client.is_connected&lt;br /&gt;
         print(f&amp;quot;Connected: {connected}&amp;quot;)&lt;br /&gt;
         services = client.services&lt;br /&gt;
         if services is None:&lt;br /&gt;
             await client.get_services()&lt;br /&gt;
         for service in services:&lt;br /&gt;
             print(f&amp;quot;Service: {service}&amp;quot;)&lt;br /&gt;
 loop = asyncio.get_event_loop()&lt;br /&gt;
 loop.run_until_complete(connect_to_device(device_uuid))&lt;br /&gt;
&lt;br /&gt;
Run a services scan:&lt;br /&gt;
&lt;br /&gt;
 python3 BLE-scripts/ble_services.py&lt;br /&gt;
&lt;br /&gt;
Now the service UUIDs that were found are going to be listed like this:&lt;br /&gt;
&lt;br /&gt;
 Service: 0000180a-0000-1000-8000-00805f9b34fb (Handle: 14): Device Information&lt;br /&gt;
 Service: 0000feee-0000-1000-8000-00805f9b34fb (Handle: 29): Polar Electro Oy&lt;br /&gt;
 Service: 0000180d-0000-1000-8000-00805f9b34fb (Handle: 38): Heart Rate&lt;br /&gt;
 Service: 0000180f-0000-1000-8000-00805f9b34fb (Handle: 42): Battery Service&lt;br /&gt;
&lt;br /&gt;
=== Step 12 - Get characteristics UUIDs  ===&lt;br /&gt;
&lt;br /&gt;
 nano BLE-scripts/ble_characteristics.py&lt;br /&gt;
&lt;br /&gt;
 import asyncio&lt;br /&gt;
 from bleak import BleakClient&lt;br /&gt;
 device_uuid = &amp;quot;C6C36C4A-7F8F-52B2-2BD7-C4F6690424E7&amp;quot;&lt;br /&gt;
 async def connect_to_device(device_uuid):&lt;br /&gt;
     async with BleakClient(device_uuid) as client:&lt;br /&gt;
         connected = client.is_connected&lt;br /&gt;
         print(f&amp;quot;Connected: {connected}&amp;quot;)&lt;br /&gt;
         services = client.services&lt;br /&gt;
         if services is None:&lt;br /&gt;
             await client.get_services()&lt;br /&gt;
         for service in services:&lt;br /&gt;
             print(f&amp;quot;Service: {service.uuid} (Handle: {service.handle}): {service.description}&amp;quot;)&lt;br /&gt;
             for characteristic in service.characteristics:&lt;br /&gt;
                 print(f&amp;quot;  Characteristic: {characteristic.uuid} (Handle: {characteristic.handle}) - Properties: {cha$&lt;br /&gt;
 loop = asyncio.get_event_loop()&lt;br /&gt;
 loop.run_until_complete(connect_to_device(device_uuid))&lt;br /&gt;
&lt;br /&gt;
Now run the script:&lt;br /&gt;
&lt;br /&gt;
 python3 BLE-scripts/ble_characteristics.py&lt;br /&gt;
&lt;br /&gt;
Expected output:&lt;br /&gt;
&lt;br /&gt;
 Service: 0000180a-0000-1000-8000-00805f9b34fb (Handle: 14): Device Information&lt;br /&gt;
  Characteristic: 00002a29-0000-1000-8000-00805f9b34fb (Handle: 15) - Properties: [&#039;read&#039;]&lt;br /&gt;
  Characteristic: 00002a24-0000-1000-8000-00805f9b34fb (Handle: 17) - Properties: [&#039;read&#039;]&lt;br /&gt;
  Characteristic: 00002a25-0000-1000-8000-00805f9b34fb (Handle: 19) - Properties: [&#039;read&#039;]&lt;br /&gt;
  Characteristic: 00002a27-0000-1000-8000-00805f9b34fb (Handle: 21) - Properties: [&#039;read&#039;]&lt;br /&gt;
  Characteristic: 00002a26-0000-1000-8000-00805f9b34fb (Handle: 23) - Properties: [&#039;read&#039;]&lt;br /&gt;
  Characteristic: 00002a28-0000-1000-8000-00805f9b34fb (Handle: 25) - Properties: [&#039;read&#039;]&lt;br /&gt;
  Characteristic: 00002a23-0000-1000-8000-00805f9b34fb (Handle: 27) - Properties: [&#039;read&#039;]&lt;br /&gt;
 Service: 0000feee-0000-1000-8000-00805f9b34fb (Handle: 29): Polar Electro Oy&lt;br /&gt;
  Characteristic: fb005c51-02e7-f387-1cad-8acd2d8df0c8 (Handle: 30) - Properties: [&#039;write-without-response&#039;, &#039;write&#039;, &#039;notify&#039;]&lt;br /&gt;
  Characteristic: fb005c52-02e7-f387-1cad-8acd2d8df0c8 (Handle: 33) - Properties: [&#039;notify&#039;]&lt;br /&gt;
  Characteristic: fb005c53-02e7-f387-1cad-8acd2d8df0c8 (Handle: 36) - Properties: [&#039;write-without-response&#039;, &#039;write&#039;]&lt;br /&gt;
 Service: 0000180d-0000-1000-8000-00805f9b34fb (Handle: 38): Heart Rate&lt;br /&gt;
  Characteristic: 00002a37-0000-1000-8000-00805f9b34fb (Handle: 39) - Properties: [&#039;notify&#039;]&lt;br /&gt;
 Service: 0000180f-0000-1000-8000-00805f9b34fb (Handle: 42): Battery Service&lt;br /&gt;
  Characteristic: 00002a19-0000-1000-8000-00805f9b34fb (Handle: 43) - Properties: [&#039;read&#039;, &#039;notify&#039;]&lt;br /&gt;
&lt;br /&gt;
=== Step 13 - Read data ===&lt;br /&gt;
&lt;br /&gt;
Now add a script for reading the actual data. Make sure to use the characteristics UUIDs you have found out.&lt;br /&gt;
&lt;br /&gt;
 nano BLE-scripts/ble_read.py&lt;br /&gt;
&lt;br /&gt;
 import asyncio&lt;br /&gt;
 from bleak import BleakClient&lt;br /&gt;
 device_uuid = &amp;quot;C6C36C4A-7F8F-52B2-2BD7-C4F6690424E7&amp;quot;&lt;br /&gt;
 HEART_RATE_CHAR_UUID = &amp;quot;00002a37-0000-1000-8000-00805f9b34fb&amp;quot;&lt;br /&gt;
 BATTERY_LEVEL_CHAR_UUID = &amp;quot;00002a19-0000-1000-8000-00805f9b34fb&amp;quot;&lt;br /&gt;
 async def connect_and_read_data(device_uuid):&lt;br /&gt;
     async with BleakClient(device_uuid) as client:&lt;br /&gt;
         connected = client.is_connected&lt;br /&gt;
         print(f&amp;quot;Connected: {connected}&amp;quot;)&lt;br /&gt;
         if connected:&lt;br /&gt;
             try:&lt;br /&gt;
                 heart_rate = await client.read_gatt_char(HEART_RATE_CHAR_UUID)&lt;br /&gt;
                 heart_rate = int(heart_rate_data[1])&lt;br /&gt;
                 print(f&amp;quot;Heart Rate: {heart_rate} bpm&amp;quot;)&lt;br /&gt;
             except Exception as e:&lt;br /&gt;
                 print(f&amp;quot;Failed to read heart rate: {e}&amp;quot;)&lt;br /&gt;
             try:&lt;br /&gt;
                 battery_level = await client.read_gatt_char(BATTERY_LEVEL_CHAR_UUID)&lt;br /&gt;
                 print(f&amp;quot;Battery Level: {int(battery_level[0])}%&amp;quot;)&lt;br /&gt;
             except Exception as e:&lt;br /&gt;
                 print(f&amp;quot;Failed to read battery level: {e}&amp;quot;)&lt;br /&gt;
 loop = asyncio.get_event_loop()&lt;br /&gt;
 loop.run_until_complete(connect_and_read_data(device_uuid))&lt;br /&gt;
&lt;br /&gt;
Run script:&lt;br /&gt;
&lt;br /&gt;
 python3 BLE-scripts/ble_read.py&lt;br /&gt;
&lt;br /&gt;
In the output the battery level was succesfully read and printed out. The heart rate couldn&#039;t be accessed because it only has the notify property and no option for reading:&lt;br /&gt;
&lt;br /&gt;
 Connected: True&lt;br /&gt;
 Failed to read heart rate: Failed to read characteristic 39: Error Domain=CBATTErrorDomain Code=2 &amp;quot;Reading is not permitted.&amp;quot; UserInfo={NSLocalizedDescription=Reading is not permitted.}&lt;br /&gt;
 Battery Level: 16%&lt;br /&gt;
&lt;br /&gt;
=== Step 14 - Subscribe to heart rate notifications ===&lt;br /&gt;
&lt;br /&gt;
 nano BLE-scripts/ble_subscribe.py&lt;br /&gt;
&lt;br /&gt;
 import asyncio&lt;br /&gt;
 from bleak import BleakClient&lt;br /&gt;
 device_uuid = &amp;quot;C6C36C4A-7F8F-52B2-2BD7-C4F6690424E7&amp;quot;&lt;br /&gt;
 HEART_RATE_CHAR_UUID = &amp;quot;00002a37-0000-1000-8000-00805f9b34fb&amp;quot;&lt;br /&gt;
 def heart_rate_handler(sender, data):&lt;br /&gt;
     heart_rate = int(data[1]) if len(data) &amp;gt; 1 else None&lt;br /&gt;
     print(f&amp;quot;Heart Rate from {sender}: {heart_rate} bpm&amp;quot;)&lt;br /&gt;
 async def connect_and_subscribe(device_uuid):&lt;br /&gt;
     async with BleakClient(device_uuid) as client:&lt;br /&gt;
         connected = client.is_connected&lt;br /&gt;
         print(f&amp;quot;Connected: {connected}&amp;quot;)&lt;br /&gt;
         if connected:&lt;br /&gt;
             try:&lt;br /&gt;
                 await client.start_notify(HEART_RATE_CHAR_UUID, heart_rate_handler)&lt;br /&gt;
                 print(&amp;quot;Subscribed to heart rate notifications.&amp;quot;)&lt;br /&gt;
                 await asyncio.sleep(60)&lt;br /&gt;
                 await client.stop_notify(HEART_RATE_CHAR_UUID)&lt;br /&gt;
                 print(&amp;quot;Stopped heart rate notifications.&amp;quot;)&lt;br /&gt;
             except Exception as e:&lt;br /&gt;
                 print(f&amp;quot;Failed to subscribe to heart rate notifications: {e}&amp;quot;)&lt;br /&gt;
 asyncio.run(connect_and_subscribe(device_uuid))&lt;br /&gt;
&lt;br /&gt;
 python3 BLE-scripts/ble_subscribe.py&lt;br /&gt;
&lt;br /&gt;
It was not possible to get the heart rate data even though the notify property was assigned. That is because typically battery status data is on a lower securiy level than heart rate data. More information on GATT can be found here: https://www.bluetooth.com/de/bluetooth-resources/intro-to-bluetooth-gap-gatt/&lt;br /&gt;
&lt;br /&gt;
This is the output of the failed try:&lt;br /&gt;
&lt;br /&gt;
 Connected: True&lt;br /&gt;
 Subscribed to heart rate notifications.&lt;br /&gt;
 Stopped heart rate notifications.&lt;br /&gt;
&lt;br /&gt;
== Used Hardware ==&lt;br /&gt;
&lt;br /&gt;
* [[Ubertooth One, 2.4 GHz wireless development platform]]&lt;br /&gt;
&lt;br /&gt;
* [[Polar Vantage M]]&lt;br /&gt;
&lt;br /&gt;
* [[Apple iPhone 13 mini]]&lt;br /&gt;
&lt;br /&gt;
* [[MacBook Air M1, 2020]]&lt;br /&gt;
&lt;br /&gt;
* [[Samsung Galaxy J3]]&lt;br /&gt;
&lt;br /&gt;
== Courses ==&lt;br /&gt;
&lt;br /&gt;
* [[Selected IT-Security Chapters]] (2024)&lt;br /&gt;
&lt;br /&gt;
== Author ==&lt;br /&gt;
&lt;br /&gt;
Are Maksimović&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
* https://ubertooth.readthedocs.io/en/latest/&lt;br /&gt;
* https://www.greatscottgadgets.com/ubertoothone/&lt;br /&gt;
* https://codemuch.net/posts/bluetooth-hacking/&lt;br /&gt;
* https://bleak.readthedocs.io/en/latest/usage.html&lt;br /&gt;
* https://www.bluetooth.com/de/bluetooth-resources/intro-to-bluetooth-gap-gatt/&lt;br /&gt;
* https://support.polar.com/en/vantage-m#all&lt;br /&gt;
* https://wiki.elvis.science/index.php?title=(Article_title)#Example_UUIDs_of_a_Polar_Smartwatch&lt;br /&gt;
&lt;br /&gt;
[[Category:Documentation]]&lt;/div&gt;</summary>
		<author><name>AMaksimovic</name></author>
	</entry>
	<entry>
		<id>https://elvis.hcw.ac.at/wiki/index.php?title=B-LE_-_GATT_Architectural_Overview&amp;diff=16739</id>
		<title>B-LE - GATT Architectural Overview</title>
		<link rel="alternate" type="text/html" href="https://elvis.hcw.ac.at/wiki/index.php?title=B-LE_-_GATT_Architectural_Overview&amp;diff=16739"/>
		<updated>2024-12-05T16:09:31Z</updated>

		<summary type="html">&lt;p&gt;AMaksimovic: /* Services */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Description =&lt;br /&gt;
&lt;br /&gt;
This article goes into detail about GATT architectural features and its usage in Bluetooth LE Security designs. The research for this article was initiated during writing the paper on hacking a bluetooth smartwatch. There is an entire documentation on the practical experiment in [[Setting Up Ubertooth on macOS for Bluetooth Hacking]]. The network topology of a B-LE GATT network contains so-called central devices and peripheral devices. One peripheral is only connected to only one central device at a time. A central device can connect to many peripheral devices. The peripheral is also acting as the GATT server. It contains the definitions for profiles, services and characteristics of a device. The central device always initiates the data exchange.&lt;br /&gt;
&lt;br /&gt;
= B-LE GATT Overview =&lt;br /&gt;
&lt;br /&gt;
== GAP - Generic Attribute Profile ==&lt;br /&gt;
&lt;br /&gt;
The Generic attribute profile takes care of discovery, security, connectivity and network technolgies of a device as well as it&#039;s role. These are examples of packages during pairing:&lt;br /&gt;
&lt;br /&gt;
 ADV_IND&lt;br /&gt;
 SCAN_REQ&lt;br /&gt;
 SCAN_RSP&lt;br /&gt;
 CONNECT_IND&lt;br /&gt;
 AUX_SCAN_REQ&lt;br /&gt;
 AUX_SCAN_RSP&lt;br /&gt;
 AUX_CONNECT_REQ&lt;br /&gt;
 AUX_CONNECT_RSP&lt;br /&gt;
 ADV_SCAN_IND&lt;br /&gt;
&lt;br /&gt;
== GATT - Generic Attribute Profile ==&lt;br /&gt;
&lt;br /&gt;
As soon as two Bluetooth Low Energy devices establish a connection they can start transfering data back and forth. This data is formated into Services and Characteristics in a Server/Client relationship.&lt;br /&gt;
&lt;br /&gt;
=== ATT - Attribute Protocol ===&lt;br /&gt;
&lt;br /&gt;
GATT is based on ATT. Each attribute gets it’s own Unique Identifier (UUID) here. It takes care of the data exchange and error handling. These get categorized as characteristics and services with GATT.&lt;br /&gt;
&lt;br /&gt;
=== Profiles ===&lt;br /&gt;
&lt;br /&gt;
Each profile has a set of services according to its profile type. Example profiles are Basic audio profiles, Location and navigation profiles, weight scale profile, heart rate profile, etc...&lt;br /&gt;
&lt;br /&gt;
=== Services ===&lt;br /&gt;
&lt;br /&gt;
A Service can have multiple characteristics. It has it’s own UUID. It has a handle. UUID, permissions and a value.&lt;br /&gt;
&lt;br /&gt;
Example services are [[https://www.bluetooth.com/specifications/assigned-numbers/ Bluetooth Specifications]]:&lt;br /&gt;
&lt;br /&gt;
 Alert Notification Service 0x1811&lt;br /&gt;
 Audio Input Control Service 0x1843&lt;br /&gt;
 Authorization Control Service 0x183D&lt;br /&gt;
 Battery Service 0x180F&lt;br /&gt;
 Binary Sensor Service 0x183B&lt;br /&gt;
 Blood Pressure Service 0x1810&lt;br /&gt;
 Broadcast Audio Scan Service 0x184F&lt;br /&gt;
 Common Audio Service 0x1853&lt;br /&gt;
&lt;br /&gt;
=== Characteristics ===&lt;br /&gt;
&lt;br /&gt;
The characteristics are the lowest-level of the GATT Profiles. They also each use their own UUID.&lt;br /&gt;
These are relevant when it comes to protecting and enhancing security of a Bluetooth Low Energy device.&lt;br /&gt;
The characteristics have a value, properties and human-readable descriptors.&lt;br /&gt;
&lt;br /&gt;
== Example UUIDs of a Polar Smartwatch ==&lt;br /&gt;
&lt;br /&gt;
Example Device UUID:&lt;br /&gt;
 &lt;br /&gt;
 C6C36C4A-7F8F-52B2-2BD7-C4F6690424E7&lt;br /&gt;
&lt;br /&gt;
Example Service UUIDs:&lt;br /&gt;
&lt;br /&gt;
 Service: 0000180a-0000-1000-8000-00805f9b34fb (Handle: 14): Device Information&lt;br /&gt;
 Service: 0000feee-0000-1000-8000-00805f9b34fb (Handle: 29): Polar Electro Oy&lt;br /&gt;
 Service: 0000180d-0000-1000-8000-00805f9b34fb (Handle: 38): Heart Rate&lt;br /&gt;
 Service: 0000180f-0000-1000-8000-00805f9b34fb (Handle: 42): Battery Service&lt;br /&gt;
&lt;br /&gt;
Example service and their characteristics UUIDs including handles, permissions, properties, values, descriptors:&lt;br /&gt;
&lt;br /&gt;
 Service: 0000180a-0000-1000-8000-00805f9b34fb (Handle: 14): Device Information&lt;br /&gt;
  Characteristic: 00002a29-0000-1000-8000-00805f9b34fb (Handle: 15) - Properties: [&#039;read&#039;]&lt;br /&gt;
  Characteristic: 00002a24-0000-1000-8000-00805f9b34fb (Handle: 17) - Properties: [&#039;read&#039;]&lt;br /&gt;
  Characteristic: 00002a25-0000-1000-8000-00805f9b34fb (Handle: 19) - Properties: [&#039;read&#039;]&lt;br /&gt;
  Characteristic: 00002a27-0000-1000-8000-00805f9b34fb (Handle: 21) - Properties: [&#039;read&#039;]&lt;br /&gt;
  Characteristic: 00002a26-0000-1000-8000-00805f9b34fb (Handle: 23) - Properties: [&#039;read&#039;]&lt;br /&gt;
  Characteristic: 00002a28-0000-1000-8000-00805f9b34fb (Handle: 25) - Properties: [&#039;read&#039;]&lt;br /&gt;
  Characteristic: 00002a23-0000-1000-8000-00805f9b34fb (Handle: 27) - Properties: [&#039;read&#039;]&lt;br /&gt;
 Service: 0000feee-0000-1000-8000-00805f9b34fb (Handle: 29): Polar Electro Oy&lt;br /&gt;
  Characteristic: fb005c51-02e7-f387-1cad-8acd2d8df0c8 (Handle: 30) - Properties: [&#039;write-without-response&#039;, &#039;write&#039;, &#039;notify&#039;]&lt;br /&gt;
  Characteristic: fb005c52-02e7-f387-1cad-8acd2d8df0c8 (Handle: 33) - Properties: [&#039;notify&#039;]&lt;br /&gt;
  Characteristic: fb005c53-02e7-f387-1cad-8acd2d8df0c8 (Handle: 36) - Properties: [&#039;write-without-response&#039;, &#039;write&#039;]&lt;br /&gt;
 Service: 0000180d-0000-1000-8000-00805f9b34fb (Handle: 38): Heart Rate&lt;br /&gt;
  Characteristic: 00002a37-0000-1000-8000-00805f9b34fb (Handle: 39) - Properties: [&#039;notify&#039;]&lt;br /&gt;
 Service: 0000180f-0000-1000-8000-00805f9b34fb (Handle: 42): Battery Service&lt;br /&gt;
  Characteristic: 00002a19-0000-1000-8000-00805f9b34fb (Handle: 43) - Properties: [&#039;read&#039;, &#039;notify&#039;]&lt;br /&gt;
&lt;br /&gt;
== BLE Operations ==&lt;br /&gt;
&lt;br /&gt;
Based on the characteristic&#039;s properties these operations can be executed on the target devices characteristics:&lt;br /&gt;
&lt;br /&gt;
* Read = Read the data of a characteristic&lt;br /&gt;
&lt;br /&gt;
* Write = Write data to a characteristic&lt;br /&gt;
&lt;br /&gt;
* Notify = Get notifications to value changes of a device by subscribing to it&lt;br /&gt;
&lt;br /&gt;
= Further Context =&lt;br /&gt;
&lt;br /&gt;
For further context and practical examples make sure to read:&lt;br /&gt;
&lt;br /&gt;
* Setting Up Ubertooth on macOS for Bluetooth Hacking [https://wiki.elvis.science/index.php?title=Setting_Up_Ubertooth_on_macOS_for_Bluetooth_Hacking]&lt;br /&gt;
&lt;br /&gt;
= Courses =&lt;br /&gt;
&lt;br /&gt;
* [[Selected IT-Security Chapters]] (2024)&lt;br /&gt;
&lt;br /&gt;
= Author =&lt;br /&gt;
Are Maksimović&lt;br /&gt;
&lt;br /&gt;
= References =&lt;br /&gt;
&lt;br /&gt;
* https://bleak.readthedocs.io/en/latest/usage.html&lt;br /&gt;
* https://www.bluetooth.com/de/bluetooth-resources/intro-to-bluetooth-gap-gatt/&lt;br /&gt;
[[Category:Documentation]]&lt;/div&gt;</summary>
		<author><name>AMaksimovic</name></author>
	</entry>
	<entry>
		<id>https://elvis.hcw.ac.at/wiki/index.php?title=B-LE_-_GATT_Architectural_Overview&amp;diff=16738</id>
		<title>B-LE - GATT Architectural Overview</title>
		<link rel="alternate" type="text/html" href="https://elvis.hcw.ac.at/wiki/index.php?title=B-LE_-_GATT_Architectural_Overview&amp;diff=16738"/>
		<updated>2024-12-05T16:06:34Z</updated>

		<summary type="html">&lt;p&gt;AMaksimovic: /* Services */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Description =&lt;br /&gt;
&lt;br /&gt;
This article goes into detail about GATT architectural features and its usage in Bluetooth LE Security designs. The research for this article was initiated during writing the paper on hacking a bluetooth smartwatch. There is an entire documentation on the practical experiment in [[Setting Up Ubertooth on macOS for Bluetooth Hacking]]. The network topology of a B-LE GATT network contains so-called central devices and peripheral devices. One peripheral is only connected to only one central device at a time. A central device can connect to many peripheral devices. The peripheral is also acting as the GATT server. It contains the definitions for profiles, services and characteristics of a device. The central device always initiates the data exchange.&lt;br /&gt;
&lt;br /&gt;
= B-LE GATT Overview =&lt;br /&gt;
&lt;br /&gt;
== GAP - Generic Attribute Profile ==&lt;br /&gt;
&lt;br /&gt;
The Generic attribute profile takes care of discovery, security, connectivity and network technolgies of a device as well as it&#039;s role. These are examples of packages during pairing:&lt;br /&gt;
&lt;br /&gt;
 ADV_IND&lt;br /&gt;
 SCAN_REQ&lt;br /&gt;
 SCAN_RSP&lt;br /&gt;
 CONNECT_IND&lt;br /&gt;
 AUX_SCAN_REQ&lt;br /&gt;
 AUX_SCAN_RSP&lt;br /&gt;
 AUX_CONNECT_REQ&lt;br /&gt;
 AUX_CONNECT_RSP&lt;br /&gt;
 ADV_SCAN_IND&lt;br /&gt;
&lt;br /&gt;
== GATT - Generic Attribute Profile ==&lt;br /&gt;
&lt;br /&gt;
As soon as two Bluetooth Low Energy devices establish a connection they can start transfering data back and forth. This data is formated into Services and Characteristics in a Server/Client relationship.&lt;br /&gt;
&lt;br /&gt;
=== ATT - Attribute Protocol ===&lt;br /&gt;
&lt;br /&gt;
GATT is based on ATT. Each attribute gets it’s own Unique Identifier (UUID) here. It takes care of the data exchange and error handling. These get categorized as characteristics and services with GATT.&lt;br /&gt;
&lt;br /&gt;
=== Profiles ===&lt;br /&gt;
&lt;br /&gt;
Each profile has a set of services according to its profile type. Example profiles are Basic audio profiles, Location and navigation profiles, weight scale profile, heart rate profile, etc...&lt;br /&gt;
&lt;br /&gt;
=== Services ===&lt;br /&gt;
&lt;br /&gt;
A Service can have multiple characteristics. It has it’s own UUID. It has a handle. UUID, permissions and a value.&lt;br /&gt;
&lt;br /&gt;
Example services are [[Bluetooth Specifications]] [[https://www.bluetooth.com/specifications/assigned-numbers/]]:&lt;br /&gt;
&lt;br /&gt;
 Alert Notification Service 0x1811&lt;br /&gt;
 Audio Input Control Service 0x1843&lt;br /&gt;
 Authorization Control Service 0x183D&lt;br /&gt;
 Battery Service 0x180F&lt;br /&gt;
 Binary Sensor Service 0x183B&lt;br /&gt;
 Blood Pressure Service 0x1810&lt;br /&gt;
 Broadcast Audio Scan Service 0x184F&lt;br /&gt;
 Common Audio Service 0x1853&lt;br /&gt;
&lt;br /&gt;
=== Characteristics ===&lt;br /&gt;
&lt;br /&gt;
The characteristics are the lowest-level of the GATT Profiles. They also each use their own UUID.&lt;br /&gt;
These are relevant when it comes to protecting and enhancing security of a Bluetooth Low Energy device.&lt;br /&gt;
The characteristics have a value, properties and human-readable descriptors.&lt;br /&gt;
&lt;br /&gt;
== Example UUIDs of a Polar Smartwatch ==&lt;br /&gt;
&lt;br /&gt;
Example Device UUID:&lt;br /&gt;
 &lt;br /&gt;
 C6C36C4A-7F8F-52B2-2BD7-C4F6690424E7&lt;br /&gt;
&lt;br /&gt;
Example Service UUIDs:&lt;br /&gt;
&lt;br /&gt;
 Service: 0000180a-0000-1000-8000-00805f9b34fb (Handle: 14): Device Information&lt;br /&gt;
 Service: 0000feee-0000-1000-8000-00805f9b34fb (Handle: 29): Polar Electro Oy&lt;br /&gt;
 Service: 0000180d-0000-1000-8000-00805f9b34fb (Handle: 38): Heart Rate&lt;br /&gt;
 Service: 0000180f-0000-1000-8000-00805f9b34fb (Handle: 42): Battery Service&lt;br /&gt;
&lt;br /&gt;
Example service and their characteristics UUIDs including handles, permissions, properties, values, descriptors:&lt;br /&gt;
&lt;br /&gt;
 Service: 0000180a-0000-1000-8000-00805f9b34fb (Handle: 14): Device Information&lt;br /&gt;
  Characteristic: 00002a29-0000-1000-8000-00805f9b34fb (Handle: 15) - Properties: [&#039;read&#039;]&lt;br /&gt;
  Characteristic: 00002a24-0000-1000-8000-00805f9b34fb (Handle: 17) - Properties: [&#039;read&#039;]&lt;br /&gt;
  Characteristic: 00002a25-0000-1000-8000-00805f9b34fb (Handle: 19) - Properties: [&#039;read&#039;]&lt;br /&gt;
  Characteristic: 00002a27-0000-1000-8000-00805f9b34fb (Handle: 21) - Properties: [&#039;read&#039;]&lt;br /&gt;
  Characteristic: 00002a26-0000-1000-8000-00805f9b34fb (Handle: 23) - Properties: [&#039;read&#039;]&lt;br /&gt;
  Characteristic: 00002a28-0000-1000-8000-00805f9b34fb (Handle: 25) - Properties: [&#039;read&#039;]&lt;br /&gt;
  Characteristic: 00002a23-0000-1000-8000-00805f9b34fb (Handle: 27) - Properties: [&#039;read&#039;]&lt;br /&gt;
 Service: 0000feee-0000-1000-8000-00805f9b34fb (Handle: 29): Polar Electro Oy&lt;br /&gt;
  Characteristic: fb005c51-02e7-f387-1cad-8acd2d8df0c8 (Handle: 30) - Properties: [&#039;write-without-response&#039;, &#039;write&#039;, &#039;notify&#039;]&lt;br /&gt;
  Characteristic: fb005c52-02e7-f387-1cad-8acd2d8df0c8 (Handle: 33) - Properties: [&#039;notify&#039;]&lt;br /&gt;
  Characteristic: fb005c53-02e7-f387-1cad-8acd2d8df0c8 (Handle: 36) - Properties: [&#039;write-without-response&#039;, &#039;write&#039;]&lt;br /&gt;
 Service: 0000180d-0000-1000-8000-00805f9b34fb (Handle: 38): Heart Rate&lt;br /&gt;
  Characteristic: 00002a37-0000-1000-8000-00805f9b34fb (Handle: 39) - Properties: [&#039;notify&#039;]&lt;br /&gt;
 Service: 0000180f-0000-1000-8000-00805f9b34fb (Handle: 42): Battery Service&lt;br /&gt;
  Characteristic: 00002a19-0000-1000-8000-00805f9b34fb (Handle: 43) - Properties: [&#039;read&#039;, &#039;notify&#039;]&lt;br /&gt;
&lt;br /&gt;
== BLE Operations ==&lt;br /&gt;
&lt;br /&gt;
Based on the characteristic&#039;s properties these operations can be executed on the target devices characteristics:&lt;br /&gt;
&lt;br /&gt;
* Read = Read the data of a characteristic&lt;br /&gt;
&lt;br /&gt;
* Write = Write data to a characteristic&lt;br /&gt;
&lt;br /&gt;
* Notify = Get notifications to value changes of a device by subscribing to it&lt;br /&gt;
&lt;br /&gt;
= Further Context =&lt;br /&gt;
&lt;br /&gt;
For further context and practical examples make sure to read:&lt;br /&gt;
&lt;br /&gt;
* Setting Up Ubertooth on macOS for Bluetooth Hacking [https://wiki.elvis.science/index.php?title=Setting_Up_Ubertooth_on_macOS_for_Bluetooth_Hacking]&lt;br /&gt;
&lt;br /&gt;
= Courses =&lt;br /&gt;
&lt;br /&gt;
* [[Selected IT-Security Chapters]] (2024)&lt;br /&gt;
&lt;br /&gt;
= Author =&lt;br /&gt;
Are Maksimović&lt;br /&gt;
&lt;br /&gt;
= References =&lt;br /&gt;
&lt;br /&gt;
* https://bleak.readthedocs.io/en/latest/usage.html&lt;br /&gt;
* https://www.bluetooth.com/de/bluetooth-resources/intro-to-bluetooth-gap-gatt/&lt;br /&gt;
[[Category:Documentation]]&lt;/div&gt;</summary>
		<author><name>AMaksimovic</name></author>
	</entry>
	<entry>
		<id>https://elvis.hcw.ac.at/wiki/index.php?title=B-LE_-_GATT_Architectural_Overview&amp;diff=16737</id>
		<title>B-LE - GATT Architectural Overview</title>
		<link rel="alternate" type="text/html" href="https://elvis.hcw.ac.at/wiki/index.php?title=B-LE_-_GATT_Architectural_Overview&amp;diff=16737"/>
		<updated>2024-12-05T16:05:57Z</updated>

		<summary type="html">&lt;p&gt;AMaksimovic: /* Services */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Description =&lt;br /&gt;
&lt;br /&gt;
This article goes into detail about GATT architectural features and its usage in Bluetooth LE Security designs. The research for this article was initiated during writing the paper on hacking a bluetooth smartwatch. There is an entire documentation on the practical experiment in [[Setting Up Ubertooth on macOS for Bluetooth Hacking]]. The network topology of a B-LE GATT network contains so-called central devices and peripheral devices. One peripheral is only connected to only one central device at a time. A central device can connect to many peripheral devices. The peripheral is also acting as the GATT server. It contains the definitions for profiles, services and characteristics of a device. The central device always initiates the data exchange.&lt;br /&gt;
&lt;br /&gt;
= B-LE GATT Overview =&lt;br /&gt;
&lt;br /&gt;
== GAP - Generic Attribute Profile ==&lt;br /&gt;
&lt;br /&gt;
The Generic attribute profile takes care of discovery, security, connectivity and network technolgies of a device as well as it&#039;s role. These are examples of packages during pairing:&lt;br /&gt;
&lt;br /&gt;
 ADV_IND&lt;br /&gt;
 SCAN_REQ&lt;br /&gt;
 SCAN_RSP&lt;br /&gt;
 CONNECT_IND&lt;br /&gt;
 AUX_SCAN_REQ&lt;br /&gt;
 AUX_SCAN_RSP&lt;br /&gt;
 AUX_CONNECT_REQ&lt;br /&gt;
 AUX_CONNECT_RSP&lt;br /&gt;
 ADV_SCAN_IND&lt;br /&gt;
&lt;br /&gt;
== GATT - Generic Attribute Profile ==&lt;br /&gt;
&lt;br /&gt;
As soon as two Bluetooth Low Energy devices establish a connection they can start transfering data back and forth. This data is formated into Services and Characteristics in a Server/Client relationship.&lt;br /&gt;
&lt;br /&gt;
=== ATT - Attribute Protocol ===&lt;br /&gt;
&lt;br /&gt;
GATT is based on ATT. Each attribute gets it’s own Unique Identifier (UUID) here. It takes care of the data exchange and error handling. These get categorized as characteristics and services with GATT.&lt;br /&gt;
&lt;br /&gt;
=== Profiles ===&lt;br /&gt;
&lt;br /&gt;
Each profile has a set of services according to its profile type. Example profiles are Basic audio profiles, Location and navigation profiles, weight scale profile, heart rate profile, etc...&lt;br /&gt;
&lt;br /&gt;
=== Services ===&lt;br /&gt;
&lt;br /&gt;
A Service can have multiple characteristics. It has it’s own UUID. It has a handle. UUID, permissions and a value.&lt;br /&gt;
&lt;br /&gt;
Example services are [Bluetooth Specifications [https://www.bluetooth.com/specifications/assigned-numbers/]]:&lt;br /&gt;
&lt;br /&gt;
 Alert Notification Service 0x1811&lt;br /&gt;
 Audio Input Control Service 0x1843&lt;br /&gt;
 Authorization Control Service 0x183D&lt;br /&gt;
 Battery Service 0x180F&lt;br /&gt;
 Binary Sensor Service 0x183B&lt;br /&gt;
 Blood Pressure Service 0x1810&lt;br /&gt;
 Broadcast Audio Scan Service 0x184F&lt;br /&gt;
 Common Audio Service 0x1853&lt;br /&gt;
&lt;br /&gt;
=== Characteristics ===&lt;br /&gt;
&lt;br /&gt;
The characteristics are the lowest-level of the GATT Profiles. They also each use their own UUID.&lt;br /&gt;
These are relevant when it comes to protecting and enhancing security of a Bluetooth Low Energy device.&lt;br /&gt;
The characteristics have a value, properties and human-readable descriptors.&lt;br /&gt;
&lt;br /&gt;
== Example UUIDs of a Polar Smartwatch ==&lt;br /&gt;
&lt;br /&gt;
Example Device UUID:&lt;br /&gt;
 &lt;br /&gt;
 C6C36C4A-7F8F-52B2-2BD7-C4F6690424E7&lt;br /&gt;
&lt;br /&gt;
Example Service UUIDs:&lt;br /&gt;
&lt;br /&gt;
 Service: 0000180a-0000-1000-8000-00805f9b34fb (Handle: 14): Device Information&lt;br /&gt;
 Service: 0000feee-0000-1000-8000-00805f9b34fb (Handle: 29): Polar Electro Oy&lt;br /&gt;
 Service: 0000180d-0000-1000-8000-00805f9b34fb (Handle: 38): Heart Rate&lt;br /&gt;
 Service: 0000180f-0000-1000-8000-00805f9b34fb (Handle: 42): Battery Service&lt;br /&gt;
&lt;br /&gt;
Example service and their characteristics UUIDs including handles, permissions, properties, values, descriptors:&lt;br /&gt;
&lt;br /&gt;
 Service: 0000180a-0000-1000-8000-00805f9b34fb (Handle: 14): Device Information&lt;br /&gt;
  Characteristic: 00002a29-0000-1000-8000-00805f9b34fb (Handle: 15) - Properties: [&#039;read&#039;]&lt;br /&gt;
  Characteristic: 00002a24-0000-1000-8000-00805f9b34fb (Handle: 17) - Properties: [&#039;read&#039;]&lt;br /&gt;
  Characteristic: 00002a25-0000-1000-8000-00805f9b34fb (Handle: 19) - Properties: [&#039;read&#039;]&lt;br /&gt;
  Characteristic: 00002a27-0000-1000-8000-00805f9b34fb (Handle: 21) - Properties: [&#039;read&#039;]&lt;br /&gt;
  Characteristic: 00002a26-0000-1000-8000-00805f9b34fb (Handle: 23) - Properties: [&#039;read&#039;]&lt;br /&gt;
  Characteristic: 00002a28-0000-1000-8000-00805f9b34fb (Handle: 25) - Properties: [&#039;read&#039;]&lt;br /&gt;
  Characteristic: 00002a23-0000-1000-8000-00805f9b34fb (Handle: 27) - Properties: [&#039;read&#039;]&lt;br /&gt;
 Service: 0000feee-0000-1000-8000-00805f9b34fb (Handle: 29): Polar Electro Oy&lt;br /&gt;
  Characteristic: fb005c51-02e7-f387-1cad-8acd2d8df0c8 (Handle: 30) - Properties: [&#039;write-without-response&#039;, &#039;write&#039;, &#039;notify&#039;]&lt;br /&gt;
  Characteristic: fb005c52-02e7-f387-1cad-8acd2d8df0c8 (Handle: 33) - Properties: [&#039;notify&#039;]&lt;br /&gt;
  Characteristic: fb005c53-02e7-f387-1cad-8acd2d8df0c8 (Handle: 36) - Properties: [&#039;write-without-response&#039;, &#039;write&#039;]&lt;br /&gt;
 Service: 0000180d-0000-1000-8000-00805f9b34fb (Handle: 38): Heart Rate&lt;br /&gt;
  Characteristic: 00002a37-0000-1000-8000-00805f9b34fb (Handle: 39) - Properties: [&#039;notify&#039;]&lt;br /&gt;
 Service: 0000180f-0000-1000-8000-00805f9b34fb (Handle: 42): Battery Service&lt;br /&gt;
  Characteristic: 00002a19-0000-1000-8000-00805f9b34fb (Handle: 43) - Properties: [&#039;read&#039;, &#039;notify&#039;]&lt;br /&gt;
&lt;br /&gt;
== BLE Operations ==&lt;br /&gt;
&lt;br /&gt;
Based on the characteristic&#039;s properties these operations can be executed on the target devices characteristics:&lt;br /&gt;
&lt;br /&gt;
* Read = Read the data of a characteristic&lt;br /&gt;
&lt;br /&gt;
* Write = Write data to a characteristic&lt;br /&gt;
&lt;br /&gt;
* Notify = Get notifications to value changes of a device by subscribing to it&lt;br /&gt;
&lt;br /&gt;
= Further Context =&lt;br /&gt;
&lt;br /&gt;
For further context and practical examples make sure to read:&lt;br /&gt;
&lt;br /&gt;
* Setting Up Ubertooth on macOS for Bluetooth Hacking [https://wiki.elvis.science/index.php?title=Setting_Up_Ubertooth_on_macOS_for_Bluetooth_Hacking]&lt;br /&gt;
&lt;br /&gt;
= Courses =&lt;br /&gt;
&lt;br /&gt;
* [[Selected IT-Security Chapters]] (2024)&lt;br /&gt;
&lt;br /&gt;
= Author =&lt;br /&gt;
Are Maksimović&lt;br /&gt;
&lt;br /&gt;
= References =&lt;br /&gt;
&lt;br /&gt;
* https://bleak.readthedocs.io/en/latest/usage.html&lt;br /&gt;
* https://www.bluetooth.com/de/bluetooth-resources/intro-to-bluetooth-gap-gatt/&lt;br /&gt;
[[Category:Documentation]]&lt;/div&gt;</summary>
		<author><name>AMaksimovic</name></author>
	</entry>
	<entry>
		<id>https://elvis.hcw.ac.at/wiki/index.php?title=B-LE_-_GATT_Architectural_Overview&amp;diff=16736</id>
		<title>B-LE - GATT Architectural Overview</title>
		<link rel="alternate" type="text/html" href="https://elvis.hcw.ac.at/wiki/index.php?title=B-LE_-_GATT_Architectural_Overview&amp;diff=16736"/>
		<updated>2024-12-05T16:05:29Z</updated>

		<summary type="html">&lt;p&gt;AMaksimovic: /* Services */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Description =&lt;br /&gt;
&lt;br /&gt;
This article goes into detail about GATT architectural features and its usage in Bluetooth LE Security designs. The research for this article was initiated during writing the paper on hacking a bluetooth smartwatch. There is an entire documentation on the practical experiment in [[Setting Up Ubertooth on macOS for Bluetooth Hacking]]. The network topology of a B-LE GATT network contains so-called central devices and peripheral devices. One peripheral is only connected to only one central device at a time. A central device can connect to many peripheral devices. The peripheral is also acting as the GATT server. It contains the definitions for profiles, services and characteristics of a device. The central device always initiates the data exchange.&lt;br /&gt;
&lt;br /&gt;
= B-LE GATT Overview =&lt;br /&gt;
&lt;br /&gt;
== GAP - Generic Attribute Profile ==&lt;br /&gt;
&lt;br /&gt;
The Generic attribute profile takes care of discovery, security, connectivity and network technolgies of a device as well as it&#039;s role. These are examples of packages during pairing:&lt;br /&gt;
&lt;br /&gt;
 ADV_IND&lt;br /&gt;
 SCAN_REQ&lt;br /&gt;
 SCAN_RSP&lt;br /&gt;
 CONNECT_IND&lt;br /&gt;
 AUX_SCAN_REQ&lt;br /&gt;
 AUX_SCAN_RSP&lt;br /&gt;
 AUX_CONNECT_REQ&lt;br /&gt;
 AUX_CONNECT_RSP&lt;br /&gt;
 ADV_SCAN_IND&lt;br /&gt;
&lt;br /&gt;
== GATT - Generic Attribute Profile ==&lt;br /&gt;
&lt;br /&gt;
As soon as two Bluetooth Low Energy devices establish a connection they can start transfering data back and forth. This data is formated into Services and Characteristics in a Server/Client relationship.&lt;br /&gt;
&lt;br /&gt;
=== ATT - Attribute Protocol ===&lt;br /&gt;
&lt;br /&gt;
GATT is based on ATT. Each attribute gets it’s own Unique Identifier (UUID) here. It takes care of the data exchange and error handling. These get categorized as characteristics and services with GATT.&lt;br /&gt;
&lt;br /&gt;
=== Profiles ===&lt;br /&gt;
&lt;br /&gt;
Each profile has a set of services according to its profile type. Example profiles are Basic audio profiles, Location and navigation profiles, weight scale profile, heart rate profile, etc...&lt;br /&gt;
&lt;br /&gt;
=== Services ===&lt;br /&gt;
&lt;br /&gt;
A Service can have multiple characteristics. It has it’s own UUID. It has a handle. UUID, permissions and a value.&lt;br /&gt;
&lt;br /&gt;
Example services are [Bluetooth[https://www.bluetooth.com/specifications/assigned-numbers/]]:&lt;br /&gt;
&lt;br /&gt;
 Alert Notification Service 0x1811&lt;br /&gt;
 Audio Input Control Service 0x1843&lt;br /&gt;
 Authorization Control Service 0x183D&lt;br /&gt;
 Battery Service 0x180F&lt;br /&gt;
 Binary Sensor Service 0x183B&lt;br /&gt;
 Blood Pressure Service 0x1810&lt;br /&gt;
 Broadcast Audio Scan Service 0x184F&lt;br /&gt;
 Common Audio Service 0x1853&lt;br /&gt;
&lt;br /&gt;
=== Characteristics ===&lt;br /&gt;
&lt;br /&gt;
The characteristics are the lowest-level of the GATT Profiles. They also each use their own UUID.&lt;br /&gt;
These are relevant when it comes to protecting and enhancing security of a Bluetooth Low Energy device.&lt;br /&gt;
The characteristics have a value, properties and human-readable descriptors.&lt;br /&gt;
&lt;br /&gt;
== Example UUIDs of a Polar Smartwatch ==&lt;br /&gt;
&lt;br /&gt;
Example Device UUID:&lt;br /&gt;
 &lt;br /&gt;
 C6C36C4A-7F8F-52B2-2BD7-C4F6690424E7&lt;br /&gt;
&lt;br /&gt;
Example Service UUIDs:&lt;br /&gt;
&lt;br /&gt;
 Service: 0000180a-0000-1000-8000-00805f9b34fb (Handle: 14): Device Information&lt;br /&gt;
 Service: 0000feee-0000-1000-8000-00805f9b34fb (Handle: 29): Polar Electro Oy&lt;br /&gt;
 Service: 0000180d-0000-1000-8000-00805f9b34fb (Handle: 38): Heart Rate&lt;br /&gt;
 Service: 0000180f-0000-1000-8000-00805f9b34fb (Handle: 42): Battery Service&lt;br /&gt;
&lt;br /&gt;
Example service and their characteristics UUIDs including handles, permissions, properties, values, descriptors:&lt;br /&gt;
&lt;br /&gt;
 Service: 0000180a-0000-1000-8000-00805f9b34fb (Handle: 14): Device Information&lt;br /&gt;
  Characteristic: 00002a29-0000-1000-8000-00805f9b34fb (Handle: 15) - Properties: [&#039;read&#039;]&lt;br /&gt;
  Characteristic: 00002a24-0000-1000-8000-00805f9b34fb (Handle: 17) - Properties: [&#039;read&#039;]&lt;br /&gt;
  Characteristic: 00002a25-0000-1000-8000-00805f9b34fb (Handle: 19) - Properties: [&#039;read&#039;]&lt;br /&gt;
  Characteristic: 00002a27-0000-1000-8000-00805f9b34fb (Handle: 21) - Properties: [&#039;read&#039;]&lt;br /&gt;
  Characteristic: 00002a26-0000-1000-8000-00805f9b34fb (Handle: 23) - Properties: [&#039;read&#039;]&lt;br /&gt;
  Characteristic: 00002a28-0000-1000-8000-00805f9b34fb (Handle: 25) - Properties: [&#039;read&#039;]&lt;br /&gt;
  Characteristic: 00002a23-0000-1000-8000-00805f9b34fb (Handle: 27) - Properties: [&#039;read&#039;]&lt;br /&gt;
 Service: 0000feee-0000-1000-8000-00805f9b34fb (Handle: 29): Polar Electro Oy&lt;br /&gt;
  Characteristic: fb005c51-02e7-f387-1cad-8acd2d8df0c8 (Handle: 30) - Properties: [&#039;write-without-response&#039;, &#039;write&#039;, &#039;notify&#039;]&lt;br /&gt;
  Characteristic: fb005c52-02e7-f387-1cad-8acd2d8df0c8 (Handle: 33) - Properties: [&#039;notify&#039;]&lt;br /&gt;
  Characteristic: fb005c53-02e7-f387-1cad-8acd2d8df0c8 (Handle: 36) - Properties: [&#039;write-without-response&#039;, &#039;write&#039;]&lt;br /&gt;
 Service: 0000180d-0000-1000-8000-00805f9b34fb (Handle: 38): Heart Rate&lt;br /&gt;
  Characteristic: 00002a37-0000-1000-8000-00805f9b34fb (Handle: 39) - Properties: [&#039;notify&#039;]&lt;br /&gt;
 Service: 0000180f-0000-1000-8000-00805f9b34fb (Handle: 42): Battery Service&lt;br /&gt;
  Characteristic: 00002a19-0000-1000-8000-00805f9b34fb (Handle: 43) - Properties: [&#039;read&#039;, &#039;notify&#039;]&lt;br /&gt;
&lt;br /&gt;
== BLE Operations ==&lt;br /&gt;
&lt;br /&gt;
Based on the characteristic&#039;s properties these operations can be executed on the target devices characteristics:&lt;br /&gt;
&lt;br /&gt;
* Read = Read the data of a characteristic&lt;br /&gt;
&lt;br /&gt;
* Write = Write data to a characteristic&lt;br /&gt;
&lt;br /&gt;
* Notify = Get notifications to value changes of a device by subscribing to it&lt;br /&gt;
&lt;br /&gt;
= Further Context =&lt;br /&gt;
&lt;br /&gt;
For further context and practical examples make sure to read:&lt;br /&gt;
&lt;br /&gt;
* Setting Up Ubertooth on macOS for Bluetooth Hacking [https://wiki.elvis.science/index.php?title=Setting_Up_Ubertooth_on_macOS_for_Bluetooth_Hacking]&lt;br /&gt;
&lt;br /&gt;
= Courses =&lt;br /&gt;
&lt;br /&gt;
* [[Selected IT-Security Chapters]] (2024)&lt;br /&gt;
&lt;br /&gt;
= Author =&lt;br /&gt;
Are Maksimović&lt;br /&gt;
&lt;br /&gt;
= References =&lt;br /&gt;
&lt;br /&gt;
* https://bleak.readthedocs.io/en/latest/usage.html&lt;br /&gt;
* https://www.bluetooth.com/de/bluetooth-resources/intro-to-bluetooth-gap-gatt/&lt;br /&gt;
[[Category:Documentation]]&lt;/div&gt;</summary>
		<author><name>AMaksimovic</name></author>
	</entry>
	<entry>
		<id>https://elvis.hcw.ac.at/wiki/index.php?title=B-LE_-_GATT_Architectural_Overview&amp;diff=16735</id>
		<title>B-LE - GATT Architectural Overview</title>
		<link rel="alternate" type="text/html" href="https://elvis.hcw.ac.at/wiki/index.php?title=B-LE_-_GATT_Architectural_Overview&amp;diff=16735"/>
		<updated>2024-12-05T16:05:03Z</updated>

		<summary type="html">&lt;p&gt;AMaksimovic: /* Services */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Description =&lt;br /&gt;
&lt;br /&gt;
This article goes into detail about GATT architectural features and its usage in Bluetooth LE Security designs. The research for this article was initiated during writing the paper on hacking a bluetooth smartwatch. There is an entire documentation on the practical experiment in [[Setting Up Ubertooth on macOS for Bluetooth Hacking]]. The network topology of a B-LE GATT network contains so-called central devices and peripheral devices. One peripheral is only connected to only one central device at a time. A central device can connect to many peripheral devices. The peripheral is also acting as the GATT server. It contains the definitions for profiles, services and characteristics of a device. The central device always initiates the data exchange.&lt;br /&gt;
&lt;br /&gt;
= B-LE GATT Overview =&lt;br /&gt;
&lt;br /&gt;
== GAP - Generic Attribute Profile ==&lt;br /&gt;
&lt;br /&gt;
The Generic attribute profile takes care of discovery, security, connectivity and network technolgies of a device as well as it&#039;s role. These are examples of packages during pairing:&lt;br /&gt;
&lt;br /&gt;
 ADV_IND&lt;br /&gt;
 SCAN_REQ&lt;br /&gt;
 SCAN_RSP&lt;br /&gt;
 CONNECT_IND&lt;br /&gt;
 AUX_SCAN_REQ&lt;br /&gt;
 AUX_SCAN_RSP&lt;br /&gt;
 AUX_CONNECT_REQ&lt;br /&gt;
 AUX_CONNECT_RSP&lt;br /&gt;
 ADV_SCAN_IND&lt;br /&gt;
&lt;br /&gt;
== GATT - Generic Attribute Profile ==&lt;br /&gt;
&lt;br /&gt;
As soon as two Bluetooth Low Energy devices establish a connection they can start transfering data back and forth. This data is formated into Services and Characteristics in a Server/Client relationship.&lt;br /&gt;
&lt;br /&gt;
=== ATT - Attribute Protocol ===&lt;br /&gt;
&lt;br /&gt;
GATT is based on ATT. Each attribute gets it’s own Unique Identifier (UUID) here. It takes care of the data exchange and error handling. These get categorized as characteristics and services with GATT.&lt;br /&gt;
&lt;br /&gt;
=== Profiles ===&lt;br /&gt;
&lt;br /&gt;
Each profile has a set of services according to its profile type. Example profiles are Basic audio profiles, Location and navigation profiles, weight scale profile, heart rate profile, etc...&lt;br /&gt;
&lt;br /&gt;
=== Services ===&lt;br /&gt;
&lt;br /&gt;
A Service can have multiple characteristics. It has it’s own UUID. It has a handle. UUID, permissions and a value.&lt;br /&gt;
&lt;br /&gt;
Example services are [Bluetooth.com[https://www.bluetooth.com/specifications/assigned-numbers/]]:&lt;br /&gt;
&lt;br /&gt;
 Alert Notification Service 0x1811&lt;br /&gt;
 Audio Input Control Service 0x1843&lt;br /&gt;
 Authorization Control Service 0x183D&lt;br /&gt;
 Battery Service 0x180F&lt;br /&gt;
 Binary Sensor Service 0x183B&lt;br /&gt;
 Blood Pressure Service 0x1810&lt;br /&gt;
 Broadcast Audio Scan Service 0x184F&lt;br /&gt;
 Common Audio Service 0x1853&lt;br /&gt;
&lt;br /&gt;
=== Characteristics ===&lt;br /&gt;
&lt;br /&gt;
The characteristics are the lowest-level of the GATT Profiles. They also each use their own UUID.&lt;br /&gt;
These are relevant when it comes to protecting and enhancing security of a Bluetooth Low Energy device.&lt;br /&gt;
The characteristics have a value, properties and human-readable descriptors.&lt;br /&gt;
&lt;br /&gt;
== Example UUIDs of a Polar Smartwatch ==&lt;br /&gt;
&lt;br /&gt;
Example Device UUID:&lt;br /&gt;
 &lt;br /&gt;
 C6C36C4A-7F8F-52B2-2BD7-C4F6690424E7&lt;br /&gt;
&lt;br /&gt;
Example Service UUIDs:&lt;br /&gt;
&lt;br /&gt;
 Service: 0000180a-0000-1000-8000-00805f9b34fb (Handle: 14): Device Information&lt;br /&gt;
 Service: 0000feee-0000-1000-8000-00805f9b34fb (Handle: 29): Polar Electro Oy&lt;br /&gt;
 Service: 0000180d-0000-1000-8000-00805f9b34fb (Handle: 38): Heart Rate&lt;br /&gt;
 Service: 0000180f-0000-1000-8000-00805f9b34fb (Handle: 42): Battery Service&lt;br /&gt;
&lt;br /&gt;
Example service and their characteristics UUIDs including handles, permissions, properties, values, descriptors:&lt;br /&gt;
&lt;br /&gt;
 Service: 0000180a-0000-1000-8000-00805f9b34fb (Handle: 14): Device Information&lt;br /&gt;
  Characteristic: 00002a29-0000-1000-8000-00805f9b34fb (Handle: 15) - Properties: [&#039;read&#039;]&lt;br /&gt;
  Characteristic: 00002a24-0000-1000-8000-00805f9b34fb (Handle: 17) - Properties: [&#039;read&#039;]&lt;br /&gt;
  Characteristic: 00002a25-0000-1000-8000-00805f9b34fb (Handle: 19) - Properties: [&#039;read&#039;]&lt;br /&gt;
  Characteristic: 00002a27-0000-1000-8000-00805f9b34fb (Handle: 21) - Properties: [&#039;read&#039;]&lt;br /&gt;
  Characteristic: 00002a26-0000-1000-8000-00805f9b34fb (Handle: 23) - Properties: [&#039;read&#039;]&lt;br /&gt;
  Characteristic: 00002a28-0000-1000-8000-00805f9b34fb (Handle: 25) - Properties: [&#039;read&#039;]&lt;br /&gt;
  Characteristic: 00002a23-0000-1000-8000-00805f9b34fb (Handle: 27) - Properties: [&#039;read&#039;]&lt;br /&gt;
 Service: 0000feee-0000-1000-8000-00805f9b34fb (Handle: 29): Polar Electro Oy&lt;br /&gt;
  Characteristic: fb005c51-02e7-f387-1cad-8acd2d8df0c8 (Handle: 30) - Properties: [&#039;write-without-response&#039;, &#039;write&#039;, &#039;notify&#039;]&lt;br /&gt;
  Characteristic: fb005c52-02e7-f387-1cad-8acd2d8df0c8 (Handle: 33) - Properties: [&#039;notify&#039;]&lt;br /&gt;
  Characteristic: fb005c53-02e7-f387-1cad-8acd2d8df0c8 (Handle: 36) - Properties: [&#039;write-without-response&#039;, &#039;write&#039;]&lt;br /&gt;
 Service: 0000180d-0000-1000-8000-00805f9b34fb (Handle: 38): Heart Rate&lt;br /&gt;
  Characteristic: 00002a37-0000-1000-8000-00805f9b34fb (Handle: 39) - Properties: [&#039;notify&#039;]&lt;br /&gt;
 Service: 0000180f-0000-1000-8000-00805f9b34fb (Handle: 42): Battery Service&lt;br /&gt;
  Characteristic: 00002a19-0000-1000-8000-00805f9b34fb (Handle: 43) - Properties: [&#039;read&#039;, &#039;notify&#039;]&lt;br /&gt;
&lt;br /&gt;
== BLE Operations ==&lt;br /&gt;
&lt;br /&gt;
Based on the characteristic&#039;s properties these operations can be executed on the target devices characteristics:&lt;br /&gt;
&lt;br /&gt;
* Read = Read the data of a characteristic&lt;br /&gt;
&lt;br /&gt;
* Write = Write data to a characteristic&lt;br /&gt;
&lt;br /&gt;
* Notify = Get notifications to value changes of a device by subscribing to it&lt;br /&gt;
&lt;br /&gt;
= Further Context =&lt;br /&gt;
&lt;br /&gt;
For further context and practical examples make sure to read:&lt;br /&gt;
&lt;br /&gt;
* Setting Up Ubertooth on macOS for Bluetooth Hacking [https://wiki.elvis.science/index.php?title=Setting_Up_Ubertooth_on_macOS_for_Bluetooth_Hacking]&lt;br /&gt;
&lt;br /&gt;
= Courses =&lt;br /&gt;
&lt;br /&gt;
* [[Selected IT-Security Chapters]] (2024)&lt;br /&gt;
&lt;br /&gt;
= Author =&lt;br /&gt;
Are Maksimović&lt;br /&gt;
&lt;br /&gt;
= References =&lt;br /&gt;
&lt;br /&gt;
* https://bleak.readthedocs.io/en/latest/usage.html&lt;br /&gt;
* https://www.bluetooth.com/de/bluetooth-resources/intro-to-bluetooth-gap-gatt/&lt;br /&gt;
[[Category:Documentation]]&lt;/div&gt;</summary>
		<author><name>AMaksimovic</name></author>
	</entry>
	<entry>
		<id>https://elvis.hcw.ac.at/wiki/index.php?title=B-LE_-_GATT_Architectural_Overview&amp;diff=16734</id>
		<title>B-LE - GATT Architectural Overview</title>
		<link rel="alternate" type="text/html" href="https://elvis.hcw.ac.at/wiki/index.php?title=B-LE_-_GATT_Architectural_Overview&amp;diff=16734"/>
		<updated>2024-12-05T16:04:20Z</updated>

		<summary type="html">&lt;p&gt;AMaksimovic: /* Services */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Description =&lt;br /&gt;
&lt;br /&gt;
This article goes into detail about GATT architectural features and its usage in Bluetooth LE Security designs. The research for this article was initiated during writing the paper on hacking a bluetooth smartwatch. There is an entire documentation on the practical experiment in [[Setting Up Ubertooth on macOS for Bluetooth Hacking]]. The network topology of a B-LE GATT network contains so-called central devices and peripheral devices. One peripheral is only connected to only one central device at a time. A central device can connect to many peripheral devices. The peripheral is also acting as the GATT server. It contains the definitions for profiles, services and characteristics of a device. The central device always initiates the data exchange.&lt;br /&gt;
&lt;br /&gt;
= B-LE GATT Overview =&lt;br /&gt;
&lt;br /&gt;
== GAP - Generic Attribute Profile ==&lt;br /&gt;
&lt;br /&gt;
The Generic attribute profile takes care of discovery, security, connectivity and network technolgies of a device as well as it&#039;s role. These are examples of packages during pairing:&lt;br /&gt;
&lt;br /&gt;
 ADV_IND&lt;br /&gt;
 SCAN_REQ&lt;br /&gt;
 SCAN_RSP&lt;br /&gt;
 CONNECT_IND&lt;br /&gt;
 AUX_SCAN_REQ&lt;br /&gt;
 AUX_SCAN_RSP&lt;br /&gt;
 AUX_CONNECT_REQ&lt;br /&gt;
 AUX_CONNECT_RSP&lt;br /&gt;
 ADV_SCAN_IND&lt;br /&gt;
&lt;br /&gt;
== GATT - Generic Attribute Profile ==&lt;br /&gt;
&lt;br /&gt;
As soon as two Bluetooth Low Energy devices establish a connection they can start transfering data back and forth. This data is formated into Services and Characteristics in a Server/Client relationship.&lt;br /&gt;
&lt;br /&gt;
=== ATT - Attribute Protocol ===&lt;br /&gt;
&lt;br /&gt;
GATT is based on ATT. Each attribute gets it’s own Unique Identifier (UUID) here. It takes care of the data exchange and error handling. These get categorized as characteristics and services with GATT.&lt;br /&gt;
&lt;br /&gt;
=== Profiles ===&lt;br /&gt;
&lt;br /&gt;
Each profile has a set of services according to its profile type. Example profiles are Basic audio profiles, Location and navigation profiles, weight scale profile, heart rate profile, etc...&lt;br /&gt;
&lt;br /&gt;
=== Services ===&lt;br /&gt;
&lt;br /&gt;
A Service can have multiple characteristics. It has it’s own UUID. It has a handle. UUID, permissions and a value.&lt;br /&gt;
&lt;br /&gt;
Example services are [[https://www.bluetooth.com/specifications/assigned-numbers/]]:&lt;br /&gt;
&lt;br /&gt;
 Alert Notification Service 0x1811&lt;br /&gt;
 Audio Input Control Service 0x1843&lt;br /&gt;
 Authorization Control Service 0x183D&lt;br /&gt;
 Battery Service 0x180F&lt;br /&gt;
 Binary Sensor Service 0x183B&lt;br /&gt;
 Blood Pressure Service 0x1810&lt;br /&gt;
 Broadcast Audio Scan Service 0x184F&lt;br /&gt;
 Common Audio Service 0x1853&lt;br /&gt;
&lt;br /&gt;
=== Characteristics ===&lt;br /&gt;
&lt;br /&gt;
The characteristics are the lowest-level of the GATT Profiles. They also each use their own UUID.&lt;br /&gt;
These are relevant when it comes to protecting and enhancing security of a Bluetooth Low Energy device.&lt;br /&gt;
The characteristics have a value, properties and human-readable descriptors.&lt;br /&gt;
&lt;br /&gt;
== Example UUIDs of a Polar Smartwatch ==&lt;br /&gt;
&lt;br /&gt;
Example Device UUID:&lt;br /&gt;
 &lt;br /&gt;
 C6C36C4A-7F8F-52B2-2BD7-C4F6690424E7&lt;br /&gt;
&lt;br /&gt;
Example Service UUIDs:&lt;br /&gt;
&lt;br /&gt;
 Service: 0000180a-0000-1000-8000-00805f9b34fb (Handle: 14): Device Information&lt;br /&gt;
 Service: 0000feee-0000-1000-8000-00805f9b34fb (Handle: 29): Polar Electro Oy&lt;br /&gt;
 Service: 0000180d-0000-1000-8000-00805f9b34fb (Handle: 38): Heart Rate&lt;br /&gt;
 Service: 0000180f-0000-1000-8000-00805f9b34fb (Handle: 42): Battery Service&lt;br /&gt;
&lt;br /&gt;
Example service and their characteristics UUIDs including handles, permissions, properties, values, descriptors:&lt;br /&gt;
&lt;br /&gt;
 Service: 0000180a-0000-1000-8000-00805f9b34fb (Handle: 14): Device Information&lt;br /&gt;
  Characteristic: 00002a29-0000-1000-8000-00805f9b34fb (Handle: 15) - Properties: [&#039;read&#039;]&lt;br /&gt;
  Characteristic: 00002a24-0000-1000-8000-00805f9b34fb (Handle: 17) - Properties: [&#039;read&#039;]&lt;br /&gt;
  Characteristic: 00002a25-0000-1000-8000-00805f9b34fb (Handle: 19) - Properties: [&#039;read&#039;]&lt;br /&gt;
  Characteristic: 00002a27-0000-1000-8000-00805f9b34fb (Handle: 21) - Properties: [&#039;read&#039;]&lt;br /&gt;
  Characteristic: 00002a26-0000-1000-8000-00805f9b34fb (Handle: 23) - Properties: [&#039;read&#039;]&lt;br /&gt;
  Characteristic: 00002a28-0000-1000-8000-00805f9b34fb (Handle: 25) - Properties: [&#039;read&#039;]&lt;br /&gt;
  Characteristic: 00002a23-0000-1000-8000-00805f9b34fb (Handle: 27) - Properties: [&#039;read&#039;]&lt;br /&gt;
 Service: 0000feee-0000-1000-8000-00805f9b34fb (Handle: 29): Polar Electro Oy&lt;br /&gt;
  Characteristic: fb005c51-02e7-f387-1cad-8acd2d8df0c8 (Handle: 30) - Properties: [&#039;write-without-response&#039;, &#039;write&#039;, &#039;notify&#039;]&lt;br /&gt;
  Characteristic: fb005c52-02e7-f387-1cad-8acd2d8df0c8 (Handle: 33) - Properties: [&#039;notify&#039;]&lt;br /&gt;
  Characteristic: fb005c53-02e7-f387-1cad-8acd2d8df0c8 (Handle: 36) - Properties: [&#039;write-without-response&#039;, &#039;write&#039;]&lt;br /&gt;
 Service: 0000180d-0000-1000-8000-00805f9b34fb (Handle: 38): Heart Rate&lt;br /&gt;
  Characteristic: 00002a37-0000-1000-8000-00805f9b34fb (Handle: 39) - Properties: [&#039;notify&#039;]&lt;br /&gt;
 Service: 0000180f-0000-1000-8000-00805f9b34fb (Handle: 42): Battery Service&lt;br /&gt;
  Characteristic: 00002a19-0000-1000-8000-00805f9b34fb (Handle: 43) - Properties: [&#039;read&#039;, &#039;notify&#039;]&lt;br /&gt;
&lt;br /&gt;
== BLE Operations ==&lt;br /&gt;
&lt;br /&gt;
Based on the characteristic&#039;s properties these operations can be executed on the target devices characteristics:&lt;br /&gt;
&lt;br /&gt;
* Read = Read the data of a characteristic&lt;br /&gt;
&lt;br /&gt;
* Write = Write data to a characteristic&lt;br /&gt;
&lt;br /&gt;
* Notify = Get notifications to value changes of a device by subscribing to it&lt;br /&gt;
&lt;br /&gt;
= Further Context =&lt;br /&gt;
&lt;br /&gt;
For further context and practical examples make sure to read:&lt;br /&gt;
&lt;br /&gt;
* Setting Up Ubertooth on macOS for Bluetooth Hacking [https://wiki.elvis.science/index.php?title=Setting_Up_Ubertooth_on_macOS_for_Bluetooth_Hacking]&lt;br /&gt;
&lt;br /&gt;
= Courses =&lt;br /&gt;
&lt;br /&gt;
* [[Selected IT-Security Chapters]] (2024)&lt;br /&gt;
&lt;br /&gt;
= Author =&lt;br /&gt;
Are Maksimović&lt;br /&gt;
&lt;br /&gt;
= References =&lt;br /&gt;
&lt;br /&gt;
* https://bleak.readthedocs.io/en/latest/usage.html&lt;br /&gt;
* https://www.bluetooth.com/de/bluetooth-resources/intro-to-bluetooth-gap-gatt/&lt;br /&gt;
[[Category:Documentation]]&lt;/div&gt;</summary>
		<author><name>AMaksimovic</name></author>
	</entry>
	<entry>
		<id>https://elvis.hcw.ac.at/wiki/index.php?title=B-LE_-_GATT_Architectural_Overview&amp;diff=16731</id>
		<title>B-LE - GATT Architectural Overview</title>
		<link rel="alternate" type="text/html" href="https://elvis.hcw.ac.at/wiki/index.php?title=B-LE_-_GATT_Architectural_Overview&amp;diff=16731"/>
		<updated>2024-12-05T16:00:26Z</updated>

		<summary type="html">&lt;p&gt;AMaksimovic: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Description =&lt;br /&gt;
&lt;br /&gt;
This article goes into detail about GATT architectural features and its usage in Bluetooth LE Security designs. The research for this article was initiated during writing the paper on hacking a bluetooth smartwatch. There is an entire documentation on the practical experiment in [[Setting Up Ubertooth on macOS for Bluetooth Hacking]]. The network topology of a B-LE GATT network contains so-called central devices and peripheral devices. One peripheral is only connected to only one central device at a time. A central device can connect to many peripheral devices. The peripheral is also acting as the GATT server. It contains the definitions for profiles, services and characteristics of a device. The central device always initiates the data exchange.&lt;br /&gt;
&lt;br /&gt;
= B-LE GATT Overview =&lt;br /&gt;
&lt;br /&gt;
== GAP - Generic Attribute Profile ==&lt;br /&gt;
&lt;br /&gt;
The Generic attribute profile takes care of discovery, security, connectivity and network technolgies of a device as well as it&#039;s role. These are examples of packages during pairing:&lt;br /&gt;
&lt;br /&gt;
 ADV_IND&lt;br /&gt;
 SCAN_REQ&lt;br /&gt;
 SCAN_RSP&lt;br /&gt;
 CONNECT_IND&lt;br /&gt;
 AUX_SCAN_REQ&lt;br /&gt;
 AUX_SCAN_RSP&lt;br /&gt;
 AUX_CONNECT_REQ&lt;br /&gt;
 AUX_CONNECT_RSP&lt;br /&gt;
 ADV_SCAN_IND&lt;br /&gt;
&lt;br /&gt;
== GATT - Generic Attribute Profile ==&lt;br /&gt;
&lt;br /&gt;
As soon as two Bluetooth Low Energy devices establish a connection they can start transfering data back and forth. This data is formated into Services and Characteristics in a Server/Client relationship.&lt;br /&gt;
&lt;br /&gt;
=== ATT - Attribute Protocol ===&lt;br /&gt;
&lt;br /&gt;
GATT is based on ATT. Each attribute gets it’s own Unique Identifier (UUID) here. It takes care of the data exchange and error handling. These get categorized as characteristics and services with GATT.&lt;br /&gt;
&lt;br /&gt;
=== Profiles ===&lt;br /&gt;
&lt;br /&gt;
Each profile has a set of services according to its profile type. Example profiles are Basic audio profiles, Location and navigation profiles, weight scale profile, heart rate profile, etc...&lt;br /&gt;
&lt;br /&gt;
=== Services ===&lt;br /&gt;
&lt;br /&gt;
A Service can have multiple characteristics. It has it’s own UUID. It has a handle. UUID, permissions and a value.&lt;br /&gt;
&lt;br /&gt;
=== Characteristics ===&lt;br /&gt;
&lt;br /&gt;
The characteristics are the lowest-level of the GATT Profiles. They also each use their own UUID.&lt;br /&gt;
These are relevant when it comes to protecting and enhancing security of a Bluetooth Low Energy device.&lt;br /&gt;
The characteristics have a value, properties and human-readable descriptors.&lt;br /&gt;
&lt;br /&gt;
== Example UUIDs of a Polar Smartwatch ==&lt;br /&gt;
&lt;br /&gt;
Example Device UUID:&lt;br /&gt;
 &lt;br /&gt;
 C6C36C4A-7F8F-52B2-2BD7-C4F6690424E7&lt;br /&gt;
&lt;br /&gt;
Example Service UUIDs:&lt;br /&gt;
&lt;br /&gt;
 Service: 0000180a-0000-1000-8000-00805f9b34fb (Handle: 14): Device Information&lt;br /&gt;
 Service: 0000feee-0000-1000-8000-00805f9b34fb (Handle: 29): Polar Electro Oy&lt;br /&gt;
 Service: 0000180d-0000-1000-8000-00805f9b34fb (Handle: 38): Heart Rate&lt;br /&gt;
 Service: 0000180f-0000-1000-8000-00805f9b34fb (Handle: 42): Battery Service&lt;br /&gt;
&lt;br /&gt;
Example service and their characteristics UUIDs including handles, permissions, properties, values, descriptors:&lt;br /&gt;
&lt;br /&gt;
 Service: 0000180a-0000-1000-8000-00805f9b34fb (Handle: 14): Device Information&lt;br /&gt;
  Characteristic: 00002a29-0000-1000-8000-00805f9b34fb (Handle: 15) - Properties: [&#039;read&#039;]&lt;br /&gt;
  Characteristic: 00002a24-0000-1000-8000-00805f9b34fb (Handle: 17) - Properties: [&#039;read&#039;]&lt;br /&gt;
  Characteristic: 00002a25-0000-1000-8000-00805f9b34fb (Handle: 19) - Properties: [&#039;read&#039;]&lt;br /&gt;
  Characteristic: 00002a27-0000-1000-8000-00805f9b34fb (Handle: 21) - Properties: [&#039;read&#039;]&lt;br /&gt;
  Characteristic: 00002a26-0000-1000-8000-00805f9b34fb (Handle: 23) - Properties: [&#039;read&#039;]&lt;br /&gt;
  Characteristic: 00002a28-0000-1000-8000-00805f9b34fb (Handle: 25) - Properties: [&#039;read&#039;]&lt;br /&gt;
  Characteristic: 00002a23-0000-1000-8000-00805f9b34fb (Handle: 27) - Properties: [&#039;read&#039;]&lt;br /&gt;
 Service: 0000feee-0000-1000-8000-00805f9b34fb (Handle: 29): Polar Electro Oy&lt;br /&gt;
  Characteristic: fb005c51-02e7-f387-1cad-8acd2d8df0c8 (Handle: 30) - Properties: [&#039;write-without-response&#039;, &#039;write&#039;, &#039;notify&#039;]&lt;br /&gt;
  Characteristic: fb005c52-02e7-f387-1cad-8acd2d8df0c8 (Handle: 33) - Properties: [&#039;notify&#039;]&lt;br /&gt;
  Characteristic: fb005c53-02e7-f387-1cad-8acd2d8df0c8 (Handle: 36) - Properties: [&#039;write-without-response&#039;, &#039;write&#039;]&lt;br /&gt;
 Service: 0000180d-0000-1000-8000-00805f9b34fb (Handle: 38): Heart Rate&lt;br /&gt;
  Characteristic: 00002a37-0000-1000-8000-00805f9b34fb (Handle: 39) - Properties: [&#039;notify&#039;]&lt;br /&gt;
 Service: 0000180f-0000-1000-8000-00805f9b34fb (Handle: 42): Battery Service&lt;br /&gt;
  Characteristic: 00002a19-0000-1000-8000-00805f9b34fb (Handle: 43) - Properties: [&#039;read&#039;, &#039;notify&#039;]&lt;br /&gt;
&lt;br /&gt;
== BLE Operations ==&lt;br /&gt;
&lt;br /&gt;
Based on the characteristic&#039;s properties these operations can be executed on the target devices characteristics:&lt;br /&gt;
&lt;br /&gt;
* Read = Read the data of a characteristic&lt;br /&gt;
&lt;br /&gt;
* Write = Write data to a characteristic&lt;br /&gt;
&lt;br /&gt;
* Notify = Get notifications to value changes of a device by subscribing to it&lt;br /&gt;
&lt;br /&gt;
= Further Context =&lt;br /&gt;
&lt;br /&gt;
For further context and practical examples make sure to read:&lt;br /&gt;
&lt;br /&gt;
* Setting Up Ubertooth on macOS for Bluetooth Hacking [https://wiki.elvis.science/index.php?title=Setting_Up_Ubertooth_on_macOS_for_Bluetooth_Hacking]&lt;br /&gt;
&lt;br /&gt;
= Courses =&lt;br /&gt;
&lt;br /&gt;
* [[Selected IT-Security Chapters]] (2024)&lt;br /&gt;
&lt;br /&gt;
= Author =&lt;br /&gt;
Are Maksimović&lt;br /&gt;
&lt;br /&gt;
= References =&lt;br /&gt;
&lt;br /&gt;
* https://bleak.readthedocs.io/en/latest/usage.html&lt;br /&gt;
* https://www.bluetooth.com/de/bluetooth-resources/intro-to-bluetooth-gap-gatt/&lt;br /&gt;
[[Category:Documentation]]&lt;/div&gt;</summary>
		<author><name>AMaksimovic</name></author>
	</entry>
	<entry>
		<id>https://elvis.hcw.ac.at/wiki/index.php?title=B-LE_-_GATT_Architectural_Overview&amp;diff=16729</id>
		<title>B-LE - GATT Architectural Overview</title>
		<link rel="alternate" type="text/html" href="https://elvis.hcw.ac.at/wiki/index.php?title=B-LE_-_GATT_Architectural_Overview&amp;diff=16729"/>
		<updated>2024-12-05T15:59:38Z</updated>

		<summary type="html">&lt;p&gt;AMaksimovic: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Description =&lt;br /&gt;
&lt;br /&gt;
This article goes into detail about GATT architectural features and its usage in Bluetooth LE Security designs. The research for this article was initiated during writing the paper on hacking a bluetooth smartwatch. There is an entire documentation on the practical experiment in [[Setting Up Ubertooth on macOS for Bluetooth Hacking]]. The network topology of a B-LE GATT network contains so-called central devices and peripheral devices. One peripheral is only connected to only one central device at a time. A central device can connect to many peripheral devices. The peripheral is also acting as the GATT server. It contains the definitions for profiles, services and characteristics of a device. The central device always initiates the data exchange.&lt;br /&gt;
&lt;br /&gt;
= B-LE GATT Overview =&lt;br /&gt;
&lt;br /&gt;
== GAP - Generic Attribute Profile ==&lt;br /&gt;
&lt;br /&gt;
The Generic attribute profile takes care of discovery, security, connectivity and network technolgies of a device as well as it&#039;s role. These are examples of packages during pairing:&lt;br /&gt;
&lt;br /&gt;
 ADV_IND&lt;br /&gt;
 SCAN_REQ&lt;br /&gt;
 SCAN_RSP&lt;br /&gt;
 CONNECT_IND&lt;br /&gt;
 AUX_SCAN_REQ&lt;br /&gt;
 AUX_SCAN_RSP&lt;br /&gt;
 AUX_CONNECT_REQ&lt;br /&gt;
 AUX_CONNECT_RSP&lt;br /&gt;
 ADV_SCAN_IND&lt;br /&gt;
&lt;br /&gt;
== GATT - Generic Attribute Profile ==&lt;br /&gt;
&lt;br /&gt;
As soon as two Bluetooth Low Energy devices establish a connection they can start transfering data back and forth. This data is formated into Services and Characteristics in a Server/Client relationship.&lt;br /&gt;
&lt;br /&gt;
=== ATT - Attribute Protocol ===&lt;br /&gt;
&lt;br /&gt;
GATT is based on ATT. Each attribute gets it’s own Unique Identifier (UUID) here. It takes care of the data exchange and error handling. These get categorized as characteristics and services with GATT.&lt;br /&gt;
&lt;br /&gt;
=== Profiles ===&lt;br /&gt;
&lt;br /&gt;
Each profile has a set of services according to its profile type. Example profiles are Basic audio profiles, Location and navigation profiles, weight scale profile, heart rate profile, etc...&lt;br /&gt;
&lt;br /&gt;
=== Services ===&lt;br /&gt;
&lt;br /&gt;
A Service can have multiple characteristics. It has it’s own UUID. It has a handle. UUID, permissions and a value.&lt;br /&gt;
&lt;br /&gt;
=== Characteristics ===&lt;br /&gt;
&lt;br /&gt;
The characteristics are the lowest-level of the GATT Profiles. They also each use their own UUID.&lt;br /&gt;
These are relevant when it comes to protecting and enhancing security of a Bluetooth Low Energy device.&lt;br /&gt;
The characteristics have a value, properties and human-readable descriptors.&lt;br /&gt;
&lt;br /&gt;
== Example UUIDs of a Polar Smartwatch ==&lt;br /&gt;
&lt;br /&gt;
Example Device UUID:&lt;br /&gt;
 &lt;br /&gt;
 C6C36C4A-7F8F-52B2-2BD7-C4F6690424E7&lt;br /&gt;
&lt;br /&gt;
Example Service UUIDs:&lt;br /&gt;
&lt;br /&gt;
 Service: 0000180a-0000-1000-8000-00805f9b34fb (Handle: 14): Device Information&lt;br /&gt;
 Service: 0000feee-0000-1000-8000-00805f9b34fb (Handle: 29): Polar Electro Oy&lt;br /&gt;
 Service: 0000180d-0000-1000-8000-00805f9b34fb (Handle: 38): Heart Rate&lt;br /&gt;
 Service: 0000180f-0000-1000-8000-00805f9b34fb (Handle: 42): Battery Service&lt;br /&gt;
&lt;br /&gt;
Example service and their characteristics UUIDs including handles, permissions, properties, values, descriptors:&lt;br /&gt;
&lt;br /&gt;
 Service: 0000180a-0000-1000-8000-00805f9b34fb (Handle: 14): Device Information&lt;br /&gt;
  Characteristic: 00002a29-0000-1000-8000-00805f9b34fb (Handle: 15) - Properties: [&#039;read&#039;]&lt;br /&gt;
  Characteristic: 00002a24-0000-1000-8000-00805f9b34fb (Handle: 17) - Properties: [&#039;read&#039;]&lt;br /&gt;
  Characteristic: 00002a25-0000-1000-8000-00805f9b34fb (Handle: 19) - Properties: [&#039;read&#039;]&lt;br /&gt;
  Characteristic: 00002a27-0000-1000-8000-00805f9b34fb (Handle: 21) - Properties: [&#039;read&#039;]&lt;br /&gt;
  Characteristic: 00002a26-0000-1000-8000-00805f9b34fb (Handle: 23) - Properties: [&#039;read&#039;]&lt;br /&gt;
  Characteristic: 00002a28-0000-1000-8000-00805f9b34fb (Handle: 25) - Properties: [&#039;read&#039;]&lt;br /&gt;
  Characteristic: 00002a23-0000-1000-8000-00805f9b34fb (Handle: 27) - Properties: [&#039;read&#039;]&lt;br /&gt;
 Service: 0000feee-0000-1000-8000-00805f9b34fb (Handle: 29): Polar Electro Oy&lt;br /&gt;
  Characteristic: fb005c51-02e7-f387-1cad-8acd2d8df0c8 (Handle: 30) - Properties: [&#039;write-without-response&#039;, &#039;write&#039;, &#039;notify&#039;]&lt;br /&gt;
  Characteristic: fb005c52-02e7-f387-1cad-8acd2d8df0c8 (Handle: 33) - Properties: [&#039;notify&#039;]&lt;br /&gt;
  Characteristic: fb005c53-02e7-f387-1cad-8acd2d8df0c8 (Handle: 36) - Properties: [&#039;write-without-response&#039;, &#039;write&#039;]&lt;br /&gt;
 Service: 0000180d-0000-1000-8000-00805f9b34fb (Handle: 38): Heart Rate&lt;br /&gt;
  Characteristic: 00002a37-0000-1000-8000-00805f9b34fb (Handle: 39) - Properties: [&#039;notify&#039;]&lt;br /&gt;
 Service: 0000180f-0000-1000-8000-00805f9b34fb (Handle: 42): Battery Service&lt;br /&gt;
  Characteristic: 00002a19-0000-1000-8000-00805f9b34fb (Handle: 43) - Properties: [&#039;read&#039;, &#039;notify&#039;]&lt;br /&gt;
&lt;br /&gt;
== BLE Operations ==&lt;br /&gt;
&lt;br /&gt;
Based on the characteristic&#039;s properties these operations can be executed on the target devices characteristics:&lt;br /&gt;
&lt;br /&gt;
* Read = Read the data of a characteristic&lt;br /&gt;
&lt;br /&gt;
* Write = Write data to a characteristic&lt;br /&gt;
&lt;br /&gt;
* Notify = Get notifications to value changes of a device by subscribing to it&lt;br /&gt;
&lt;br /&gt;
== Further Context ==&lt;br /&gt;
&lt;br /&gt;
For further context and practical examples make sure to read:&lt;br /&gt;
&lt;br /&gt;
* Setting Up Ubertooth on macOS for Bluetooth Hacking [https://wiki.elvis.science/index.php?title=Setting_Up_Ubertooth_on_macOS_for_Bluetooth_Hacking]&lt;br /&gt;
&lt;br /&gt;
== Courses ==&lt;br /&gt;
&lt;br /&gt;
* [[Selected IT-Security Chapters]] (2024)&lt;br /&gt;
&lt;br /&gt;
== Author ==&lt;br /&gt;
Are Maksimović&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
* https://bleak.readthedocs.io/en/latest/usage.html&lt;br /&gt;
* https://www.bluetooth.com/de/bluetooth-resources/intro-to-bluetooth-gap-gatt/&lt;br /&gt;
[[Category:Documentation]]&lt;/div&gt;</summary>
		<author><name>AMaksimovic</name></author>
	</entry>
	<entry>
		<id>https://elvis.hcw.ac.at/wiki/index.php?title=B-LE_-_GATT_Architectural_Overview&amp;diff=16724</id>
		<title>B-LE - GATT Architectural Overview</title>
		<link rel="alternate" type="text/html" href="https://elvis.hcw.ac.at/wiki/index.php?title=B-LE_-_GATT_Architectural_Overview&amp;diff=16724"/>
		<updated>2024-12-05T15:52:48Z</updated>

		<summary type="html">&lt;p&gt;AMaksimovic: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Description =&lt;br /&gt;
&lt;br /&gt;
This article goes into detail about GATT architectural features and its usage in Bluetooth LE Security designs. The research for this article was initiated during writing the paper on hacking a bluetooth smartwatch. There is an entire documentation on the practical experiment in [[Setting Up Ubertooth on macOS for Bluetooth Hacking]]. The network topology of a B-LE GATT network contains so-called central devices and peripheral devices. One peripheral is only connected to only one central device at a time. A central device can connect to many peripheral devices. The peripheral is also acting as the GATT server. It contains the definitions for profiles, services and characteristics of a device. The central device always initiates the data exchange.&lt;br /&gt;
&lt;br /&gt;
= B-LE GATT Overview =&lt;br /&gt;
&lt;br /&gt;
== GAP - Generic Attribute Profile ==&lt;br /&gt;
&lt;br /&gt;
The Generic attribute profile takes care of discovery, security, connectivity and network technolgies of a device as well as it&#039;s role. These are examples of packages during pairing:&lt;br /&gt;
&lt;br /&gt;
 ADV_IND&lt;br /&gt;
 SCAN_REQ&lt;br /&gt;
 SCAN_RSP&lt;br /&gt;
 CONNECT_IND&lt;br /&gt;
 AUX_SCAN_REQ&lt;br /&gt;
 AUX_SCAN_RSP&lt;br /&gt;
 AUX_CONNECT_REQ&lt;br /&gt;
 AUX_CONNECT_RSP&lt;br /&gt;
 ADV_SCAN_IND&lt;br /&gt;
&lt;br /&gt;
== GATT - Generic Attribute Profile ==&lt;br /&gt;
&lt;br /&gt;
As soon as two Bluetooth Low Energy devices establish a connection they can start transfering data back and forth. This data is formated into Services and Characteristics in a Server/Client relationship.&lt;br /&gt;
&lt;br /&gt;
== ATT - Attribute Protocol ==&lt;br /&gt;
&lt;br /&gt;
GATT is based on ATT. Each attribute gets it’s own Unique Identifier (UUID) here. These get formatted as characteristics and services.&lt;br /&gt;
&lt;br /&gt;
=== Profiles ===&lt;br /&gt;
&lt;br /&gt;
set of services per Profile &lt;br /&gt;
Example profiles: Basic audio profile, Location and navigation profile, weight scale profile, heart rate profile&lt;br /&gt;
&lt;br /&gt;
=== Services ===&lt;br /&gt;
&lt;br /&gt;
A Service can have multiple characteristics. It has it’s own UUID. It has a handle. UUID, permissions, value&lt;br /&gt;
&lt;br /&gt;
=== Characteristics ===&lt;br /&gt;
&lt;br /&gt;
The characteristics are the lowest-level of the GATT Profiles. They also each use their own UUID.&lt;br /&gt;
These are relevant when it comes to protecting and enhancing security of a Bluetooth Low Energy device.&lt;br /&gt;
The characteristics have a value, properties and human-readable descriptors&lt;br /&gt;
&lt;br /&gt;
== Example UUIDs of a Polar Smartwatch ==&lt;br /&gt;
&lt;br /&gt;
Example Device UUID:&lt;br /&gt;
 &lt;br /&gt;
 C6C36C4A-7F8F-52B2-2BD7-C4F6690424E7&lt;br /&gt;
&lt;br /&gt;
Example Service UUIDs:&lt;br /&gt;
&lt;br /&gt;
 Service: 0000180a-0000-1000-8000-00805f9b34fb (Handle: 14): Device Information&lt;br /&gt;
 Service: 0000feee-0000-1000-8000-00805f9b34fb (Handle: 29): Polar Electro Oy&lt;br /&gt;
 Service: 0000180d-0000-1000-8000-00805f9b34fb (Handle: 38): Heart Rate&lt;br /&gt;
 Service: 0000180f-0000-1000-8000-00805f9b34fb (Handle: 42): Battery Service&lt;br /&gt;
&lt;br /&gt;
Example Service and their Characteristics UUIDs including handles, permissions, properties, values, descriptors:&lt;br /&gt;
&lt;br /&gt;
 Service: 0000180a-0000-1000-8000-00805f9b34fb (Handle: 14): Device Information&lt;br /&gt;
  Characteristic: 00002a29-0000-1000-8000-00805f9b34fb (Handle: 15) - Properties: [&#039;read&#039;]&lt;br /&gt;
  Characteristic: 00002a24-0000-1000-8000-00805f9b34fb (Handle: 17) - Properties: [&#039;read&#039;]&lt;br /&gt;
  Characteristic: 00002a25-0000-1000-8000-00805f9b34fb (Handle: 19) - Properties: [&#039;read&#039;]&lt;br /&gt;
  Characteristic: 00002a27-0000-1000-8000-00805f9b34fb (Handle: 21) - Properties: [&#039;read&#039;]&lt;br /&gt;
  Characteristic: 00002a26-0000-1000-8000-00805f9b34fb (Handle: 23) - Properties: [&#039;read&#039;]&lt;br /&gt;
  Characteristic: 00002a28-0000-1000-8000-00805f9b34fb (Handle: 25) - Properties: [&#039;read&#039;]&lt;br /&gt;
  Characteristic: 00002a23-0000-1000-8000-00805f9b34fb (Handle: 27) - Properties: [&#039;read&#039;]&lt;br /&gt;
 Service: 0000feee-0000-1000-8000-00805f9b34fb (Handle: 29): Polar Electro Oy&lt;br /&gt;
  Characteristic: fb005c51-02e7-f387-1cad-8acd2d8df0c8 (Handle: 30) - Properties: [&#039;write-without-response&#039;, &#039;write&#039;, &#039;notify&#039;]&lt;br /&gt;
  Characteristic: fb005c52-02e7-f387-1cad-8acd2d8df0c8 (Handle: 33) - Properties: [&#039;notify&#039;]&lt;br /&gt;
  Characteristic: fb005c53-02e7-f387-1cad-8acd2d8df0c8 (Handle: 36) - Properties: [&#039;write-without-response&#039;, &#039;write&#039;]&lt;br /&gt;
 Service: 0000180d-0000-1000-8000-00805f9b34fb (Handle: 38): Heart Rate&lt;br /&gt;
  Characteristic: 00002a37-0000-1000-8000-00805f9b34fb (Handle: 39) - Properties: [&#039;notify&#039;]&lt;br /&gt;
 Service: 0000180f-0000-1000-8000-00805f9b34fb (Handle: 42): Battery Service&lt;br /&gt;
  Characteristic: 00002a19-0000-1000-8000-00805f9b34fb (Handle: 43) - Properties: [&#039;read&#039;, &#039;notify&#039;]&lt;br /&gt;
&lt;br /&gt;
== BLE Operations ==&lt;br /&gt;
&lt;br /&gt;
* Read = Read the data of a characteristic&lt;br /&gt;
&lt;br /&gt;
* Write = Write data to a characteristic&lt;br /&gt;
&lt;br /&gt;
* Notify = Get notifications to value changes of a device by subscribing to it&lt;br /&gt;
&lt;br /&gt;
== Further Context ==&lt;br /&gt;
&lt;br /&gt;
Make sure to read&lt;br /&gt;
&lt;br /&gt;
* Setting Up Ubertooth on macOS for Bluetooth Hacking [https://wiki.elvis.science/index.php?title=Setting_Up_Ubertooth_on_macOS_for_Bluetooth_Hacking]&lt;br /&gt;
&lt;br /&gt;
== Courses ==&lt;br /&gt;
&lt;br /&gt;
* [[Selected IT-Security Chapters]] (2024)&lt;br /&gt;
&lt;br /&gt;
== Author ==&lt;br /&gt;
Are Maksimović&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
* https://bleak.readthedocs.io/en/latest/usage.html&lt;br /&gt;
* https://www.bluetooth.com/de/bluetooth-resources/intro-to-bluetooth-gap-gatt/&lt;br /&gt;
[[Category:Documentation]]&lt;/div&gt;</summary>
		<author><name>AMaksimovic</name></author>
	</entry>
	<entry>
		<id>https://elvis.hcw.ac.at/wiki/index.php?title=B-LE_-_GATT_Architectural_Overview&amp;diff=16723</id>
		<title>B-LE - GATT Architectural Overview</title>
		<link rel="alternate" type="text/html" href="https://elvis.hcw.ac.at/wiki/index.php?title=B-LE_-_GATT_Architectural_Overview&amp;diff=16723"/>
		<updated>2024-12-05T15:50:37Z</updated>

		<summary type="html">&lt;p&gt;AMaksimovic: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Description =&lt;br /&gt;
&lt;br /&gt;
This article goes into detail about GATT architectural features and its usage in Bluetooth LE Security designs. The research for this article was initiated during writing the paper on hacking a bluetooth smartwatch. There is an entire documentation on the practical experiment in [[Setting Up Ubertooth on macOS for Bluetooth Hacking]]. The network topology of a GATT network contains so-called central devices and peripheral devices. One peripheral is only connected to only one central device at a time. A central device can connect to many peripheral devices. The peripheral is also acting as the GATT server. It contains the definitions for profiles, services and characteristics of a device. The central device always initiates the data exchange.&lt;br /&gt;
&lt;br /&gt;
= Bluetooth LE =&lt;br /&gt;
&lt;br /&gt;
== GAP - Generic Attribute Profile ==&lt;br /&gt;
&lt;br /&gt;
The Generic attribute profile takes care of discovery, security, connectivity and network technolgies of a device as well as it&#039;s role. These are examples of packages during pairing:&lt;br /&gt;
&lt;br /&gt;
 ADV_IND&lt;br /&gt;
 SCAN_REQ&lt;br /&gt;
 SCAN_RSP&lt;br /&gt;
 CONNECT_IND&lt;br /&gt;
 AUX_SCAN_REQ&lt;br /&gt;
 AUX_SCAN_RSP&lt;br /&gt;
 AUX_CONNECT_REQ&lt;br /&gt;
 AUX_CONNECT_RSP&lt;br /&gt;
 ADV_SCAN_IND&lt;br /&gt;
&lt;br /&gt;
== GATT - Generic Attribute Profile ==&lt;br /&gt;
&lt;br /&gt;
As soon as two Bluetooth Low Energy devices establish a connection they can start transfering data back and forth. This data is formated into Services and Characteristics in a Server/Client relationship.&lt;br /&gt;
&lt;br /&gt;
== ATT - Attribute Protocol ==&lt;br /&gt;
&lt;br /&gt;
GATT is based on ATT. Each attribute gets it’s own Unique Identifier (UUID) here. These get formatted as characteristics and services.&lt;br /&gt;
&lt;br /&gt;
=== Profiles ===&lt;br /&gt;
&lt;br /&gt;
set of services per Profile &lt;br /&gt;
Example profiles: Basic audio profile, Location and navigation profile, weight scale profile, heart rate profile&lt;br /&gt;
&lt;br /&gt;
=== Services ===&lt;br /&gt;
&lt;br /&gt;
A Service can have multiple characteristics. It has it’s own UUID. It has a handle. UUID, permissions, value&lt;br /&gt;
&lt;br /&gt;
=== Characteristics ===&lt;br /&gt;
&lt;br /&gt;
The characteristics are the lowest-level of the GATT Profiles. They also each use their own UUID.&lt;br /&gt;
These are relevant when it comes to protecting and enhancing security of a Bluetooth Low Energy device.&lt;br /&gt;
The characteristics have a value, properties and human-readable descriptors&lt;br /&gt;
&lt;br /&gt;
== Example UUIDs of a Polar Smartwatch ==&lt;br /&gt;
&lt;br /&gt;
Example Device UUID:&lt;br /&gt;
 &lt;br /&gt;
 C6C36C4A-7F8F-52B2-2BD7-C4F6690424E7&lt;br /&gt;
&lt;br /&gt;
Example Service UUIDs:&lt;br /&gt;
&lt;br /&gt;
 Service: 0000180a-0000-1000-8000-00805f9b34fb (Handle: 14): Device Information&lt;br /&gt;
 Service: 0000feee-0000-1000-8000-00805f9b34fb (Handle: 29): Polar Electro Oy&lt;br /&gt;
 Service: 0000180d-0000-1000-8000-00805f9b34fb (Handle: 38): Heart Rate&lt;br /&gt;
 Service: 0000180f-0000-1000-8000-00805f9b34fb (Handle: 42): Battery Service&lt;br /&gt;
&lt;br /&gt;
Example Service and their Characteristics UUIDs including handles, permissions, properties, values, descriptors:&lt;br /&gt;
&lt;br /&gt;
 Service: 0000180a-0000-1000-8000-00805f9b34fb (Handle: 14): Device Information&lt;br /&gt;
  Characteristic: 00002a29-0000-1000-8000-00805f9b34fb (Handle: 15) - Properties: [&#039;read&#039;]&lt;br /&gt;
  Characteristic: 00002a24-0000-1000-8000-00805f9b34fb (Handle: 17) - Properties: [&#039;read&#039;]&lt;br /&gt;
  Characteristic: 00002a25-0000-1000-8000-00805f9b34fb (Handle: 19) - Properties: [&#039;read&#039;]&lt;br /&gt;
  Characteristic: 00002a27-0000-1000-8000-00805f9b34fb (Handle: 21) - Properties: [&#039;read&#039;]&lt;br /&gt;
  Characteristic: 00002a26-0000-1000-8000-00805f9b34fb (Handle: 23) - Properties: [&#039;read&#039;]&lt;br /&gt;
  Characteristic: 00002a28-0000-1000-8000-00805f9b34fb (Handle: 25) - Properties: [&#039;read&#039;]&lt;br /&gt;
  Characteristic: 00002a23-0000-1000-8000-00805f9b34fb (Handle: 27) - Properties: [&#039;read&#039;]&lt;br /&gt;
 Service: 0000feee-0000-1000-8000-00805f9b34fb (Handle: 29): Polar Electro Oy&lt;br /&gt;
  Characteristic: fb005c51-02e7-f387-1cad-8acd2d8df0c8 (Handle: 30) - Properties: [&#039;write-without-response&#039;, &#039;write&#039;, &#039;notify&#039;]&lt;br /&gt;
  Characteristic: fb005c52-02e7-f387-1cad-8acd2d8df0c8 (Handle: 33) - Properties: [&#039;notify&#039;]&lt;br /&gt;
  Characteristic: fb005c53-02e7-f387-1cad-8acd2d8df0c8 (Handle: 36) - Properties: [&#039;write-without-response&#039;, &#039;write&#039;]&lt;br /&gt;
 Service: 0000180d-0000-1000-8000-00805f9b34fb (Handle: 38): Heart Rate&lt;br /&gt;
  Characteristic: 00002a37-0000-1000-8000-00805f9b34fb (Handle: 39) - Properties: [&#039;notify&#039;]&lt;br /&gt;
 Service: 0000180f-0000-1000-8000-00805f9b34fb (Handle: 42): Battery Service&lt;br /&gt;
  Characteristic: 00002a19-0000-1000-8000-00805f9b34fb (Handle: 43) - Properties: [&#039;read&#039;, &#039;notify&#039;]&lt;br /&gt;
&lt;br /&gt;
== BLE Operations ==&lt;br /&gt;
&lt;br /&gt;
* Read&lt;br /&gt;
Read the data of a characteristic&lt;br /&gt;
&lt;br /&gt;
* Write&lt;br /&gt;
Write data to a characteristic&lt;br /&gt;
&lt;br /&gt;
* Notify&lt;br /&gt;
Get notifications to value changes of a device by subscribing to it&lt;br /&gt;
&lt;br /&gt;
== Further Context ==&lt;br /&gt;
&lt;br /&gt;
Make sure to read&lt;br /&gt;
&lt;br /&gt;
* Setting Up Ubertooth on macOS for Bluetooth Hacking [https://wiki.elvis.science/index.php?title=Setting_Up_Ubertooth_on_macOS_for_Bluetooth_Hacking]&lt;br /&gt;
&lt;br /&gt;
== Courses ==&lt;br /&gt;
&lt;br /&gt;
* [[Selected IT-Security Chapters]] (2024)&lt;br /&gt;
&lt;br /&gt;
== Author ==&lt;br /&gt;
Are Maksimović&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
* https://bleak.readthedocs.io/en/latest/usage.html&lt;br /&gt;
* https://www.bluetooth.com/de/bluetooth-resources/intro-to-bluetooth-gap-gatt/&lt;br /&gt;
[[Category:Documentation]]&lt;/div&gt;</summary>
		<author><name>AMaksimovic</name></author>
	</entry>
	<entry>
		<id>https://elvis.hcw.ac.at/wiki/index.php?title=B-LE_-_GATT_Architectural_Overview&amp;diff=16722</id>
		<title>B-LE - GATT Architectural Overview</title>
		<link rel="alternate" type="text/html" href="https://elvis.hcw.ac.at/wiki/index.php?title=B-LE_-_GATT_Architectural_Overview&amp;diff=16722"/>
		<updated>2024-12-05T15:50:21Z</updated>

		<summary type="html">&lt;p&gt;AMaksimovic: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Description =&lt;br /&gt;
&lt;br /&gt;
This article goes into detail about GATT architectural features and its usage in Bluetooth LE Security designs. The research for this article was initiated during writing the paper on hacking a bluetooth smartwatch. There is an entire documentation on the practical experiment in [Setting Up Ubertooth on macOS for Bluetooth Hacking]. The network topology of a GATT network contains so-called central devices and peripheral devices. One peripheral is only connected to only one central device at a time. A central device can connect to many peripheral devices. The peripheral is also acting as the GATT server. It contains the definitions for profiles, services and characteristics of a device. The central device always initiates the data exchange.&lt;br /&gt;
&lt;br /&gt;
= Bluetooth LE =&lt;br /&gt;
&lt;br /&gt;
== GAP - Generic Attribute Profile ==&lt;br /&gt;
&lt;br /&gt;
The Generic attribute profile takes care of discovery, security, connectivity and network technolgies of a device as well as it&#039;s role. These are examples of packages during pairing:&lt;br /&gt;
&lt;br /&gt;
 ADV_IND&lt;br /&gt;
 SCAN_REQ&lt;br /&gt;
 SCAN_RSP&lt;br /&gt;
 CONNECT_IND&lt;br /&gt;
 AUX_SCAN_REQ&lt;br /&gt;
 AUX_SCAN_RSP&lt;br /&gt;
 AUX_CONNECT_REQ&lt;br /&gt;
 AUX_CONNECT_RSP&lt;br /&gt;
 ADV_SCAN_IND&lt;br /&gt;
&lt;br /&gt;
== GATT - Generic Attribute Profile ==&lt;br /&gt;
&lt;br /&gt;
As soon as two Bluetooth Low Energy devices establish a connection they can start transfering data back and forth. This data is formated into Services and Characteristics in a Server/Client relationship.&lt;br /&gt;
&lt;br /&gt;
== ATT - Attribute Protocol ==&lt;br /&gt;
&lt;br /&gt;
GATT is based on ATT. Each attribute gets it’s own Unique Identifier (UUID) here. These get formatted as characteristics and services.&lt;br /&gt;
&lt;br /&gt;
=== Profiles ===&lt;br /&gt;
&lt;br /&gt;
set of services per Profile &lt;br /&gt;
Example profiles: Basic audio profile, Location and navigation profile, weight scale profile, heart rate profile&lt;br /&gt;
&lt;br /&gt;
=== Services ===&lt;br /&gt;
&lt;br /&gt;
A Service can have multiple characteristics. It has it’s own UUID. It has a handle. UUID, permissions, value&lt;br /&gt;
&lt;br /&gt;
=== Characteristics ===&lt;br /&gt;
&lt;br /&gt;
The characteristics are the lowest-level of the GATT Profiles. They also each use their own UUID.&lt;br /&gt;
These are relevant when it comes to protecting and enhancing security of a Bluetooth Low Energy device.&lt;br /&gt;
The characteristics have a value, properties and human-readable descriptors&lt;br /&gt;
&lt;br /&gt;
== Example UUIDs of a Polar Smartwatch ==&lt;br /&gt;
&lt;br /&gt;
Example Device UUID:&lt;br /&gt;
 &lt;br /&gt;
 C6C36C4A-7F8F-52B2-2BD7-C4F6690424E7&lt;br /&gt;
&lt;br /&gt;
Example Service UUIDs:&lt;br /&gt;
&lt;br /&gt;
 Service: 0000180a-0000-1000-8000-00805f9b34fb (Handle: 14): Device Information&lt;br /&gt;
 Service: 0000feee-0000-1000-8000-00805f9b34fb (Handle: 29): Polar Electro Oy&lt;br /&gt;
 Service: 0000180d-0000-1000-8000-00805f9b34fb (Handle: 38): Heart Rate&lt;br /&gt;
 Service: 0000180f-0000-1000-8000-00805f9b34fb (Handle: 42): Battery Service&lt;br /&gt;
&lt;br /&gt;
Example Service and their Characteristics UUIDs including handles, permissions, properties, values, descriptors:&lt;br /&gt;
&lt;br /&gt;
 Service: 0000180a-0000-1000-8000-00805f9b34fb (Handle: 14): Device Information&lt;br /&gt;
  Characteristic: 00002a29-0000-1000-8000-00805f9b34fb (Handle: 15) - Properties: [&#039;read&#039;]&lt;br /&gt;
  Characteristic: 00002a24-0000-1000-8000-00805f9b34fb (Handle: 17) - Properties: [&#039;read&#039;]&lt;br /&gt;
  Characteristic: 00002a25-0000-1000-8000-00805f9b34fb (Handle: 19) - Properties: [&#039;read&#039;]&lt;br /&gt;
  Characteristic: 00002a27-0000-1000-8000-00805f9b34fb (Handle: 21) - Properties: [&#039;read&#039;]&lt;br /&gt;
  Characteristic: 00002a26-0000-1000-8000-00805f9b34fb (Handle: 23) - Properties: [&#039;read&#039;]&lt;br /&gt;
  Characteristic: 00002a28-0000-1000-8000-00805f9b34fb (Handle: 25) - Properties: [&#039;read&#039;]&lt;br /&gt;
  Characteristic: 00002a23-0000-1000-8000-00805f9b34fb (Handle: 27) - Properties: [&#039;read&#039;]&lt;br /&gt;
 Service: 0000feee-0000-1000-8000-00805f9b34fb (Handle: 29): Polar Electro Oy&lt;br /&gt;
  Characteristic: fb005c51-02e7-f387-1cad-8acd2d8df0c8 (Handle: 30) - Properties: [&#039;write-without-response&#039;, &#039;write&#039;, &#039;notify&#039;]&lt;br /&gt;
  Characteristic: fb005c52-02e7-f387-1cad-8acd2d8df0c8 (Handle: 33) - Properties: [&#039;notify&#039;]&lt;br /&gt;
  Characteristic: fb005c53-02e7-f387-1cad-8acd2d8df0c8 (Handle: 36) - Properties: [&#039;write-without-response&#039;, &#039;write&#039;]&lt;br /&gt;
 Service: 0000180d-0000-1000-8000-00805f9b34fb (Handle: 38): Heart Rate&lt;br /&gt;
  Characteristic: 00002a37-0000-1000-8000-00805f9b34fb (Handle: 39) - Properties: [&#039;notify&#039;]&lt;br /&gt;
 Service: 0000180f-0000-1000-8000-00805f9b34fb (Handle: 42): Battery Service&lt;br /&gt;
  Characteristic: 00002a19-0000-1000-8000-00805f9b34fb (Handle: 43) - Properties: [&#039;read&#039;, &#039;notify&#039;]&lt;br /&gt;
&lt;br /&gt;
== BLE Operations ==&lt;br /&gt;
&lt;br /&gt;
* Read&lt;br /&gt;
Read the data of a characteristic&lt;br /&gt;
&lt;br /&gt;
* Write&lt;br /&gt;
Write data to a characteristic&lt;br /&gt;
&lt;br /&gt;
* Notify&lt;br /&gt;
Get notifications to value changes of a device by subscribing to it&lt;br /&gt;
&lt;br /&gt;
== Further Context ==&lt;br /&gt;
&lt;br /&gt;
Make sure to read&lt;br /&gt;
&lt;br /&gt;
* Setting Up Ubertooth on macOS for Bluetooth Hacking [https://wiki.elvis.science/index.php?title=Setting_Up_Ubertooth_on_macOS_for_Bluetooth_Hacking]&lt;br /&gt;
&lt;br /&gt;
== Courses ==&lt;br /&gt;
&lt;br /&gt;
* [[Selected IT-Security Chapters]] (2024)&lt;br /&gt;
&lt;br /&gt;
== Author ==&lt;br /&gt;
Are Maksimović&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
* https://bleak.readthedocs.io/en/latest/usage.html&lt;br /&gt;
* https://www.bluetooth.com/de/bluetooth-resources/intro-to-bluetooth-gap-gatt/&lt;br /&gt;
[[Category:Documentation]]&lt;/div&gt;</summary>
		<author><name>AMaksimovic</name></author>
	</entry>
	<entry>
		<id>https://elvis.hcw.ac.at/wiki/index.php?title=B-LE_-_GATT_Architectural_Overview&amp;diff=16721</id>
		<title>B-LE - GATT Architectural Overview</title>
		<link rel="alternate" type="text/html" href="https://elvis.hcw.ac.at/wiki/index.php?title=B-LE_-_GATT_Architectural_Overview&amp;diff=16721"/>
		<updated>2024-12-05T15:50:10Z</updated>

		<summary type="html">&lt;p&gt;AMaksimovic: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Description =&lt;br /&gt;
&lt;br /&gt;
This article goes into detail about GATT architectural features and its usage in Bluetooth LE Security designs. The research for this article was initiated during writing the paper on hacking a bluetooth smartwatch. There is an entire documentation on the practical experiment in[Setting Up Ubertooth on macOS for Bluetooth Hacking]. The network topology of a GATT network contains so-called central devices and peripheral devices. One peripheral is only connected to only one central device at a time. A central device can connect to many peripheral devices. The peripheral is also acting as the GATT server. It contains the definitions for profiles, services and characteristics of a device. The central device always initiates the data exchange.&lt;br /&gt;
&lt;br /&gt;
= Bluetooth LE =&lt;br /&gt;
&lt;br /&gt;
== GAP - Generic Attribute Profile ==&lt;br /&gt;
&lt;br /&gt;
The Generic attribute profile takes care of discovery, security, connectivity and network technolgies of a device as well as it&#039;s role. These are examples of packages during pairing:&lt;br /&gt;
&lt;br /&gt;
 ADV_IND&lt;br /&gt;
 SCAN_REQ&lt;br /&gt;
 SCAN_RSP&lt;br /&gt;
 CONNECT_IND&lt;br /&gt;
 AUX_SCAN_REQ&lt;br /&gt;
 AUX_SCAN_RSP&lt;br /&gt;
 AUX_CONNECT_REQ&lt;br /&gt;
 AUX_CONNECT_RSP&lt;br /&gt;
 ADV_SCAN_IND&lt;br /&gt;
&lt;br /&gt;
== GATT - Generic Attribute Profile ==&lt;br /&gt;
&lt;br /&gt;
As soon as two Bluetooth Low Energy devices establish a connection they can start transfering data back and forth. This data is formated into Services and Characteristics in a Server/Client relationship.&lt;br /&gt;
&lt;br /&gt;
== ATT - Attribute Protocol ==&lt;br /&gt;
&lt;br /&gt;
GATT is based on ATT. Each attribute gets it’s own Unique Identifier (UUID) here. These get formatted as characteristics and services.&lt;br /&gt;
&lt;br /&gt;
=== Profiles ===&lt;br /&gt;
&lt;br /&gt;
set of services per Profile &lt;br /&gt;
Example profiles: Basic audio profile, Location and navigation profile, weight scale profile, heart rate profile&lt;br /&gt;
&lt;br /&gt;
=== Services ===&lt;br /&gt;
&lt;br /&gt;
A Service can have multiple characteristics. It has it’s own UUID. It has a handle. UUID, permissions, value&lt;br /&gt;
&lt;br /&gt;
=== Characteristics ===&lt;br /&gt;
&lt;br /&gt;
The characteristics are the lowest-level of the GATT Profiles. They also each use their own UUID.&lt;br /&gt;
These are relevant when it comes to protecting and enhancing security of a Bluetooth Low Energy device.&lt;br /&gt;
The characteristics have a value, properties and human-readable descriptors&lt;br /&gt;
&lt;br /&gt;
== Example UUIDs of a Polar Smartwatch ==&lt;br /&gt;
&lt;br /&gt;
Example Device UUID:&lt;br /&gt;
 &lt;br /&gt;
 C6C36C4A-7F8F-52B2-2BD7-C4F6690424E7&lt;br /&gt;
&lt;br /&gt;
Example Service UUIDs:&lt;br /&gt;
&lt;br /&gt;
 Service: 0000180a-0000-1000-8000-00805f9b34fb (Handle: 14): Device Information&lt;br /&gt;
 Service: 0000feee-0000-1000-8000-00805f9b34fb (Handle: 29): Polar Electro Oy&lt;br /&gt;
 Service: 0000180d-0000-1000-8000-00805f9b34fb (Handle: 38): Heart Rate&lt;br /&gt;
 Service: 0000180f-0000-1000-8000-00805f9b34fb (Handle: 42): Battery Service&lt;br /&gt;
&lt;br /&gt;
Example Service and their Characteristics UUIDs including handles, permissions, properties, values, descriptors:&lt;br /&gt;
&lt;br /&gt;
 Service: 0000180a-0000-1000-8000-00805f9b34fb (Handle: 14): Device Information&lt;br /&gt;
  Characteristic: 00002a29-0000-1000-8000-00805f9b34fb (Handle: 15) - Properties: [&#039;read&#039;]&lt;br /&gt;
  Characteristic: 00002a24-0000-1000-8000-00805f9b34fb (Handle: 17) - Properties: [&#039;read&#039;]&lt;br /&gt;
  Characteristic: 00002a25-0000-1000-8000-00805f9b34fb (Handle: 19) - Properties: [&#039;read&#039;]&lt;br /&gt;
  Characteristic: 00002a27-0000-1000-8000-00805f9b34fb (Handle: 21) - Properties: [&#039;read&#039;]&lt;br /&gt;
  Characteristic: 00002a26-0000-1000-8000-00805f9b34fb (Handle: 23) - Properties: [&#039;read&#039;]&lt;br /&gt;
  Characteristic: 00002a28-0000-1000-8000-00805f9b34fb (Handle: 25) - Properties: [&#039;read&#039;]&lt;br /&gt;
  Characteristic: 00002a23-0000-1000-8000-00805f9b34fb (Handle: 27) - Properties: [&#039;read&#039;]&lt;br /&gt;
 Service: 0000feee-0000-1000-8000-00805f9b34fb (Handle: 29): Polar Electro Oy&lt;br /&gt;
  Characteristic: fb005c51-02e7-f387-1cad-8acd2d8df0c8 (Handle: 30) - Properties: [&#039;write-without-response&#039;, &#039;write&#039;, &#039;notify&#039;]&lt;br /&gt;
  Characteristic: fb005c52-02e7-f387-1cad-8acd2d8df0c8 (Handle: 33) - Properties: [&#039;notify&#039;]&lt;br /&gt;
  Characteristic: fb005c53-02e7-f387-1cad-8acd2d8df0c8 (Handle: 36) - Properties: [&#039;write-without-response&#039;, &#039;write&#039;]&lt;br /&gt;
 Service: 0000180d-0000-1000-8000-00805f9b34fb (Handle: 38): Heart Rate&lt;br /&gt;
  Characteristic: 00002a37-0000-1000-8000-00805f9b34fb (Handle: 39) - Properties: [&#039;notify&#039;]&lt;br /&gt;
 Service: 0000180f-0000-1000-8000-00805f9b34fb (Handle: 42): Battery Service&lt;br /&gt;
  Characteristic: 00002a19-0000-1000-8000-00805f9b34fb (Handle: 43) - Properties: [&#039;read&#039;, &#039;notify&#039;]&lt;br /&gt;
&lt;br /&gt;
== BLE Operations ==&lt;br /&gt;
&lt;br /&gt;
* Read&lt;br /&gt;
Read the data of a characteristic&lt;br /&gt;
&lt;br /&gt;
* Write&lt;br /&gt;
Write data to a characteristic&lt;br /&gt;
&lt;br /&gt;
* Notify&lt;br /&gt;
Get notifications to value changes of a device by subscribing to it&lt;br /&gt;
&lt;br /&gt;
== Further Context ==&lt;br /&gt;
&lt;br /&gt;
Make sure to read&lt;br /&gt;
&lt;br /&gt;
* Setting Up Ubertooth on macOS for Bluetooth Hacking [https://wiki.elvis.science/index.php?title=Setting_Up_Ubertooth_on_macOS_for_Bluetooth_Hacking]&lt;br /&gt;
&lt;br /&gt;
== Courses ==&lt;br /&gt;
&lt;br /&gt;
* [[Selected IT-Security Chapters]] (2024)&lt;br /&gt;
&lt;br /&gt;
== Author ==&lt;br /&gt;
Are Maksimović&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
* https://bleak.readthedocs.io/en/latest/usage.html&lt;br /&gt;
* https://www.bluetooth.com/de/bluetooth-resources/intro-to-bluetooth-gap-gatt/&lt;br /&gt;
[[Category:Documentation]]&lt;/div&gt;</summary>
		<author><name>AMaksimovic</name></author>
	</entry>
	<entry>
		<id>https://elvis.hcw.ac.at/wiki/index.php?title=B-LE_-_GATT_Architectural_Overview&amp;diff=16720</id>
		<title>B-LE - GATT Architectural Overview</title>
		<link rel="alternate" type="text/html" href="https://elvis.hcw.ac.at/wiki/index.php?title=B-LE_-_GATT_Architectural_Overview&amp;diff=16720"/>
		<updated>2024-12-05T15:45:12Z</updated>

		<summary type="html">&lt;p&gt;AMaksimovic: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Description =&lt;br /&gt;
&lt;br /&gt;
Description what this documentation is about.&lt;br /&gt;
&lt;br /&gt;
= Bluetooth LE =&lt;br /&gt;
&lt;br /&gt;
== GAP - Generic Attribute Profile ==&lt;br /&gt;
&lt;br /&gt;
The Generic attribute profile takes care of discovery, security, connectivity and network technolgies of a device as well as it&#039;s role. These are examples of packages during pairing:&lt;br /&gt;
&lt;br /&gt;
 ADV_IND&lt;br /&gt;
 SCAN_REQ&lt;br /&gt;
 SCAN_RSP&lt;br /&gt;
 CONNECT_IND&lt;br /&gt;
 AUX_SCAN_REQ&lt;br /&gt;
 AUX_SCAN_RSP&lt;br /&gt;
 AUX_CONNECT_REQ&lt;br /&gt;
 AUX_CONNECT_RSP&lt;br /&gt;
 ADV_SCAN_IND&lt;br /&gt;
&lt;br /&gt;
== GATT - Generic Attribute Profile ==&lt;br /&gt;
&lt;br /&gt;
As soon as two Bluetooth Low Energy devices establish a connection they can start transfering data back and forth. This data is formated into Services and Characteristics in a Server/Client relationship.&lt;br /&gt;
&lt;br /&gt;
== Network Topology ==&lt;br /&gt;
&lt;br /&gt;
The network topology of GATT networks contains so-called central devices and peripheral devices. One peripheral is only connected to only one central device at a time. A central device can connect to many peripheral devices. The peripheral is also acting as the GATT server. It contains the definitions for profiles, services and characteristics of a device. The central device always initiates the data exchange.&lt;br /&gt;
&lt;br /&gt;
== ATT - Attribute Protocol ==&lt;br /&gt;
&lt;br /&gt;
GATT is based on ATT. Each attribute gets it’s own Unique Identifier (UUID) here. These get formatted as characteristics and services.&lt;br /&gt;
&lt;br /&gt;
=== Profiles ===&lt;br /&gt;
&lt;br /&gt;
set of services per Profile &lt;br /&gt;
Example profiles: Basic audio profile, Location and navigation profile, weight scale profile, heart rate profile&lt;br /&gt;
&lt;br /&gt;
=== Services ===&lt;br /&gt;
&lt;br /&gt;
A Service can have multiple characteristics. It has it’s own UUID. It has a handle. UUID, permissions, value&lt;br /&gt;
&lt;br /&gt;
=== Characteristics ===&lt;br /&gt;
&lt;br /&gt;
The characteristics are the lowest-level of the GATT Profiles. They also each use their own UUID.&lt;br /&gt;
These are relevant when it comes to protecting and enhancing security of a Bluetooth Low Energy device.&lt;br /&gt;
The characteristics have a value, properties and human-readable descriptors&lt;br /&gt;
&lt;br /&gt;
== Example UUIDs of a Polar Smartwatch ==&lt;br /&gt;
&lt;br /&gt;
Example Device UUID:&lt;br /&gt;
 &lt;br /&gt;
 C6C36C4A-7F8F-52B2-2BD7-C4F6690424E7&lt;br /&gt;
&lt;br /&gt;
Example Service UUIDs:&lt;br /&gt;
&lt;br /&gt;
 Service: 0000180a-0000-1000-8000-00805f9b34fb (Handle: 14): Device Information&lt;br /&gt;
 Service: 0000feee-0000-1000-8000-00805f9b34fb (Handle: 29): Polar Electro Oy&lt;br /&gt;
 Service: 0000180d-0000-1000-8000-00805f9b34fb (Handle: 38): Heart Rate&lt;br /&gt;
 Service: 0000180f-0000-1000-8000-00805f9b34fb (Handle: 42): Battery Service&lt;br /&gt;
&lt;br /&gt;
Example Service and their Characteristics UUIDs including handles, permissions, properties, values, descriptors:&lt;br /&gt;
&lt;br /&gt;
 Service: 0000180a-0000-1000-8000-00805f9b34fb (Handle: 14): Device Information&lt;br /&gt;
  Characteristic: 00002a29-0000-1000-8000-00805f9b34fb (Handle: 15) - Properties: [&#039;read&#039;]&lt;br /&gt;
  Characteristic: 00002a24-0000-1000-8000-00805f9b34fb (Handle: 17) - Properties: [&#039;read&#039;]&lt;br /&gt;
  Characteristic: 00002a25-0000-1000-8000-00805f9b34fb (Handle: 19) - Properties: [&#039;read&#039;]&lt;br /&gt;
  Characteristic: 00002a27-0000-1000-8000-00805f9b34fb (Handle: 21) - Properties: [&#039;read&#039;]&lt;br /&gt;
  Characteristic: 00002a26-0000-1000-8000-00805f9b34fb (Handle: 23) - Properties: [&#039;read&#039;]&lt;br /&gt;
  Characteristic: 00002a28-0000-1000-8000-00805f9b34fb (Handle: 25) - Properties: [&#039;read&#039;]&lt;br /&gt;
  Characteristic: 00002a23-0000-1000-8000-00805f9b34fb (Handle: 27) - Properties: [&#039;read&#039;]&lt;br /&gt;
 Service: 0000feee-0000-1000-8000-00805f9b34fb (Handle: 29): Polar Electro Oy&lt;br /&gt;
  Characteristic: fb005c51-02e7-f387-1cad-8acd2d8df0c8 (Handle: 30) - Properties: [&#039;write-without-response&#039;, &#039;write&#039;, &#039;notify&#039;]&lt;br /&gt;
  Characteristic: fb005c52-02e7-f387-1cad-8acd2d8df0c8 (Handle: 33) - Properties: [&#039;notify&#039;]&lt;br /&gt;
  Characteristic: fb005c53-02e7-f387-1cad-8acd2d8df0c8 (Handle: 36) - Properties: [&#039;write-without-response&#039;, &#039;write&#039;]&lt;br /&gt;
 Service: 0000180d-0000-1000-8000-00805f9b34fb (Handle: 38): Heart Rate&lt;br /&gt;
  Characteristic: 00002a37-0000-1000-8000-00805f9b34fb (Handle: 39) - Properties: [&#039;notify&#039;]&lt;br /&gt;
 Service: 0000180f-0000-1000-8000-00805f9b34fb (Handle: 42): Battery Service&lt;br /&gt;
  Characteristic: 00002a19-0000-1000-8000-00805f9b34fb (Handle: 43) - Properties: [&#039;read&#039;, &#039;notify&#039;]&lt;br /&gt;
&lt;br /&gt;
== BLE Operations ==&lt;br /&gt;
&lt;br /&gt;
* Read&lt;br /&gt;
Read the data of a characteristic&lt;br /&gt;
&lt;br /&gt;
* Write&lt;br /&gt;
Write data to a characteristic&lt;br /&gt;
&lt;br /&gt;
* Notify&lt;br /&gt;
Get notifications to value changes of a device by subscribing to it&lt;br /&gt;
&lt;br /&gt;
== Further Context ==&lt;br /&gt;
&lt;br /&gt;
Make sure to read&lt;br /&gt;
&lt;br /&gt;
* Setting Up Ubertooth on macOS for Bluetooth Hacking [https://wiki.elvis.science/index.php?title=Setting_Up_Ubertooth_on_macOS_for_Bluetooth_Hacking]&lt;br /&gt;
&lt;br /&gt;
== Courses ==&lt;br /&gt;
&lt;br /&gt;
* [[Selected IT-Security Chapters]] (2024)&lt;br /&gt;
&lt;br /&gt;
== Author ==&lt;br /&gt;
Are Maksimović&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
* https://bleak.readthedocs.io/en/latest/usage.html&lt;br /&gt;
* https://www.bluetooth.com/de/bluetooth-resources/intro-to-bluetooth-gap-gatt/&lt;br /&gt;
[[Category:Documentation]]&lt;/div&gt;</summary>
		<author><name>AMaksimovic</name></author>
	</entry>
	<entry>
		<id>https://elvis.hcw.ac.at/wiki/index.php?title=B-LE_-_GATT_Architectural_Overview&amp;diff=16719</id>
		<title>B-LE - GATT Architectural Overview</title>
		<link rel="alternate" type="text/html" href="https://elvis.hcw.ac.at/wiki/index.php?title=B-LE_-_GATT_Architectural_Overview&amp;diff=16719"/>
		<updated>2024-12-05T15:44:11Z</updated>

		<summary type="html">&lt;p&gt;AMaksimovic: /* Bluetooth LE */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Description =&lt;br /&gt;
&lt;br /&gt;
Description what this documentation is about.&lt;br /&gt;
&lt;br /&gt;
= Bluetooth LE =&lt;br /&gt;
&lt;br /&gt;
== GAP - Generic Attribute Profile ==&lt;br /&gt;
&lt;br /&gt;
The Generic attribute profile takes care of discovery, security, connectivity and network technolgies of a device as well as it&#039;s role. These are examples of packages during pairing:&lt;br /&gt;
&lt;br /&gt;
 ADV_IND&lt;br /&gt;
 SCAN_REQ&lt;br /&gt;
 SCAN_RSP&lt;br /&gt;
 CONNECT_IND&lt;br /&gt;
 AUX_SCAN_REQ&lt;br /&gt;
 AUX_SCAN_RSP&lt;br /&gt;
 AUX_CONNECT_REQ&lt;br /&gt;
 AUX_CONNECT_RSP&lt;br /&gt;
 ADV_SCAN_IND&lt;br /&gt;
&lt;br /&gt;
== GATT - Generic Attribute Profile ==&lt;br /&gt;
&lt;br /&gt;
As soon as two Bluetooth Low Energy devices establish a connection they can start transfering data back and forth. This data is formated into Services and Characteristics in a Server/Client relationship.&lt;br /&gt;
&lt;br /&gt;
== Network Topology ==&lt;br /&gt;
&lt;br /&gt;
The network topology of GATT networks contains so-called central devices and peripheral devices. One peripheral is only connected to only one central device at a time. A central device can connect to many peripheral devices. The peripheral is also acting as the GATT server. It contains the definitions for profiles, services and characteristics of a device. The central device always initiates the data exchange.&lt;br /&gt;
&lt;br /&gt;
== ATT - Attribute Protocol ==&lt;br /&gt;
&lt;br /&gt;
GATT is based on ATT. Each attribute gets it’s own Unique Identifier (UUID) here. These get formatted as characteristics and services.&lt;br /&gt;
&lt;br /&gt;
== Profiles ==&lt;br /&gt;
&lt;br /&gt;
set of services per Profile &lt;br /&gt;
Example profiles: Basic audio profile, Location and navigation profile, weight scale profile, heart rate profile&lt;br /&gt;
&lt;br /&gt;
== Services ==&lt;br /&gt;
&lt;br /&gt;
A Service can have multiple characteristics. It has it’s own UUID. It has a handle. UUID, permissions, value&lt;br /&gt;
&lt;br /&gt;
== Characteristics ==&lt;br /&gt;
&lt;br /&gt;
The characteristics are the lowest-level of the GATT Profiles. They also each use their own UUID.&lt;br /&gt;
These are relevant when it comes to protecting and enhancing security of a Bluetooth Low Energy device.&lt;br /&gt;
The characteristics have a value, properties and human-readable descriptors&lt;br /&gt;
&lt;br /&gt;
== Example UUIDs of a Polar Smartwatch ==&lt;br /&gt;
&lt;br /&gt;
Example Device UUID:&lt;br /&gt;
 &lt;br /&gt;
 C6C36C4A-7F8F-52B2-2BD7-C4F6690424E7&lt;br /&gt;
&lt;br /&gt;
Example Service UUIDs:&lt;br /&gt;
&lt;br /&gt;
 Service: 0000180a-0000-1000-8000-00805f9b34fb (Handle: 14): Device Information&lt;br /&gt;
 Service: 0000feee-0000-1000-8000-00805f9b34fb (Handle: 29): Polar Electro Oy&lt;br /&gt;
 Service: 0000180d-0000-1000-8000-00805f9b34fb (Handle: 38): Heart Rate&lt;br /&gt;
 Service: 0000180f-0000-1000-8000-00805f9b34fb (Handle: 42): Battery Service&lt;br /&gt;
&lt;br /&gt;
Example Service and their Characteristics UUIDs including handles, permissions, properties, values, descriptors:&lt;br /&gt;
&lt;br /&gt;
 Service: 0000180a-0000-1000-8000-00805f9b34fb (Handle: 14): Device Information&lt;br /&gt;
  Characteristic: 00002a29-0000-1000-8000-00805f9b34fb (Handle: 15) - Properties: [&#039;read&#039;]&lt;br /&gt;
  Characteristic: 00002a24-0000-1000-8000-00805f9b34fb (Handle: 17) - Properties: [&#039;read&#039;]&lt;br /&gt;
  Characteristic: 00002a25-0000-1000-8000-00805f9b34fb (Handle: 19) - Properties: [&#039;read&#039;]&lt;br /&gt;
  Characteristic: 00002a27-0000-1000-8000-00805f9b34fb (Handle: 21) - Properties: [&#039;read&#039;]&lt;br /&gt;
  Characteristic: 00002a26-0000-1000-8000-00805f9b34fb (Handle: 23) - Properties: [&#039;read&#039;]&lt;br /&gt;
  Characteristic: 00002a28-0000-1000-8000-00805f9b34fb (Handle: 25) - Properties: [&#039;read&#039;]&lt;br /&gt;
  Characteristic: 00002a23-0000-1000-8000-00805f9b34fb (Handle: 27) - Properties: [&#039;read&#039;]&lt;br /&gt;
 Service: 0000feee-0000-1000-8000-00805f9b34fb (Handle: 29): Polar Electro Oy&lt;br /&gt;
  Characteristic: fb005c51-02e7-f387-1cad-8acd2d8df0c8 (Handle: 30) - Properties: [&#039;write-without-response&#039;, &#039;write&#039;, &#039;notify&#039;]&lt;br /&gt;
  Characteristic: fb005c52-02e7-f387-1cad-8acd2d8df0c8 (Handle: 33) - Properties: [&#039;notify&#039;]&lt;br /&gt;
  Characteristic: fb005c53-02e7-f387-1cad-8acd2d8df0c8 (Handle: 36) - Properties: [&#039;write-without-response&#039;, &#039;write&#039;]&lt;br /&gt;
 Service: 0000180d-0000-1000-8000-00805f9b34fb (Handle: 38): Heart Rate&lt;br /&gt;
  Characteristic: 00002a37-0000-1000-8000-00805f9b34fb (Handle: 39) - Properties: [&#039;notify&#039;]&lt;br /&gt;
 Service: 0000180f-0000-1000-8000-00805f9b34fb (Handle: 42): Battery Service&lt;br /&gt;
  Characteristic: 00002a19-0000-1000-8000-00805f9b34fb (Handle: 43) - Properties: [&#039;read&#039;, &#039;notify&#039;]&lt;br /&gt;
&lt;br /&gt;
== BLE Operations ==&lt;br /&gt;
&lt;br /&gt;
* Read&lt;br /&gt;
Read the data of a characteristic&lt;br /&gt;
&lt;br /&gt;
* Write&lt;br /&gt;
Write data to a characteristic&lt;br /&gt;
&lt;br /&gt;
* Notify&lt;br /&gt;
Get notifications to value changes of a device by subscribing to it&lt;br /&gt;
&lt;br /&gt;
== Further Context ==&lt;br /&gt;
&lt;br /&gt;
Make sure to read&lt;br /&gt;
&lt;br /&gt;
* Setting Up Ubertooth on macOS for Bluetooth Hacking [https://wiki.elvis.science/index.php?title=Setting_Up_Ubertooth_on_macOS_for_Bluetooth_Hacking]&lt;br /&gt;
&lt;br /&gt;
== Courses ==&lt;br /&gt;
&lt;br /&gt;
* [[Selected IT-Security Chapters]] (2024)&lt;br /&gt;
&lt;br /&gt;
== Author ==&lt;br /&gt;
Are Maksimović&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
* https://bleak.readthedocs.io/en/latest/usage.html&lt;br /&gt;
* https://www.bluetooth.com/de/bluetooth-resources/intro-to-bluetooth-gap-gatt/&lt;br /&gt;
[[Category:Documentation]]&lt;/div&gt;</summary>
		<author><name>AMaksimovic</name></author>
	</entry>
	<entry>
		<id>https://elvis.hcw.ac.at/wiki/index.php?title=B-LE_-_GATT_Architectural_Overview&amp;diff=16718</id>
		<title>B-LE - GATT Architectural Overview</title>
		<link rel="alternate" type="text/html" href="https://elvis.hcw.ac.at/wiki/index.php?title=B-LE_-_GATT_Architectural_Overview&amp;diff=16718"/>
		<updated>2024-12-05T15:38:52Z</updated>

		<summary type="html">&lt;p&gt;AMaksimovic: /* GATT - Architectural Overview */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Description =&lt;br /&gt;
&lt;br /&gt;
Description what this documentation is about.&lt;br /&gt;
&lt;br /&gt;
= Bluetooth LE =&lt;br /&gt;
&lt;br /&gt;
== GAP - Generic Attribute Profile ==&lt;br /&gt;
&lt;br /&gt;
The Generic attribute profile takes care of discovery, security, connectivity and network technolgies of a device. &lt;br /&gt;
&lt;br /&gt;
 ADV_IND&lt;br /&gt;
 SCAN_REQ&lt;br /&gt;
 SCAN_RSP&lt;br /&gt;
 CONNECT_IND&lt;br /&gt;
 AUX_SCAN_REQ&lt;br /&gt;
 AUX_SCAN_RSP&lt;br /&gt;
 AUX_CONNECT_REQ&lt;br /&gt;
 AUX_CONNECT_RSP&lt;br /&gt;
 ADV_SCAN_IND&lt;br /&gt;
&lt;br /&gt;
== GATT - Generic Attribute Profile ==&lt;br /&gt;
&lt;br /&gt;
As soon as two Bluetooth Low Energy devices establish a connection they can start transfering data back and forth. This data is formated into Services and Characteristics in a Server/Client relationship.&lt;br /&gt;
&lt;br /&gt;
== Network Topology ==&lt;br /&gt;
&lt;br /&gt;
The network topology of GATT networks contains so-called central devices and peripheral devices. One peripheral is only connected to only one central device at a time. A central device can connect to many peripheral devices. The peripheral is also acting as the GATT server. It contains the definitions for profiles, services and characteristics of a device. The central device always initiates the data exchange.&lt;br /&gt;
&lt;br /&gt;
== ATT - Attribute Protocol ==&lt;br /&gt;
&lt;br /&gt;
GATT is based on ATT. Each attribute gets it’s own Unique Identifier (UUID) here. These get formatted as characteristics and services.&lt;br /&gt;
&lt;br /&gt;
== Profiles ==&lt;br /&gt;
&lt;br /&gt;
set of services per Profile &lt;br /&gt;
Example profiles: Basic audio profile, Location and navigation profile, weight scale profile, heart rate profile&lt;br /&gt;
&lt;br /&gt;
== Services ==&lt;br /&gt;
&lt;br /&gt;
A Service can have multiple characteristics. It has it’s own UUID. It has a handle. UUID, permissions, value&lt;br /&gt;
&lt;br /&gt;
== Characteristics ==&lt;br /&gt;
&lt;br /&gt;
The characteristics are the lowest-level of the GATT Profiles. They also each use their own UUID.&lt;br /&gt;
These are relevant when it comes to protecting and enhancing security of a Bluetooth Low Energy device.&lt;br /&gt;
The characteristics have a value, properties and human-readable descriptors&lt;br /&gt;
&lt;br /&gt;
== Example UUIDs of a Polar Smartwatch ==&lt;br /&gt;
&lt;br /&gt;
Example Device UUID:&lt;br /&gt;
 &lt;br /&gt;
 C6C36C4A-7F8F-52B2-2BD7-C4F6690424E7&lt;br /&gt;
&lt;br /&gt;
Example Service UUIDs:&lt;br /&gt;
&lt;br /&gt;
 Service: 0000180a-0000-1000-8000-00805f9b34fb (Handle: 14): Device Information&lt;br /&gt;
 Service: 0000feee-0000-1000-8000-00805f9b34fb (Handle: 29): Polar Electro Oy&lt;br /&gt;
 Service: 0000180d-0000-1000-8000-00805f9b34fb (Handle: 38): Heart Rate&lt;br /&gt;
 Service: 0000180f-0000-1000-8000-00805f9b34fb (Handle: 42): Battery Service&lt;br /&gt;
&lt;br /&gt;
Example Service and their Characteristics UUIDs including handles, permissions, properties, values, descriptors:&lt;br /&gt;
&lt;br /&gt;
 Service: 0000180a-0000-1000-8000-00805f9b34fb (Handle: 14): Device Information&lt;br /&gt;
  Characteristic: 00002a29-0000-1000-8000-00805f9b34fb (Handle: 15) - Properties: [&#039;read&#039;]&lt;br /&gt;
  Characteristic: 00002a24-0000-1000-8000-00805f9b34fb (Handle: 17) - Properties: [&#039;read&#039;]&lt;br /&gt;
  Characteristic: 00002a25-0000-1000-8000-00805f9b34fb (Handle: 19) - Properties: [&#039;read&#039;]&lt;br /&gt;
  Characteristic: 00002a27-0000-1000-8000-00805f9b34fb (Handle: 21) - Properties: [&#039;read&#039;]&lt;br /&gt;
  Characteristic: 00002a26-0000-1000-8000-00805f9b34fb (Handle: 23) - Properties: [&#039;read&#039;]&lt;br /&gt;
  Characteristic: 00002a28-0000-1000-8000-00805f9b34fb (Handle: 25) - Properties: [&#039;read&#039;]&lt;br /&gt;
  Characteristic: 00002a23-0000-1000-8000-00805f9b34fb (Handle: 27) - Properties: [&#039;read&#039;]&lt;br /&gt;
 Service: 0000feee-0000-1000-8000-00805f9b34fb (Handle: 29): Polar Electro Oy&lt;br /&gt;
  Characteristic: fb005c51-02e7-f387-1cad-8acd2d8df0c8 (Handle: 30) - Properties: [&#039;write-without-response&#039;, &#039;write&#039;, &#039;notify&#039;]&lt;br /&gt;
  Characteristic: fb005c52-02e7-f387-1cad-8acd2d8df0c8 (Handle: 33) - Properties: [&#039;notify&#039;]&lt;br /&gt;
  Characteristic: fb005c53-02e7-f387-1cad-8acd2d8df0c8 (Handle: 36) - Properties: [&#039;write-without-response&#039;, &#039;write&#039;]&lt;br /&gt;
 Service: 0000180d-0000-1000-8000-00805f9b34fb (Handle: 38): Heart Rate&lt;br /&gt;
  Characteristic: 00002a37-0000-1000-8000-00805f9b34fb (Handle: 39) - Properties: [&#039;notify&#039;]&lt;br /&gt;
 Service: 0000180f-0000-1000-8000-00805f9b34fb (Handle: 42): Battery Service&lt;br /&gt;
  Characteristic: 00002a19-0000-1000-8000-00805f9b34fb (Handle: 43) - Properties: [&#039;read&#039;, &#039;notify&#039;]&lt;br /&gt;
&lt;br /&gt;
== BLE Operations ==&lt;br /&gt;
&lt;br /&gt;
* Read&lt;br /&gt;
Read the data of a characteristic&lt;br /&gt;
&lt;br /&gt;
* Write&lt;br /&gt;
Write data to a characteristic&lt;br /&gt;
&lt;br /&gt;
* Notify&lt;br /&gt;
Get notifications to value changes of a device by subscribing to it&lt;br /&gt;
&lt;br /&gt;
== Further Context ==&lt;br /&gt;
&lt;br /&gt;
Make sure to read&lt;br /&gt;
&lt;br /&gt;
* Setting Up Ubertooth on macOS for Bluetooth Hacking [https://wiki.elvis.science/index.php?title=Setting_Up_Ubertooth_on_macOS_for_Bluetooth_Hacking]&lt;br /&gt;
&lt;br /&gt;
== Courses ==&lt;br /&gt;
&lt;br /&gt;
* [[Selected IT-Security Chapters]] (2024)&lt;br /&gt;
&lt;br /&gt;
== Author ==&lt;br /&gt;
Are Maksimović&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
* https://bleak.readthedocs.io/en/latest/usage.html&lt;br /&gt;
* https://www.bluetooth.com/de/bluetooth-resources/intro-to-bluetooth-gap-gatt/&lt;br /&gt;
[[Category:Documentation]]&lt;/div&gt;</summary>
		<author><name>AMaksimovic</name></author>
	</entry>
	<entry>
		<id>https://elvis.hcw.ac.at/wiki/index.php?title=O.MG_Cable&amp;diff=16717</id>
		<title>O.MG Cable</title>
		<link rel="alternate" type="text/html" href="https://elvis.hcw.ac.at/wiki/index.php?title=O.MG_Cable&amp;diff=16717"/>
		<updated>2024-12-05T15:36:00Z</updated>

		<summary type="html">&lt;p&gt;AMaksimovic: AMaksimovic moved page (Article title) to B-LE - GATT Architectural Overview&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;#REDIRECT [[B-LE - GATT Architectural Overview]]&lt;/div&gt;</summary>
		<author><name>AMaksimovic</name></author>
	</entry>
	<entry>
		<id>https://elvis.hcw.ac.at/wiki/index.php?title=B-LE_-_GATT_Architectural_Overview&amp;diff=16716</id>
		<title>B-LE - GATT Architectural Overview</title>
		<link rel="alternate" type="text/html" href="https://elvis.hcw.ac.at/wiki/index.php?title=B-LE_-_GATT_Architectural_Overview&amp;diff=16716"/>
		<updated>2024-12-05T15:36:00Z</updated>

		<summary type="html">&lt;p&gt;AMaksimovic: AMaksimovic moved page (Article title) to B-LE - GATT Architectural Overview&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= GATT - Architectural Overview =&lt;br /&gt;
&lt;br /&gt;
Description what this documentation is about.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In order to complete these steps, you must have followed [[Some Other Documentation]] before.&lt;br /&gt;
&lt;br /&gt;
== Description ==&lt;br /&gt;
&lt;br /&gt;
=== GAP - Generic Attribute Profile ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The Generic attribute profile takes care of discovery, security, connectivity and network technolgies of a device. &lt;br /&gt;
&lt;br /&gt;
 ADV_IND&lt;br /&gt;
 SCAN_REQ&lt;br /&gt;
 SCAN_RSP&lt;br /&gt;
 CONNECT_IND&lt;br /&gt;
 AUX_SCAN_REQ&lt;br /&gt;
 AUX_SCAN_RSP&lt;br /&gt;
 AUX_CONNECT_REQ&lt;br /&gt;
 AUX_CONNECT_RSP&lt;br /&gt;
 ADV_SCAN_IND&lt;br /&gt;
&lt;br /&gt;
=== GATT - Generic Attribute Profile ===&lt;br /&gt;
&lt;br /&gt;
As soon as two Bluetooth Low Energy devices establish a connection they can start transfering data back and forth. This data is formated into Services and Characteristics in a Server/Client relationship.&lt;br /&gt;
&lt;br /&gt;
=== Network Topology ===&lt;br /&gt;
&lt;br /&gt;
The network topology of GATT networks contains so-called central devices and peripheral devices. One peripheral is only connected to only one central device at a time. A central device can connect to many peripheral devices. The peripheral is also acting as the GATT server. It contains the definitions for profiles, services and characteristics of a device. The central device always initiates the data exchange.&lt;br /&gt;
&lt;br /&gt;
=== ATT - Attribute Protocol ===&lt;br /&gt;
&lt;br /&gt;
GATT is based on ATT. Each attribute gets it’s own Unique Identifier (UUID) here. These get formatted as characteristics and services.&lt;br /&gt;
&lt;br /&gt;
=== Profiles ===&lt;br /&gt;
&lt;br /&gt;
set of services per Profile &lt;br /&gt;
Example profiles: Basic audio profile, Location and navigation profile, weight scale profile, heart rate profile&lt;br /&gt;
&lt;br /&gt;
=== Services ===&lt;br /&gt;
&lt;br /&gt;
A Service can have multiple characteristics. It has it’s own UUID. It has a handle. UUID, permissions, value&lt;br /&gt;
&lt;br /&gt;
=== Characteristics ===&lt;br /&gt;
&lt;br /&gt;
The characteristics are the lowest-level of the GATT Profiles. They also each use their own UUID.&lt;br /&gt;
These are relevant when it comes to protecting and enhancing security of a Bluetooth Low Energy device.&lt;br /&gt;
The characteristics have a value, properties and human-readable descriptors&lt;br /&gt;
&lt;br /&gt;
=== Example UUIDs of a Polar Smartwatch ===&lt;br /&gt;
&lt;br /&gt;
Example Device UUID:&lt;br /&gt;
 &lt;br /&gt;
 C6C36C4A-7F8F-52B2-2BD7-C4F6690424E7&lt;br /&gt;
&lt;br /&gt;
Example Service UUIDs:&lt;br /&gt;
&lt;br /&gt;
 Service: 0000180a-0000-1000-8000-00805f9b34fb (Handle: 14): Device Information&lt;br /&gt;
 Service: 0000feee-0000-1000-8000-00805f9b34fb (Handle: 29): Polar Electro Oy&lt;br /&gt;
 Service: 0000180d-0000-1000-8000-00805f9b34fb (Handle: 38): Heart Rate&lt;br /&gt;
 Service: 0000180f-0000-1000-8000-00805f9b34fb (Handle: 42): Battery Service&lt;br /&gt;
&lt;br /&gt;
Example Service and their Characteristics UUIDs including handles, permissions, properties, values, descriptors:&lt;br /&gt;
&lt;br /&gt;
 Service: 0000180a-0000-1000-8000-00805f9b34fb (Handle: 14): Device Information&lt;br /&gt;
  Characteristic: 00002a29-0000-1000-8000-00805f9b34fb (Handle: 15) - Properties: [&#039;read&#039;]&lt;br /&gt;
  Characteristic: 00002a24-0000-1000-8000-00805f9b34fb (Handle: 17) - Properties: [&#039;read&#039;]&lt;br /&gt;
  Characteristic: 00002a25-0000-1000-8000-00805f9b34fb (Handle: 19) - Properties: [&#039;read&#039;]&lt;br /&gt;
  Characteristic: 00002a27-0000-1000-8000-00805f9b34fb (Handle: 21) - Properties: [&#039;read&#039;]&lt;br /&gt;
  Characteristic: 00002a26-0000-1000-8000-00805f9b34fb (Handle: 23) - Properties: [&#039;read&#039;]&lt;br /&gt;
  Characteristic: 00002a28-0000-1000-8000-00805f9b34fb (Handle: 25) - Properties: [&#039;read&#039;]&lt;br /&gt;
  Characteristic: 00002a23-0000-1000-8000-00805f9b34fb (Handle: 27) - Properties: [&#039;read&#039;]&lt;br /&gt;
 Service: 0000feee-0000-1000-8000-00805f9b34fb (Handle: 29): Polar Electro Oy&lt;br /&gt;
  Characteristic: fb005c51-02e7-f387-1cad-8acd2d8df0c8 (Handle: 30) - Properties: [&#039;write-without-response&#039;, &#039;write&#039;, &#039;notify&#039;]&lt;br /&gt;
  Characteristic: fb005c52-02e7-f387-1cad-8acd2d8df0c8 (Handle: 33) - Properties: [&#039;notify&#039;]&lt;br /&gt;
  Characteristic: fb005c53-02e7-f387-1cad-8acd2d8df0c8 (Handle: 36) - Properties: [&#039;write-without-response&#039;, &#039;write&#039;]&lt;br /&gt;
 Service: 0000180d-0000-1000-8000-00805f9b34fb (Handle: 38): Heart Rate&lt;br /&gt;
  Characteristic: 00002a37-0000-1000-8000-00805f9b34fb (Handle: 39) - Properties: [&#039;notify&#039;]&lt;br /&gt;
 Service: 0000180f-0000-1000-8000-00805f9b34fb (Handle: 42): Battery Service&lt;br /&gt;
  Characteristic: 00002a19-0000-1000-8000-00805f9b34fb (Handle: 43) - Properties: [&#039;read&#039;, &#039;notify&#039;]&lt;br /&gt;
&lt;br /&gt;
=== BLE Operations ===&lt;br /&gt;
&lt;br /&gt;
* Read&lt;br /&gt;
Read the data of a characteristic&lt;br /&gt;
&lt;br /&gt;
* Write&lt;br /&gt;
Write data to a characteristic&lt;br /&gt;
&lt;br /&gt;
* Notify&lt;br /&gt;
Get notifications to value changes of a device by subscribing to it&lt;br /&gt;
&lt;br /&gt;
=== Further Context ===&lt;br /&gt;
&lt;br /&gt;
Make sure to read&lt;br /&gt;
&lt;br /&gt;
* Setting Up Ubertooth on macOS for Bluetooth Hacking [https://wiki.elvis.science/index.php?title=Setting_Up_Ubertooth_on_macOS_for_Bluetooth_Hacking]&lt;br /&gt;
&lt;br /&gt;
== Courses ==&lt;br /&gt;
&lt;br /&gt;
* [[Selected IT-Security Chapters]] (2024)&lt;br /&gt;
&lt;br /&gt;
== Author ==&lt;br /&gt;
Are Maksimović&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
* https://bleak.readthedocs.io/en/latest/usage.html&lt;br /&gt;
* https://www.bluetooth.com/de/bluetooth-resources/intro-to-bluetooth-gap-gatt/&lt;br /&gt;
[[Category:Documentation]]&lt;/div&gt;</summary>
		<author><name>AMaksimovic</name></author>
	</entry>
	<entry>
		<id>https://elvis.hcw.ac.at/wiki/index.php?title=B-LE_-_GATT_Architectural_Overview&amp;diff=16715</id>
		<title>B-LE - GATT Architectural Overview</title>
		<link rel="alternate" type="text/html" href="https://elvis.hcw.ac.at/wiki/index.php?title=B-LE_-_GATT_Architectural_Overview&amp;diff=16715"/>
		<updated>2024-12-05T15:22:17Z</updated>

		<summary type="html">&lt;p&gt;AMaksimovic: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= GATT - Architectural Overview =&lt;br /&gt;
&lt;br /&gt;
Description what this documentation is about.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In order to complete these steps, you must have followed [[Some Other Documentation]] before.&lt;br /&gt;
&lt;br /&gt;
== Description ==&lt;br /&gt;
&lt;br /&gt;
=== GAP - Generic Attribute Profile ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The Generic attribute profile takes care of discovery, security, connectivity and network technolgies of a device. &lt;br /&gt;
&lt;br /&gt;
 ADV_IND&lt;br /&gt;
 SCAN_REQ&lt;br /&gt;
 SCAN_RSP&lt;br /&gt;
 CONNECT_IND&lt;br /&gt;
 AUX_SCAN_REQ&lt;br /&gt;
 AUX_SCAN_RSP&lt;br /&gt;
 AUX_CONNECT_REQ&lt;br /&gt;
 AUX_CONNECT_RSP&lt;br /&gt;
 ADV_SCAN_IND&lt;br /&gt;
&lt;br /&gt;
=== GATT - Generic Attribute Profile ===&lt;br /&gt;
&lt;br /&gt;
As soon as two Bluetooth Low Energy devices establish a connection they can start transfering data back and forth. This data is formated into Services and Characteristics in a Server/Client relationship.&lt;br /&gt;
&lt;br /&gt;
=== Network Topology ===&lt;br /&gt;
&lt;br /&gt;
The network topology of GATT networks contains so-called central devices and peripheral devices. One peripheral is only connected to only one central device at a time. A central device can connect to many peripheral devices. The peripheral is also acting as the GATT server. It contains the definitions for profiles, services and characteristics of a device. The central device always initiates the data exchange.&lt;br /&gt;
&lt;br /&gt;
=== ATT - Attribute Protocol ===&lt;br /&gt;
&lt;br /&gt;
GATT is based on ATT. Each attribute gets it’s own Unique Identifier (UUID) here. These get formatted as characteristics and services.&lt;br /&gt;
&lt;br /&gt;
=== Profiles ===&lt;br /&gt;
&lt;br /&gt;
set of services per Profile &lt;br /&gt;
Example profiles: Basic audio profile, Location and navigation profile, weight scale profile, heart rate profile&lt;br /&gt;
&lt;br /&gt;
=== Services ===&lt;br /&gt;
&lt;br /&gt;
A Service can have multiple characteristics. It has it’s own UUID. It has a handle. UUID, permissions, value&lt;br /&gt;
&lt;br /&gt;
=== Characteristics ===&lt;br /&gt;
&lt;br /&gt;
The characteristics are the lowest-level of the GATT Profiles. They also each use their own UUID.&lt;br /&gt;
These are relevant when it comes to protecting and enhancing security of a Bluetooth Low Energy device.&lt;br /&gt;
The characteristics have a value, properties and human-readable descriptors&lt;br /&gt;
&lt;br /&gt;
=== Example UUIDs of a Polar Smartwatch ===&lt;br /&gt;
&lt;br /&gt;
Example Device UUID:&lt;br /&gt;
 &lt;br /&gt;
 C6C36C4A-7F8F-52B2-2BD7-C4F6690424E7&lt;br /&gt;
&lt;br /&gt;
Example Service UUIDs:&lt;br /&gt;
&lt;br /&gt;
 Service: 0000180a-0000-1000-8000-00805f9b34fb (Handle: 14): Device Information&lt;br /&gt;
 Service: 0000feee-0000-1000-8000-00805f9b34fb (Handle: 29): Polar Electro Oy&lt;br /&gt;
 Service: 0000180d-0000-1000-8000-00805f9b34fb (Handle: 38): Heart Rate&lt;br /&gt;
 Service: 0000180f-0000-1000-8000-00805f9b34fb (Handle: 42): Battery Service&lt;br /&gt;
&lt;br /&gt;
Example Service and their Characteristics UUIDs including handles, permissions, properties, values, descriptors:&lt;br /&gt;
&lt;br /&gt;
 Service: 0000180a-0000-1000-8000-00805f9b34fb (Handle: 14): Device Information&lt;br /&gt;
  Characteristic: 00002a29-0000-1000-8000-00805f9b34fb (Handle: 15) - Properties: [&#039;read&#039;]&lt;br /&gt;
  Characteristic: 00002a24-0000-1000-8000-00805f9b34fb (Handle: 17) - Properties: [&#039;read&#039;]&lt;br /&gt;
  Characteristic: 00002a25-0000-1000-8000-00805f9b34fb (Handle: 19) - Properties: [&#039;read&#039;]&lt;br /&gt;
  Characteristic: 00002a27-0000-1000-8000-00805f9b34fb (Handle: 21) - Properties: [&#039;read&#039;]&lt;br /&gt;
  Characteristic: 00002a26-0000-1000-8000-00805f9b34fb (Handle: 23) - Properties: [&#039;read&#039;]&lt;br /&gt;
  Characteristic: 00002a28-0000-1000-8000-00805f9b34fb (Handle: 25) - Properties: [&#039;read&#039;]&lt;br /&gt;
  Characteristic: 00002a23-0000-1000-8000-00805f9b34fb (Handle: 27) - Properties: [&#039;read&#039;]&lt;br /&gt;
 Service: 0000feee-0000-1000-8000-00805f9b34fb (Handle: 29): Polar Electro Oy&lt;br /&gt;
  Characteristic: fb005c51-02e7-f387-1cad-8acd2d8df0c8 (Handle: 30) - Properties: [&#039;write-without-response&#039;, &#039;write&#039;, &#039;notify&#039;]&lt;br /&gt;
  Characteristic: fb005c52-02e7-f387-1cad-8acd2d8df0c8 (Handle: 33) - Properties: [&#039;notify&#039;]&lt;br /&gt;
  Characteristic: fb005c53-02e7-f387-1cad-8acd2d8df0c8 (Handle: 36) - Properties: [&#039;write-without-response&#039;, &#039;write&#039;]&lt;br /&gt;
 Service: 0000180d-0000-1000-8000-00805f9b34fb (Handle: 38): Heart Rate&lt;br /&gt;
  Characteristic: 00002a37-0000-1000-8000-00805f9b34fb (Handle: 39) - Properties: [&#039;notify&#039;]&lt;br /&gt;
 Service: 0000180f-0000-1000-8000-00805f9b34fb (Handle: 42): Battery Service&lt;br /&gt;
  Characteristic: 00002a19-0000-1000-8000-00805f9b34fb (Handle: 43) - Properties: [&#039;read&#039;, &#039;notify&#039;]&lt;br /&gt;
&lt;br /&gt;
=== BLE Operations ===&lt;br /&gt;
&lt;br /&gt;
* Read&lt;br /&gt;
Read the data of a characteristic&lt;br /&gt;
&lt;br /&gt;
* Write&lt;br /&gt;
Write data to a characteristic&lt;br /&gt;
&lt;br /&gt;
* Notify&lt;br /&gt;
Get notifications to value changes of a device by subscribing to it&lt;br /&gt;
&lt;br /&gt;
=== Further Context ===&lt;br /&gt;
&lt;br /&gt;
Make sure to read&lt;br /&gt;
&lt;br /&gt;
* Setting Up Ubertooth on macOS for Bluetooth Hacking [https://wiki.elvis.science/index.php?title=Setting_Up_Ubertooth_on_macOS_for_Bluetooth_Hacking]&lt;br /&gt;
&lt;br /&gt;
== Courses ==&lt;br /&gt;
&lt;br /&gt;
* [[Selected IT-Security Chapters]] (2024)&lt;br /&gt;
&lt;br /&gt;
== Author ==&lt;br /&gt;
Are Maksimović&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
* https://bleak.readthedocs.io/en/latest/usage.html&lt;br /&gt;
* https://www.bluetooth.com/de/bluetooth-resources/intro-to-bluetooth-gap-gatt/&lt;br /&gt;
[[Category:Documentation]]&lt;/div&gt;</summary>
		<author><name>AMaksimovic</name></author>
	</entry>
	<entry>
		<id>https://elvis.hcw.ac.at/wiki/index.php?title=Setting_Up_Ubertooth_on_macOS_for_Bluetooth_Hacking&amp;diff=16712</id>
		<title>Setting Up Ubertooth on macOS for Bluetooth Hacking</title>
		<link rel="alternate" type="text/html" href="https://elvis.hcw.ac.at/wiki/index.php?title=Setting_Up_Ubertooth_on_macOS_for_Bluetooth_Hacking&amp;diff=16712"/>
		<updated>2024-12-05T15:14:22Z</updated>

		<summary type="html">&lt;p&gt;AMaksimovic: /* References */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Summary == &lt;br /&gt;
&lt;br /&gt;
This is a step-by-step guide on how to sniff Bluetooth Low Energy (BLE) packets between a Polar Vantage Smartwatch and a phone using the Ubertooth One. It will go into detail on the setup on a MacBook Air with MacOS using a python environment for the libraries that are used for the setup. Additionally every step of the actual sniff will be outlined. This guide is based on the seminar paper &amp;quot;Smartwatch Hacking Attack&amp;quot; that was written within the FH-course &amp;quot;Selected IT-Security Chapters&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
== Requirements ==&lt;br /&gt;
&lt;br /&gt;
* Hardware tools: Ubertooth One: Firmware version: 2020-12-R1 (API:1.07)&lt;br /&gt;
* Unix-based Operating System: macOS (macOS Sequoia 15.1.1), on a MacBook Air with an Apple M1 chip.&lt;br /&gt;
* Virtual Environment: Python Environment: Python 3.12&lt;br /&gt;
* Packages: libusb, wget, cmake, pkg-config, setuptools, pyqt5, numpy&lt;br /&gt;
* Libraries: libbtbb, bleak&lt;br /&gt;
* Software Tools: Crackle&lt;br /&gt;
&lt;br /&gt;
For the setup this guide was used and adjusted to the given scenario. [[Ubertooth - Build Guide - https://ubertooth.readthedocs.io/en/latest/build_guide.html]].&lt;br /&gt;
&lt;br /&gt;
== Description ==&lt;br /&gt;
&lt;br /&gt;
=== Step 1 - Install homebrew ===&lt;br /&gt;
&lt;br /&gt;
Enter these commands in the shell&lt;br /&gt;
&lt;br /&gt;
 /bin/bash -c &amp;quot;$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)&amp;quot;&lt;br /&gt;
 eval &amp;quot;$(/opt/homebrew/bin/brew shellenv)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
=== Step 2 - Install Python Environment ===&lt;br /&gt;
&lt;br /&gt;
Enter these commands in the shell&lt;br /&gt;
&lt;br /&gt;
 python3.12 -m venv myenv&lt;br /&gt;
 source myenv/bin/activate&lt;br /&gt;
&lt;br /&gt;
=== Step 3 - Install libusb, wget, cmake, pkg-config ===&lt;br /&gt;
&lt;br /&gt;
Enter these commands in the shell&lt;br /&gt;
&lt;br /&gt;
 brew install libusb wget cmake pkg-config&lt;br /&gt;
&lt;br /&gt;
=== Step 4 - Install the Bluetooth baseband library ===&lt;br /&gt;
&lt;br /&gt;
Enter these commands in the shell&lt;br /&gt;
&lt;br /&gt;
 wget https://github.com/greatscottgadgets/libbtbb/archive/2020-12-R1.tar.gz -O libbtbb-2020-12-R1.tar.gz&lt;br /&gt;
 tar -xf libbtbb-2020-12-R1.tar.gz&lt;br /&gt;
 cd libbtbb-2020-12-R1&lt;br /&gt;
 mkdir build&lt;br /&gt;
 cd build&lt;br /&gt;
 cmake ..&lt;br /&gt;
 make&lt;br /&gt;
&lt;br /&gt;
If errors occur with installing distutils switch to setuptools instead.&lt;br /&gt;
&lt;br /&gt;
 pip install setuptools&lt;br /&gt;
&lt;br /&gt;
After installing the setuptools also change the &amp;quot;from distutils import setup&amp;quot; line in the the libbtbb-2020-12-R1/build/python/pcaptools/setup.py file to this:&lt;br /&gt;
&lt;br /&gt;
 from setuptools import setup&lt;br /&gt;
&lt;br /&gt;
Also update the version in that same file to this:&lt;br /&gt;
&lt;br /&gt;
 version = &#039;2020.12.R1&#039;&lt;br /&gt;
&lt;br /&gt;
If necessary set the pythonpath in case you have different python versions:&lt;br /&gt;
 &lt;br /&gt;
 export PYTHONPATH=/Users/&amp;lt;username&amp;gt;/myenv/lib/python3.12/site-packages:$PYTHONPATH&lt;br /&gt;
&lt;br /&gt;
Then retry:&lt;br /&gt;
&lt;br /&gt;
 make&lt;br /&gt;
&lt;br /&gt;
 sudo make install&lt;br /&gt;
&lt;br /&gt;
=== Step 5 - Install the Ubertooth repository ===&lt;br /&gt;
&lt;br /&gt;
For this part you can attach the Ubertooth One to the MacBook. BUT DO NOT USE WITHOUT ANTENNA! More information can be found here: https://ubertooth.readthedocs.io/en/latest/ubertooth_one.html&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Enter these commands in the shell&lt;br /&gt;
&lt;br /&gt;
 wget https://github.com/greatscottgadgets/ubertooth/releases/download/2020-12-R1/ubertooth-2020-12-R1.tar.xz&lt;br /&gt;
 tar -xf ubertooth-2020-12-R1.tar.xz&lt;br /&gt;
 cd ubertooth-2020-12-R1/host&lt;br /&gt;
 mkdir build&lt;br /&gt;
 cd build&lt;br /&gt;
 cmake ..&lt;br /&gt;
 make&lt;br /&gt;
&lt;br /&gt;
If libusb module not found errors occur go to ubertooth-2020-12-R1/host/CMakeLists.txt an add your libusb-path manually:&lt;br /&gt;
&lt;br /&gt;
 include_directories(/opt/homebrew/include)&lt;br /&gt;
 link_directories(/opt/homebrew/lib)&lt;br /&gt;
&lt;br /&gt;
Additionally again change the &amp;quot;from distutils import setup&amp;quot; line in the the ubertooth-2020-12-R1/host/build/python/specan_ui/setup.py file to this:&lt;br /&gt;
&lt;br /&gt;
 from setuptools import setup&lt;br /&gt;
&lt;br /&gt;
Also update the version in that same file to this:&lt;br /&gt;
&lt;br /&gt;
 version = &#039;2020.12.R1&#039;&lt;br /&gt;
&lt;br /&gt;
Then retry:&lt;br /&gt;
&lt;br /&gt;
 make&lt;br /&gt;
&lt;br /&gt;
 sudo make install&lt;br /&gt;
&lt;br /&gt;
If you get errors regarding the environment variables showing that your library wasnt found you need to set the library path via the MacOs&#039;s dynamic linker.&lt;br /&gt;
&lt;br /&gt;
 export DYLD_LIBRARY_PATH=&amp;quot;/usr/local/lib:$DYLD_LIBRARY_PATH&amp;quot;&lt;br /&gt;
&lt;br /&gt;
or make it persistent in shell configurations: &lt;br /&gt;
&lt;br /&gt;
 ~/.zshrc&lt;br /&gt;
&lt;br /&gt;
Afterwards confirm the ubertooth library is working correctly:&lt;br /&gt;
&lt;br /&gt;
 ubertooth-util&lt;br /&gt;
&lt;br /&gt;
=== Step 6 - Test Ubertooth One commands ===&lt;br /&gt;
&lt;br /&gt;
Test these commands:&lt;br /&gt;
&lt;br /&gt;
 ubertooth-util -H&lt;br /&gt;
 ubertooth-util -v&lt;br /&gt;
 ubertooth-util -p&lt;br /&gt;
 ubertooth-util -s&lt;br /&gt;
&lt;br /&gt;
Update Ubertooth firmware in ubertooth-2020-12-R1/ubertooth-one-firmware-bin:&lt;br /&gt;
&lt;br /&gt;
 sudo ubertooth-dfu -d bluetooth_rxtx.dfu -r&lt;br /&gt;
&lt;br /&gt;
In case the libubertooth library is not loading check if the paths are correct.&lt;br /&gt;
&lt;br /&gt;
In ubertooth-2020-12-R1/host the following command leads to getting a list of sniffed Bluetooth packets with their Lower Address Parts (LAP):&lt;br /&gt;
&lt;br /&gt;
 ubertooth-rx&lt;br /&gt;
&lt;br /&gt;
For collecting Upper Address Parts (UAP) from the captured packets add -z:&lt;br /&gt;
&lt;br /&gt;
 ubertooth-rx -z&lt;br /&gt;
&lt;br /&gt;
Let it run for a while and look at the output. It will be summarized as Survey Results at the end of the output. There you can see the significant part of Bluetooth addresses of devices that were scanned. &lt;br /&gt;
&lt;br /&gt;
=== Step 7 - Use BTLE to follow the connection of the Bluetooth device you found. (Replace with device Bluetooth Address) ===&lt;br /&gt;
&lt;br /&gt;
 ubertooth-btle -f B0:67:B5:CF:E5:10 -r test.pcap&lt;br /&gt;
&lt;br /&gt;
Or create a pipe for viewing the captures directly in Wireshark:&lt;br /&gt;
&lt;br /&gt;
 mkfifo /tmp/pipe&lt;br /&gt;
 ubertooth-btle -f B0:67:B5:CF:E5:10 -c /tmp/pipe&lt;br /&gt;
&lt;br /&gt;
Find packages that involve the Polar Smartwatch&lt;br /&gt;
&lt;br /&gt;
 systime=1728247529 freq=2402 addr=8e89bed6 delta_t=34.320 ms rssi=-60&lt;br /&gt;
 20 1b c9 28 84 1a 9e a0 02 01 06 03 02 ee fe 0d ff 6b 00 72 08 00 00 00 00 00 00 00 00 47 e9 1f &lt;br /&gt;
 Advertising / AA 8e89bed6 (valid)/ 27 bytes&lt;br /&gt;
     Channel Index: 37&lt;br /&gt;
     Type:  ADV_IND&lt;br /&gt;
     AdvA:  a0:9e:1a:84:28:c9 (public)&lt;br /&gt;
     AdvData: 02 01 06 03 02 ee fe 0d ff 6b 00 72 08 00 00 00 00 00 00 00 00&lt;br /&gt;
         Type 01 (Flags)&lt;br /&gt;
            00000110&lt;br /&gt;
                LE General Discoverable Mode&lt;br /&gt;
                BR/EDR Not Supported&lt;br /&gt;
         Type 02 (16-bit Service UUIDs, more available)&lt;br /&gt;
            feee&lt;br /&gt;
         Type ff (Manufacturer Specific Data)&lt;br /&gt;
            Company: Polar Electro OY&lt;br /&gt;
            Data: 72 08 00 00 00 00 00 00 00 00&lt;br /&gt;
     Data:  c9 28 84 1a 9e a0 02 01 06 03 02 ee fe 0d ff 6b 00 72 08 00 00 00 00 00 00 00 00&lt;br /&gt;
     CRC:   47 e9 1f&lt;br /&gt;
&lt;br /&gt;
=== Step 8 - Use Crackle to crack packages ===&lt;br /&gt;
&lt;br /&gt;
Enter these commands:&lt;br /&gt;
&lt;br /&gt;
 git clone https://github.com/mikeryan/crackle.git&lt;br /&gt;
 cd crackle&lt;br /&gt;
 make&lt;br /&gt;
&lt;br /&gt;
Now try cracking your pcap.file&lt;br /&gt;
&lt;br /&gt;
 ./crackle -i &amp;lt;your_file.pcap&amp;gt; -o &amp;lt;your_new_output_file.pcap&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this case it wasnt possible to crack any packages from the smartwatch.&lt;br /&gt;
&lt;br /&gt;
=== Step 9 - Install bleak library ===&lt;br /&gt;
&lt;br /&gt;
 pip install bleak&lt;br /&gt;
&lt;br /&gt;
More information can be found in the bleak library documentation. (https://bleak.readthedocs.io/en/latest/usage.html) It also includes sample scripts which were used in the following setup.&lt;br /&gt;
&lt;br /&gt;
=== Step 10 - Write python script for reading device UUID ===&lt;br /&gt;
&lt;br /&gt;
Enter these commands in the shell&lt;br /&gt;
&lt;br /&gt;
 mkdir BLE-scripts&lt;br /&gt;
 cd BLE-scripts&lt;br /&gt;
 nano ble_scan.py&lt;br /&gt;
&lt;br /&gt;
Write simple script to read device UUID using BleakScaner.discover() method:&lt;br /&gt;
 &lt;br /&gt;
 import asyncio&lt;br /&gt;
 from bleak import BleakScanner&lt;br /&gt;
 async def scan():&lt;br /&gt;
     devices = await BleakScanner.discover()&lt;br /&gt;
     for d in devices:&lt;br /&gt;
         print(d)&lt;br /&gt;
 asyncio.run(scan())&lt;br /&gt;
&lt;br /&gt;
Run a scan:&lt;br /&gt;
&lt;br /&gt;
 python3 BLE-scripts/ble_scan.py&lt;br /&gt;
&lt;br /&gt;
Here the device UUID of the Polar smartwatch was found:&lt;br /&gt;
&lt;br /&gt;
 C6C36C4A-7F8F-52B2-2BD7-C4F6690424E7: Polar Vantage M 8428C92D&lt;br /&gt;
&lt;br /&gt;
=== Step 11 - Check GATT services  ===&lt;br /&gt;
&lt;br /&gt;
With the gathered device UUID check for the devices services:&lt;br /&gt;
&lt;br /&gt;
 nano BLE-scripts/ble_services.py&lt;br /&gt;
&lt;br /&gt;
 import asyncio&lt;br /&gt;
 from bleak import BleakClient&lt;br /&gt;
 device_uuid = &amp;quot;C6C36C4A-7F8F-52B2-2BD7-C4F6690424E7&amp;quot;&lt;br /&gt;
 async def connect_to_device(device_uuid):&lt;br /&gt;
     async with BleakClient(device_uuid) as client:&lt;br /&gt;
         connected = client.is_connected&lt;br /&gt;
         print(f&amp;quot;Connected: {connected}&amp;quot;)&lt;br /&gt;
         services = client.services&lt;br /&gt;
         if services is None:&lt;br /&gt;
             await client.get_services()&lt;br /&gt;
         for service in services:&lt;br /&gt;
             print(f&amp;quot;Service: {service}&amp;quot;)&lt;br /&gt;
 loop = asyncio.get_event_loop()&lt;br /&gt;
 loop.run_until_complete(connect_to_device(device_uuid))&lt;br /&gt;
&lt;br /&gt;
Run a services scan:&lt;br /&gt;
&lt;br /&gt;
 python3 BLE-scripts/ble_services.py&lt;br /&gt;
&lt;br /&gt;
Now the service UUIDs that were found are going to be listed like this:&lt;br /&gt;
&lt;br /&gt;
 Service: 0000180a-0000-1000-8000-00805f9b34fb (Handle: 14): Device Information&lt;br /&gt;
 Service: 0000feee-0000-1000-8000-00805f9b34fb (Handle: 29): Polar Electro Oy&lt;br /&gt;
 Service: 0000180d-0000-1000-8000-00805f9b34fb (Handle: 38): Heart Rate&lt;br /&gt;
 Service: 0000180f-0000-1000-8000-00805f9b34fb (Handle: 42): Battery Service&lt;br /&gt;
&lt;br /&gt;
=== Step 12 - Get characteristics UUIDs  ===&lt;br /&gt;
&lt;br /&gt;
 nano BLE-scripts/ble_characteristics.py&lt;br /&gt;
&lt;br /&gt;
 import asyncio&lt;br /&gt;
 from bleak import BleakClient&lt;br /&gt;
 device_uuid = &amp;quot;C6C36C4A-7F8F-52B2-2BD7-C4F6690424E7&amp;quot;&lt;br /&gt;
 async def connect_to_device(device_uuid):&lt;br /&gt;
     async with BleakClient(device_uuid) as client:&lt;br /&gt;
         connected = client.is_connected&lt;br /&gt;
         print(f&amp;quot;Connected: {connected}&amp;quot;)&lt;br /&gt;
         services = client.services&lt;br /&gt;
         if services is None:&lt;br /&gt;
             await client.get_services()&lt;br /&gt;
         for service in services:&lt;br /&gt;
             print(f&amp;quot;Service: {service.uuid} (Handle: {service.handle}): {service.description}&amp;quot;)&lt;br /&gt;
             for characteristic in service.characteristics:&lt;br /&gt;
                 print(f&amp;quot;  Characteristic: {characteristic.uuid} (Handle: {characteristic.handle}) - Properties: {cha$&lt;br /&gt;
 loop = asyncio.get_event_loop()&lt;br /&gt;
 loop.run_until_complete(connect_to_device(device_uuid))&lt;br /&gt;
&lt;br /&gt;
Now run the script:&lt;br /&gt;
&lt;br /&gt;
 python3 BLE-scripts/ble_characteristics.py&lt;br /&gt;
&lt;br /&gt;
Expected output:&lt;br /&gt;
&lt;br /&gt;
 Service: 0000180a-0000-1000-8000-00805f9b34fb (Handle: 14): Device Information&lt;br /&gt;
  Characteristic: 00002a29-0000-1000-8000-00805f9b34fb (Handle: 15) - Properties: [&#039;read&#039;]&lt;br /&gt;
  Characteristic: 00002a24-0000-1000-8000-00805f9b34fb (Handle: 17) - Properties: [&#039;read&#039;]&lt;br /&gt;
  Characteristic: 00002a25-0000-1000-8000-00805f9b34fb (Handle: 19) - Properties: [&#039;read&#039;]&lt;br /&gt;
  Characteristic: 00002a27-0000-1000-8000-00805f9b34fb (Handle: 21) - Properties: [&#039;read&#039;]&lt;br /&gt;
  Characteristic: 00002a26-0000-1000-8000-00805f9b34fb (Handle: 23) - Properties: [&#039;read&#039;]&lt;br /&gt;
  Characteristic: 00002a28-0000-1000-8000-00805f9b34fb (Handle: 25) - Properties: [&#039;read&#039;]&lt;br /&gt;
  Characteristic: 00002a23-0000-1000-8000-00805f9b34fb (Handle: 27) - Properties: [&#039;read&#039;]&lt;br /&gt;
 Service: 0000feee-0000-1000-8000-00805f9b34fb (Handle: 29): Polar Electro Oy&lt;br /&gt;
  Characteristic: fb005c51-02e7-f387-1cad-8acd2d8df0c8 (Handle: 30) - Properties: [&#039;write-without-response&#039;, &#039;write&#039;, &#039;notify&#039;]&lt;br /&gt;
  Characteristic: fb005c52-02e7-f387-1cad-8acd2d8df0c8 (Handle: 33) - Properties: [&#039;notify&#039;]&lt;br /&gt;
  Characteristic: fb005c53-02e7-f387-1cad-8acd2d8df0c8 (Handle: 36) - Properties: [&#039;write-without-response&#039;, &#039;write&#039;]&lt;br /&gt;
 Service: 0000180d-0000-1000-8000-00805f9b34fb (Handle: 38): Heart Rate&lt;br /&gt;
  Characteristic: 00002a37-0000-1000-8000-00805f9b34fb (Handle: 39) - Properties: [&#039;notify&#039;]&lt;br /&gt;
 Service: 0000180f-0000-1000-8000-00805f9b34fb (Handle: 42): Battery Service&lt;br /&gt;
  Characteristic: 00002a19-0000-1000-8000-00805f9b34fb (Handle: 43) - Properties: [&#039;read&#039;, &#039;notify&#039;]&lt;br /&gt;
&lt;br /&gt;
=== Step 13 - Read data ===&lt;br /&gt;
&lt;br /&gt;
Now add a script for reading the actual data. Make sure to use the characteristics UUIDs you have found out.&lt;br /&gt;
&lt;br /&gt;
 nano BLE-scripts/ble_read.py&lt;br /&gt;
&lt;br /&gt;
 import asyncio&lt;br /&gt;
 from bleak import BleakClient&lt;br /&gt;
 device_uuid = &amp;quot;C6C36C4A-7F8F-52B2-2BD7-C4F6690424E7&amp;quot;&lt;br /&gt;
 HEART_RATE_CHAR_UUID = &amp;quot;00002a37-0000-1000-8000-00805f9b34fb&amp;quot;&lt;br /&gt;
 BATTERY_LEVEL_CHAR_UUID = &amp;quot;00002a19-0000-1000-8000-00805f9b34fb&amp;quot;&lt;br /&gt;
 async def connect_and_read_data(device_uuid):&lt;br /&gt;
     async with BleakClient(device_uuid) as client:&lt;br /&gt;
         connected = client.is_connected&lt;br /&gt;
         print(f&amp;quot;Connected: {connected}&amp;quot;)&lt;br /&gt;
         if connected:&lt;br /&gt;
             try:&lt;br /&gt;
                 heart_rate = await client.read_gatt_char(HEART_RATE_CHAR_UUID)&lt;br /&gt;
                 heart_rate = int(heart_rate_data[1])&lt;br /&gt;
                 print(f&amp;quot;Heart Rate: {heart_rate} bpm&amp;quot;)&lt;br /&gt;
             except Exception as e:&lt;br /&gt;
                 print(f&amp;quot;Failed to read heart rate: {e}&amp;quot;)&lt;br /&gt;
             try:&lt;br /&gt;
                 battery_level = await client.read_gatt_char(BATTERY_LEVEL_CHAR_UUID)&lt;br /&gt;
                 print(f&amp;quot;Battery Level: {int(battery_level[0])}%&amp;quot;)&lt;br /&gt;
             except Exception as e:&lt;br /&gt;
                 print(f&amp;quot;Failed to read battery level: {e}&amp;quot;)&lt;br /&gt;
 loop = asyncio.get_event_loop()&lt;br /&gt;
 loop.run_until_complete(connect_and_read_data(device_uuid))&lt;br /&gt;
&lt;br /&gt;
Run script:&lt;br /&gt;
&lt;br /&gt;
 python3 BLE-scripts/ble_read.py&lt;br /&gt;
&lt;br /&gt;
In the output the battery level was succesfully read and printed out. The heart rate couldn&#039;t be accessed because it only has the notify property and no option for reading:&lt;br /&gt;
&lt;br /&gt;
 Connected: True&lt;br /&gt;
 Failed to read heart rate: Failed to read characteristic 39: Error Domain=CBATTErrorDomain Code=2 &amp;quot;Reading is not permitted.&amp;quot; UserInfo={NSLocalizedDescription=Reading is not permitted.}&lt;br /&gt;
 Battery Level: 16%&lt;br /&gt;
&lt;br /&gt;
=== Step 14 - Subscribe to heart rate notifications ===&lt;br /&gt;
&lt;br /&gt;
 nano BLE-scripts/ble_subscribe.py&lt;br /&gt;
&lt;br /&gt;
 import asyncio&lt;br /&gt;
 from bleak import BleakClient&lt;br /&gt;
 device_uuid = &amp;quot;C6C36C4A-7F8F-52B2-2BD7-C4F6690424E7&amp;quot;&lt;br /&gt;
 HEART_RATE_CHAR_UUID = &amp;quot;00002a37-0000-1000-8000-00805f9b34fb&amp;quot;&lt;br /&gt;
 def heart_rate_handler(sender, data):&lt;br /&gt;
     heart_rate = int(data[1]) if len(data) &amp;gt; 1 else None&lt;br /&gt;
     print(f&amp;quot;Heart Rate from {sender}: {heart_rate} bpm&amp;quot;)&lt;br /&gt;
 async def connect_and_subscribe(device_uuid):&lt;br /&gt;
     async with BleakClient(device_uuid) as client:&lt;br /&gt;
         connected = client.is_connected&lt;br /&gt;
         print(f&amp;quot;Connected: {connected}&amp;quot;)&lt;br /&gt;
         if connected:&lt;br /&gt;
             try:&lt;br /&gt;
                 await client.start_notify(HEART_RATE_CHAR_UUID, heart_rate_handler)&lt;br /&gt;
                 print(&amp;quot;Subscribed to heart rate notifications.&amp;quot;)&lt;br /&gt;
                 await asyncio.sleep(60)&lt;br /&gt;
                 await client.stop_notify(HEART_RATE_CHAR_UUID)&lt;br /&gt;
                 print(&amp;quot;Stopped heart rate notifications.&amp;quot;)&lt;br /&gt;
             except Exception as e:&lt;br /&gt;
                 print(f&amp;quot;Failed to subscribe to heart rate notifications: {e}&amp;quot;)&lt;br /&gt;
 asyncio.run(connect_and_subscribe(device_uuid))&lt;br /&gt;
&lt;br /&gt;
 python3 BLE-scripts/ble_subscribe.py&lt;br /&gt;
&lt;br /&gt;
It was not possible to get the heart rate data even though the notify property was assigned. That is because typically battery status data is on a lower securiy level than heart rate data. More information on GATT can be found here: https://www.bluetooth.com/de/bluetooth-resources/intro-to-bluetooth-gap-gatt/&lt;br /&gt;
&lt;br /&gt;
This is the output of the failed try:&lt;br /&gt;
&lt;br /&gt;
 Connected: True&lt;br /&gt;
 Subscribed to heart rate notifications.&lt;br /&gt;
 Stopped heart rate notifications.&lt;br /&gt;
&lt;br /&gt;
== Used Hardware ==&lt;br /&gt;
&lt;br /&gt;
* [[Ubertooth One, 2.4 GHz wireless development platform]]&lt;br /&gt;
&lt;br /&gt;
* [[Polar Vantage M]]&lt;br /&gt;
&lt;br /&gt;
* [[Apple iPhone 13 mini]]&lt;br /&gt;
&lt;br /&gt;
* [[MacBook Air M1, 2020]]&lt;br /&gt;
&lt;br /&gt;
* [[Samsung Galaxy J3]]&lt;br /&gt;
&lt;br /&gt;
== Courses ==&lt;br /&gt;
&lt;br /&gt;
* [[Selected IT-Security Chapters]] (2024)&lt;br /&gt;
&lt;br /&gt;
== Author ==&lt;br /&gt;
&lt;br /&gt;
Are Maksimović&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
* https://ubertooth.readthedocs.io/en/latest/&lt;br /&gt;
* https://www.greatscottgadgets.com/ubertoothone/&lt;br /&gt;
* https://codemuch.net/posts/bluetooth-hacking/&lt;br /&gt;
* https://bleak.readthedocs.io/en/latest/usage.html&lt;br /&gt;
* https://www.bluetooth.com/de/bluetooth-resources/intro-to-bluetooth-gap-gatt/&lt;br /&gt;
* https://support.polar.com/en/vantage-m#all&lt;br /&gt;
* https://wiki.elvis.science/index.php?title=(Article_title)#Example_UUIDs_of_a_Polar_Smartwatch&lt;br /&gt;
&lt;br /&gt;
[[Category:Documentation]]&lt;/div&gt;</summary>
		<author><name>AMaksimovic</name></author>
	</entry>
	<entry>
		<id>https://elvis.hcw.ac.at/wiki/index.php?title=B-LE_-_GATT_Architectural_Overview&amp;diff=16710</id>
		<title>B-LE - GATT Architectural Overview</title>
		<link rel="alternate" type="text/html" href="https://elvis.hcw.ac.at/wiki/index.php?title=B-LE_-_GATT_Architectural_Overview&amp;diff=16710"/>
		<updated>2024-12-05T15:13:08Z</updated>

		<summary type="html">&lt;p&gt;AMaksimovic: /* UUIDs */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== GATT - Architectural Overview == &lt;br /&gt;
&lt;br /&gt;
Description what this documentation is about.&lt;br /&gt;
&lt;br /&gt;
== Requirements ==&lt;br /&gt;
&lt;br /&gt;
* Operating system: Ubuntu 18.04 bionic amd64&lt;br /&gt;
* Packages: git emacs&lt;br /&gt;
&lt;br /&gt;
In order to complete these steps, you must have followed [[Some Other Documentation]] before.&lt;br /&gt;
&lt;br /&gt;
== Description ==&lt;br /&gt;
&lt;br /&gt;
=== GAP - Generic Attribute Profile ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The Generic attribute profile takes care of discovery, security, connectivity and network technolgies of a device. &lt;br /&gt;
&lt;br /&gt;
 ADV_IND&lt;br /&gt;
 SCAN_REQ&lt;br /&gt;
 SCAN_RSP&lt;br /&gt;
 CONNECT_IND&lt;br /&gt;
 AUX_SCAN_REQ&lt;br /&gt;
 AUX_SCAN_RSP&lt;br /&gt;
 AUX_CONNECT_REQ&lt;br /&gt;
 AUX_CONNECT_RSP&lt;br /&gt;
 ADV_SCAN_IND&lt;br /&gt;
&lt;br /&gt;
=== GATT - Generic Attribute Profile ===&lt;br /&gt;
&lt;br /&gt;
As soon as two Bluetooth Low Energy devices establish a connection they can start transfering data back and forth. This data is formated into Services and Characteristics in a Server/Client relationship.&lt;br /&gt;
&lt;br /&gt;
=== Network Topology ===&lt;br /&gt;
&lt;br /&gt;
The network topology of GATT networks contains so-called central devices and peripheral devices. One peripheral is only connected to only one central device at a time. A central device can connect to many peripheral devices. The peripheral is also acting as the GATT server. It contains the definitions for profiles, services and characteristics of a device. The central device always initiates the data exchange.&lt;br /&gt;
&lt;br /&gt;
=== ATT - Attribute Protocol ===&lt;br /&gt;
&lt;br /&gt;
GATT is based on ATT. Each attribute gets it’s own Unique Identifier (UUID) here. These get formatted as characteristics and services.&lt;br /&gt;
&lt;br /&gt;
=== Profiles ===&lt;br /&gt;
&lt;br /&gt;
set of services per Profile &lt;br /&gt;
Example profiles: Basic audio profile, Location and navigation profile, weight scale profile, heart rate profile&lt;br /&gt;
&lt;br /&gt;
=== Services ===&lt;br /&gt;
&lt;br /&gt;
A Service can have multiple characteristics. It has it’s own UUID. It has a handle. UUID, permissions, value&lt;br /&gt;
&lt;br /&gt;
=== Characteristics ===&lt;br /&gt;
&lt;br /&gt;
The characteristics are the lowest-level of the GATT Profiles. They also each use their own UUID.&lt;br /&gt;
These are relevant when it comes to protecting and enhancing security of a Bluetooth Low Energy device.&lt;br /&gt;
The characteristics have a value, properties and human-readable descriptors&lt;br /&gt;
&lt;br /&gt;
=== Example UUIDs of a Polar Smartwatch ===&lt;br /&gt;
&lt;br /&gt;
Example Device UUID:&lt;br /&gt;
 &lt;br /&gt;
 C6C36C4A-7F8F-52B2-2BD7-C4F6690424E7&lt;br /&gt;
&lt;br /&gt;
Example Service UUIDs:&lt;br /&gt;
&lt;br /&gt;
 Service: 0000180a-0000-1000-8000-00805f9b34fb (Handle: 14): Device Information&lt;br /&gt;
 Service: 0000feee-0000-1000-8000-00805f9b34fb (Handle: 29): Polar Electro Oy&lt;br /&gt;
 Service: 0000180d-0000-1000-8000-00805f9b34fb (Handle: 38): Heart Rate&lt;br /&gt;
 Service: 0000180f-0000-1000-8000-00805f9b34fb (Handle: 42): Battery Service&lt;br /&gt;
&lt;br /&gt;
Example Service and their Characteristics UUIDs including handles, permissions, properties, values, descriptors:&lt;br /&gt;
&lt;br /&gt;
 Service: 0000180a-0000-1000-8000-00805f9b34fb (Handle: 14): Device Information&lt;br /&gt;
  Characteristic: 00002a29-0000-1000-8000-00805f9b34fb (Handle: 15) - Properties: [&#039;read&#039;]&lt;br /&gt;
  Characteristic: 00002a24-0000-1000-8000-00805f9b34fb (Handle: 17) - Properties: [&#039;read&#039;]&lt;br /&gt;
  Characteristic: 00002a25-0000-1000-8000-00805f9b34fb (Handle: 19) - Properties: [&#039;read&#039;]&lt;br /&gt;
  Characteristic: 00002a27-0000-1000-8000-00805f9b34fb (Handle: 21) - Properties: [&#039;read&#039;]&lt;br /&gt;
  Characteristic: 00002a26-0000-1000-8000-00805f9b34fb (Handle: 23) - Properties: [&#039;read&#039;]&lt;br /&gt;
  Characteristic: 00002a28-0000-1000-8000-00805f9b34fb (Handle: 25) - Properties: [&#039;read&#039;]&lt;br /&gt;
  Characteristic: 00002a23-0000-1000-8000-00805f9b34fb (Handle: 27) - Properties: [&#039;read&#039;]&lt;br /&gt;
 Service: 0000feee-0000-1000-8000-00805f9b34fb (Handle: 29): Polar Electro Oy&lt;br /&gt;
  Characteristic: fb005c51-02e7-f387-1cad-8acd2d8df0c8 (Handle: 30) - Properties: [&#039;write-without-response&#039;, &#039;write&#039;, &#039;notify&#039;]&lt;br /&gt;
  Characteristic: fb005c52-02e7-f387-1cad-8acd2d8df0c8 (Handle: 33) - Properties: [&#039;notify&#039;]&lt;br /&gt;
  Characteristic: fb005c53-02e7-f387-1cad-8acd2d8df0c8 (Handle: 36) - Properties: [&#039;write-without-response&#039;, &#039;write&#039;]&lt;br /&gt;
 Service: 0000180d-0000-1000-8000-00805f9b34fb (Handle: 38): Heart Rate&lt;br /&gt;
  Characteristic: 00002a37-0000-1000-8000-00805f9b34fb (Handle: 39) - Properties: [&#039;notify&#039;]&lt;br /&gt;
 Service: 0000180f-0000-1000-8000-00805f9b34fb (Handle: 42): Battery Service&lt;br /&gt;
  Characteristic: 00002a19-0000-1000-8000-00805f9b34fb (Handle: 43) - Properties: [&#039;read&#039;, &#039;notify&#039;]&lt;br /&gt;
&lt;br /&gt;
=== BLE Operations ===&lt;br /&gt;
&lt;br /&gt;
* Read&lt;br /&gt;
Read the data of a characteristic&lt;br /&gt;
&lt;br /&gt;
* Write&lt;br /&gt;
Write data to a characteristic&lt;br /&gt;
&lt;br /&gt;
* Notify&lt;br /&gt;
Get notifications to value changes of a device by subscribing to it&lt;br /&gt;
&lt;br /&gt;
=== Further Context ===&lt;br /&gt;
&lt;br /&gt;
Make sure to read&lt;br /&gt;
&lt;br /&gt;
* Setting Up Ubertooth on macOS for Bluetooth Hacking [https://wiki.elvis.science/index.php?title=Setting_Up_Ubertooth_on_macOS_for_Bluetooth_Hacking]&lt;br /&gt;
&lt;br /&gt;
== Courses ==&lt;br /&gt;
&lt;br /&gt;
* [[Selected IT-Security Chapters]] (2024)&lt;br /&gt;
&lt;br /&gt;
== Author ==&lt;br /&gt;
Are Maksimović&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
* https://bleak.readthedocs.io/en/latest/usage.html&lt;br /&gt;
* https://www.bluetooth.com/de/bluetooth-resources/intro-to-bluetooth-gap-gatt/&lt;br /&gt;
[[Category:Documentation]]&lt;/div&gt;</summary>
		<author><name>AMaksimovic</name></author>
	</entry>
	<entry>
		<id>https://elvis.hcw.ac.at/wiki/index.php?title=B-LE_-_GATT_Architectural_Overview&amp;diff=16708</id>
		<title>B-LE - GATT Architectural Overview</title>
		<link rel="alternate" type="text/html" href="https://elvis.hcw.ac.at/wiki/index.php?title=B-LE_-_GATT_Architectural_Overview&amp;diff=16708"/>
		<updated>2024-12-05T15:11:49Z</updated>

		<summary type="html">&lt;p&gt;AMaksimovic: /* Network Topology */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== GATT - Architectural Overview == &lt;br /&gt;
&lt;br /&gt;
Description what this documentation is about.&lt;br /&gt;
&lt;br /&gt;
== Requirements ==&lt;br /&gt;
&lt;br /&gt;
* Operating system: Ubuntu 18.04 bionic amd64&lt;br /&gt;
* Packages: git emacs&lt;br /&gt;
&lt;br /&gt;
In order to complete these steps, you must have followed [[Some Other Documentation]] before.&lt;br /&gt;
&lt;br /&gt;
== Description ==&lt;br /&gt;
&lt;br /&gt;
=== GAP - Generic Attribute Profile ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The Generic attribute profile takes care of discovery, security, connectivity and network technolgies of a device. &lt;br /&gt;
&lt;br /&gt;
 ADV_IND&lt;br /&gt;
 SCAN_REQ&lt;br /&gt;
 SCAN_RSP&lt;br /&gt;
 CONNECT_IND&lt;br /&gt;
 AUX_SCAN_REQ&lt;br /&gt;
 AUX_SCAN_RSP&lt;br /&gt;
 AUX_CONNECT_REQ&lt;br /&gt;
 AUX_CONNECT_RSP&lt;br /&gt;
 ADV_SCAN_IND&lt;br /&gt;
&lt;br /&gt;
=== GATT - Generic Attribute Profile ===&lt;br /&gt;
&lt;br /&gt;
As soon as two Bluetooth Low Energy devices establish a connection they can start transfering data back and forth. This data is formated into Services and Characteristics in a Server/Client relationship.&lt;br /&gt;
&lt;br /&gt;
=== Network Topology ===&lt;br /&gt;
&lt;br /&gt;
The network topology of GATT networks contains so-called central devices and peripheral devices. One peripheral is only connected to only one central device at a time. A central device can connect to many peripheral devices. The peripheral is also acting as the GATT server. It contains the definitions for profiles, services and characteristics of a device. The central device always initiates the data exchange.&lt;br /&gt;
&lt;br /&gt;
=== ATT - Attribute Protocol ===&lt;br /&gt;
&lt;br /&gt;
GATT is based on ATT. Each attribute gets it’s own Unique Identifier (UUID) here. These get formatted as characteristics and services.&lt;br /&gt;
&lt;br /&gt;
=== Profiles ===&lt;br /&gt;
&lt;br /&gt;
set of services per Profile &lt;br /&gt;
Example profiles: Basic audio profile, Location and navigation profile, weight scale profile, heart rate profile&lt;br /&gt;
&lt;br /&gt;
=== Services ===&lt;br /&gt;
&lt;br /&gt;
A Service can have multiple characteristics. It has it’s own UUID. It has a handle. UUID, permissions, value&lt;br /&gt;
&lt;br /&gt;
=== Characteristics ===&lt;br /&gt;
&lt;br /&gt;
The characteristics are the lowest-level of the GATT Profiles. They also each use their own UUID.&lt;br /&gt;
These are relevant when it comes to protecting and enhancing security of a Bluetooth Low Energy device.&lt;br /&gt;
The characteristics have a value, properties and human-readable descriptors&lt;br /&gt;
&lt;br /&gt;
=== UUIDs ===&lt;br /&gt;
&lt;br /&gt;
Example Device UUID:&lt;br /&gt;
 &lt;br /&gt;
 C6C36C4A-7F8F-52B2-2BD7-C4F6690424E7&lt;br /&gt;
&lt;br /&gt;
Example Service UUIDs:&lt;br /&gt;
&lt;br /&gt;
 Service: 0000180a-0000-1000-8000-00805f9b34fb (Handle: 14): Device Information&lt;br /&gt;
 Service: 0000feee-0000-1000-8000-00805f9b34fb (Handle: 29): Polar Electro Oy&lt;br /&gt;
 Service: 0000180d-0000-1000-8000-00805f9b34fb (Handle: 38): Heart Rate&lt;br /&gt;
 Service: 0000180f-0000-1000-8000-00805f9b34fb (Handle: 42): Battery Service&lt;br /&gt;
&lt;br /&gt;
Example Service and their Characteristics UUIDs including handles, permissions, properties, values, descriptors:&lt;br /&gt;
&lt;br /&gt;
 Service: 0000180a-0000-1000-8000-00805f9b34fb (Handle: 14): Device Information&lt;br /&gt;
  Characteristic: 00002a29-0000-1000-8000-00805f9b34fb (Handle: 15) - Properties: [&#039;read&#039;]&lt;br /&gt;
  Characteristic: 00002a24-0000-1000-8000-00805f9b34fb (Handle: 17) - Properties: [&#039;read&#039;]&lt;br /&gt;
  Characteristic: 00002a25-0000-1000-8000-00805f9b34fb (Handle: 19) - Properties: [&#039;read&#039;]&lt;br /&gt;
  Characteristic: 00002a27-0000-1000-8000-00805f9b34fb (Handle: 21) - Properties: [&#039;read&#039;]&lt;br /&gt;
  Characteristic: 00002a26-0000-1000-8000-00805f9b34fb (Handle: 23) - Properties: [&#039;read&#039;]&lt;br /&gt;
  Characteristic: 00002a28-0000-1000-8000-00805f9b34fb (Handle: 25) - Properties: [&#039;read&#039;]&lt;br /&gt;
  Characteristic: 00002a23-0000-1000-8000-00805f9b34fb (Handle: 27) - Properties: [&#039;read&#039;]&lt;br /&gt;
 Service: 0000feee-0000-1000-8000-00805f9b34fb (Handle: 29): Polar Electro Oy&lt;br /&gt;
  Characteristic: fb005c51-02e7-f387-1cad-8acd2d8df0c8 (Handle: 30) - Properties: [&#039;write-without-response&#039;, &#039;write&#039;, &#039;notify&#039;]&lt;br /&gt;
  Characteristic: fb005c52-02e7-f387-1cad-8acd2d8df0c8 (Handle: 33) - Properties: [&#039;notify&#039;]&lt;br /&gt;
  Characteristic: fb005c53-02e7-f387-1cad-8acd2d8df0c8 (Handle: 36) - Properties: [&#039;write-without-response&#039;, &#039;write&#039;]&lt;br /&gt;
 Service: 0000180d-0000-1000-8000-00805f9b34fb (Handle: 38): Heart Rate&lt;br /&gt;
  Characteristic: 00002a37-0000-1000-8000-00805f9b34fb (Handle: 39) - Properties: [&#039;notify&#039;]&lt;br /&gt;
 Service: 0000180f-0000-1000-8000-00805f9b34fb (Handle: 42): Battery Service&lt;br /&gt;
  Characteristic: 00002a19-0000-1000-8000-00805f9b34fb (Handle: 43) - Properties: [&#039;read&#039;, &#039;notify&#039;]&lt;br /&gt;
&lt;br /&gt;
=== BLE Operations ===&lt;br /&gt;
&lt;br /&gt;
* Read&lt;br /&gt;
Read the data of a characteristic&lt;br /&gt;
&lt;br /&gt;
* Write&lt;br /&gt;
Write data to a characteristic&lt;br /&gt;
&lt;br /&gt;
* Notify&lt;br /&gt;
Get notifications to value changes of a device by subscribing to it&lt;br /&gt;
&lt;br /&gt;
=== Further Context ===&lt;br /&gt;
&lt;br /&gt;
Make sure to read&lt;br /&gt;
&lt;br /&gt;
* Setting Up Ubertooth on macOS for Bluetooth Hacking [https://wiki.elvis.science/index.php?title=Setting_Up_Ubertooth_on_macOS_for_Bluetooth_Hacking]&lt;br /&gt;
&lt;br /&gt;
== Courses ==&lt;br /&gt;
&lt;br /&gt;
* [[Selected IT-Security Chapters]] (2024)&lt;br /&gt;
&lt;br /&gt;
== Author ==&lt;br /&gt;
Are Maksimović&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
* https://bleak.readthedocs.io/en/latest/usage.html&lt;br /&gt;
* https://www.bluetooth.com/de/bluetooth-resources/intro-to-bluetooth-gap-gatt/&lt;br /&gt;
[[Category:Documentation]]&lt;/div&gt;</summary>
		<author><name>AMaksimovic</name></author>
	</entry>
	<entry>
		<id>https://elvis.hcw.ac.at/wiki/index.php?title=B-LE_-_GATT_Architectural_Overview&amp;diff=16707</id>
		<title>B-LE - GATT Architectural Overview</title>
		<link rel="alternate" type="text/html" href="https://elvis.hcw.ac.at/wiki/index.php?title=B-LE_-_GATT_Architectural_Overview&amp;diff=16707"/>
		<updated>2024-12-05T15:11:39Z</updated>

		<summary type="html">&lt;p&gt;AMaksimovic: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== GATT - Architectural Overview == &lt;br /&gt;
&lt;br /&gt;
Description what this documentation is about.&lt;br /&gt;
&lt;br /&gt;
== Requirements ==&lt;br /&gt;
&lt;br /&gt;
* Operating system: Ubuntu 18.04 bionic amd64&lt;br /&gt;
* Packages: git emacs&lt;br /&gt;
&lt;br /&gt;
In order to complete these steps, you must have followed [[Some Other Documentation]] before.&lt;br /&gt;
&lt;br /&gt;
== Description ==&lt;br /&gt;
&lt;br /&gt;
=== GAP - Generic Attribute Profile ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The Generic attribute profile takes care of discovery, security, connectivity and network technolgies of a device. &lt;br /&gt;
&lt;br /&gt;
 ADV_IND&lt;br /&gt;
 SCAN_REQ&lt;br /&gt;
 SCAN_RSP&lt;br /&gt;
 CONNECT_IND&lt;br /&gt;
 AUX_SCAN_REQ&lt;br /&gt;
 AUX_SCAN_RSP&lt;br /&gt;
 AUX_CONNECT_REQ&lt;br /&gt;
 AUX_CONNECT_RSP&lt;br /&gt;
 ADV_SCAN_IND&lt;br /&gt;
&lt;br /&gt;
=== GATT - Generic Attribute Profile ===&lt;br /&gt;
&lt;br /&gt;
As soon as two Bluetooth Low Energy devices establish a connection they can start transfering data back and forth. This data is formated into Services and Characteristics in a Server/Client relationship.&lt;br /&gt;
&lt;br /&gt;
=== Network Topology ===&lt;br /&gt;
&lt;br /&gt;
The network topology of GATT networks contains so-called central devices and peripheral devices. One peripheral is only connected to only one central device at a time. A central device can connect to many peripheral devices. The peripheral is also acting as the GATT server. It contains the definitions for profiles, services and characteristics of a device. The central device always initiates the data exchange. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== ATT - Attribute Protocol ===&lt;br /&gt;
&lt;br /&gt;
GATT is based on ATT. Each attribute gets it’s own Unique Identifier (UUID) here. These get formatted as characteristics and services.&lt;br /&gt;
&lt;br /&gt;
=== Profiles ===&lt;br /&gt;
&lt;br /&gt;
set of services per Profile &lt;br /&gt;
Example profiles: Basic audio profile, Location and navigation profile, weight scale profile, heart rate profile&lt;br /&gt;
&lt;br /&gt;
=== Services ===&lt;br /&gt;
&lt;br /&gt;
A Service can have multiple characteristics. It has it’s own UUID. It has a handle. UUID, permissions, value&lt;br /&gt;
&lt;br /&gt;
=== Characteristics ===&lt;br /&gt;
&lt;br /&gt;
The characteristics are the lowest-level of the GATT Profiles. They also each use their own UUID.&lt;br /&gt;
These are relevant when it comes to protecting and enhancing security of a Bluetooth Low Energy device.&lt;br /&gt;
The characteristics have a value, properties and human-readable descriptors&lt;br /&gt;
&lt;br /&gt;
=== UUIDs ===&lt;br /&gt;
&lt;br /&gt;
Example Device UUID:&lt;br /&gt;
 &lt;br /&gt;
 C6C36C4A-7F8F-52B2-2BD7-C4F6690424E7&lt;br /&gt;
&lt;br /&gt;
Example Service UUIDs:&lt;br /&gt;
&lt;br /&gt;
 Service: 0000180a-0000-1000-8000-00805f9b34fb (Handle: 14): Device Information&lt;br /&gt;
 Service: 0000feee-0000-1000-8000-00805f9b34fb (Handle: 29): Polar Electro Oy&lt;br /&gt;
 Service: 0000180d-0000-1000-8000-00805f9b34fb (Handle: 38): Heart Rate&lt;br /&gt;
 Service: 0000180f-0000-1000-8000-00805f9b34fb (Handle: 42): Battery Service&lt;br /&gt;
&lt;br /&gt;
Example Service and their Characteristics UUIDs including handles, permissions, properties, values, descriptors:&lt;br /&gt;
&lt;br /&gt;
 Service: 0000180a-0000-1000-8000-00805f9b34fb (Handle: 14): Device Information&lt;br /&gt;
  Characteristic: 00002a29-0000-1000-8000-00805f9b34fb (Handle: 15) - Properties: [&#039;read&#039;]&lt;br /&gt;
  Characteristic: 00002a24-0000-1000-8000-00805f9b34fb (Handle: 17) - Properties: [&#039;read&#039;]&lt;br /&gt;
  Characteristic: 00002a25-0000-1000-8000-00805f9b34fb (Handle: 19) - Properties: [&#039;read&#039;]&lt;br /&gt;
  Characteristic: 00002a27-0000-1000-8000-00805f9b34fb (Handle: 21) - Properties: [&#039;read&#039;]&lt;br /&gt;
  Characteristic: 00002a26-0000-1000-8000-00805f9b34fb (Handle: 23) - Properties: [&#039;read&#039;]&lt;br /&gt;
  Characteristic: 00002a28-0000-1000-8000-00805f9b34fb (Handle: 25) - Properties: [&#039;read&#039;]&lt;br /&gt;
  Characteristic: 00002a23-0000-1000-8000-00805f9b34fb (Handle: 27) - Properties: [&#039;read&#039;]&lt;br /&gt;
 Service: 0000feee-0000-1000-8000-00805f9b34fb (Handle: 29): Polar Electro Oy&lt;br /&gt;
  Characteristic: fb005c51-02e7-f387-1cad-8acd2d8df0c8 (Handle: 30) - Properties: [&#039;write-without-response&#039;, &#039;write&#039;, &#039;notify&#039;]&lt;br /&gt;
  Characteristic: fb005c52-02e7-f387-1cad-8acd2d8df0c8 (Handle: 33) - Properties: [&#039;notify&#039;]&lt;br /&gt;
  Characteristic: fb005c53-02e7-f387-1cad-8acd2d8df0c8 (Handle: 36) - Properties: [&#039;write-without-response&#039;, &#039;write&#039;]&lt;br /&gt;
 Service: 0000180d-0000-1000-8000-00805f9b34fb (Handle: 38): Heart Rate&lt;br /&gt;
  Characteristic: 00002a37-0000-1000-8000-00805f9b34fb (Handle: 39) - Properties: [&#039;notify&#039;]&lt;br /&gt;
 Service: 0000180f-0000-1000-8000-00805f9b34fb (Handle: 42): Battery Service&lt;br /&gt;
  Characteristic: 00002a19-0000-1000-8000-00805f9b34fb (Handle: 43) - Properties: [&#039;read&#039;, &#039;notify&#039;]&lt;br /&gt;
&lt;br /&gt;
=== BLE Operations ===&lt;br /&gt;
&lt;br /&gt;
* Read&lt;br /&gt;
Read the data of a characteristic&lt;br /&gt;
&lt;br /&gt;
* Write&lt;br /&gt;
Write data to a characteristic&lt;br /&gt;
&lt;br /&gt;
* Notify&lt;br /&gt;
Get notifications to value changes of a device by subscribing to it&lt;br /&gt;
&lt;br /&gt;
=== Further Context ===&lt;br /&gt;
&lt;br /&gt;
Make sure to read&lt;br /&gt;
&lt;br /&gt;
* Setting Up Ubertooth on macOS for Bluetooth Hacking [https://wiki.elvis.science/index.php?title=Setting_Up_Ubertooth_on_macOS_for_Bluetooth_Hacking]&lt;br /&gt;
&lt;br /&gt;
== Courses ==&lt;br /&gt;
&lt;br /&gt;
* [[Selected IT-Security Chapters]] (2024)&lt;br /&gt;
&lt;br /&gt;
== Author ==&lt;br /&gt;
Are Maksimović&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
* https://bleak.readthedocs.io/en/latest/usage.html&lt;br /&gt;
* https://www.bluetooth.com/de/bluetooth-resources/intro-to-bluetooth-gap-gatt/&lt;br /&gt;
[[Category:Documentation]]&lt;/div&gt;</summary>
		<author><name>AMaksimovic</name></author>
	</entry>
	<entry>
		<id>https://elvis.hcw.ac.at/wiki/index.php?title=B-LE_-_GATT_Architectural_Overview&amp;diff=16704</id>
		<title>B-LE - GATT Architectural Overview</title>
		<link rel="alternate" type="text/html" href="https://elvis.hcw.ac.at/wiki/index.php?title=B-LE_-_GATT_Architectural_Overview&amp;diff=16704"/>
		<updated>2024-12-05T15:06:04Z</updated>

		<summary type="html">&lt;p&gt;AMaksimovic: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== GATT - Architectural Overview == &lt;br /&gt;
&lt;br /&gt;
Description what this documentation is about.&lt;br /&gt;
&lt;br /&gt;
== Requirements ==&lt;br /&gt;
&lt;br /&gt;
* Operating system: Ubuntu 18.04 bionic amd64&lt;br /&gt;
* Packages: git emacs&lt;br /&gt;
&lt;br /&gt;
In order to complete these steps, you must have followed [[Some Other Documentation]] before.&lt;br /&gt;
&lt;br /&gt;
== Description ==&lt;br /&gt;
&lt;br /&gt;
=== GAP - Generic Attribute Profile ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The Generic attribute profile takes care of discovery, security, connectivity and network technolgies of a device. &lt;br /&gt;
&lt;br /&gt;
 ADV_IND&lt;br /&gt;
 SCAN_REQ&lt;br /&gt;
 SCAN_RSP&lt;br /&gt;
 CONNECT_IND&lt;br /&gt;
 AUX_SCAN_REQ&lt;br /&gt;
 AUX_SCAN_RSP&lt;br /&gt;
 AUX_CONNECT_REQ&lt;br /&gt;
 AUX_CONNECT_RSP&lt;br /&gt;
 ADV_SCAN_IND&lt;br /&gt;
&lt;br /&gt;
=== GATT - Generic Attribute Profile ===&lt;br /&gt;
&lt;br /&gt;
As soon as two Bluetooth Low Energy devices establish a connection they can start transfering data back and forth. This data is formated into Services and Characteristics in a Server/Client relationship.&lt;br /&gt;
&lt;br /&gt;
=== Network Topology ===&lt;br /&gt;
&lt;br /&gt;
The network topology of GATT networks contains so-called central devices and peripheral devices. One peripheral is only connected to only one central device at a time. A central device can connect to many peripheral devices. The peripheral is also acting as the GATT server. It contains the definitions for profiles, services and characteristics of a device. The central device always initiates the data exchange. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== ATT - Attribute Protocol ===&lt;br /&gt;
&lt;br /&gt;
GATT is based on ATT. Each attribute gets it’s own Unique Identifier (UUID) here. These get formatted as characteristics and services.&lt;br /&gt;
&lt;br /&gt;
=== Profiles ===&lt;br /&gt;
&lt;br /&gt;
set of services per Profile &lt;br /&gt;
Example profiles: Basic audio profile, Location and navigation profile, weight scale profile, heart rate profile&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Services ===&lt;br /&gt;
&lt;br /&gt;
A Service can have multiple characteristics. It has it’s own UUID. It has a handle. UUID, permissions, value&lt;br /&gt;
&lt;br /&gt;
=== Characteristics ===&lt;br /&gt;
&lt;br /&gt;
The characteristics are the lowest-level of the GATT Profiles. They also each use their own UUID.&lt;br /&gt;
These are relevant when it comes to protecting and enhancing security of a Bluetooth Low Energy device.&lt;br /&gt;
The characteristics have a value, properties and human-readable descriptors&lt;br /&gt;
&lt;br /&gt;
=== BLE Operations ===&lt;br /&gt;
&lt;br /&gt;
* Read&lt;br /&gt;
Read the data of a characteristic&lt;br /&gt;
&lt;br /&gt;
* Write&lt;br /&gt;
Write data to a characteristic&lt;br /&gt;
&lt;br /&gt;
* Notify&lt;br /&gt;
Get notifications to value changes of a device by subscribing to it&lt;br /&gt;
&lt;br /&gt;
=== Further Context ===&lt;br /&gt;
&lt;br /&gt;
Make sure to read&lt;br /&gt;
&lt;br /&gt;
* Setting Up Ubertooth on macOS for Bluetooth Hacking [https://wiki.elvis.science/index.php?title=Setting_Up_Ubertooth_on_macOS_for_Bluetooth_Hacking]&lt;br /&gt;
&lt;br /&gt;
== Courses ==&lt;br /&gt;
&lt;br /&gt;
* [[Selected IT-Security Chapters]] (2024)&lt;br /&gt;
&lt;br /&gt;
== Author ==&lt;br /&gt;
Are Maksimović&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
* https://bleak.readthedocs.io/en/latest/usage.html&lt;br /&gt;
* https://www.bluetooth.com/de/bluetooth-resources/intro-to-bluetooth-gap-gatt/&lt;br /&gt;
[[Category:Documentation]]&lt;/div&gt;</summary>
		<author><name>AMaksimovic</name></author>
	</entry>
	<entry>
		<id>https://elvis.hcw.ac.at/wiki/index.php?title=B-LE_-_GATT_Architectural_Overview&amp;diff=16703</id>
		<title>B-LE - GATT Architectural Overview</title>
		<link rel="alternate" type="text/html" href="https://elvis.hcw.ac.at/wiki/index.php?title=B-LE_-_GATT_Architectural_Overview&amp;diff=16703"/>
		<updated>2024-12-05T15:04:17Z</updated>

		<summary type="html">&lt;p&gt;AMaksimovic: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== GATT - Architectural Overview == &lt;br /&gt;
&lt;br /&gt;
Description what this documentation is about.&lt;br /&gt;
&lt;br /&gt;
== Requirements ==&lt;br /&gt;
&lt;br /&gt;
* Operating system: Ubuntu 18.04 bionic amd64&lt;br /&gt;
* Packages: git emacs&lt;br /&gt;
&lt;br /&gt;
In order to complete these steps, you must have followed [[Some Other Documentation]] before.&lt;br /&gt;
&lt;br /&gt;
== Description ==&lt;br /&gt;
&lt;br /&gt;
=== GAP - Generic Attribute Profile ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The Generic attribute profile takes care of discovery, security, connectivity and network technolgies of a device. &lt;br /&gt;
&lt;br /&gt;
 ADV_IND&lt;br /&gt;
 SCAN_REQ&lt;br /&gt;
 SCAN_RSP&lt;br /&gt;
 CONNECT_IND&lt;br /&gt;
 AUX_SCAN_REQ&lt;br /&gt;
 AUX_SCAN_RSP&lt;br /&gt;
 AUX_CONNECT_REQ&lt;br /&gt;
 AUX_CONNECT_RSP&lt;br /&gt;
 ADV_SCAN_IND&lt;br /&gt;
&lt;br /&gt;
=== GATT - Generic Attribute Profile ===&lt;br /&gt;
&lt;br /&gt;
As soon as two Bluetooth Low Energy devices establish a connection they can start transfering data back and forth. This data is formated into Services and Characteristics in a Server/Client relationship.&lt;br /&gt;
&lt;br /&gt;
=== Network Topology ===&lt;br /&gt;
&lt;br /&gt;
The network topology of GATT networks contains so-called central devices and peripheral devices. One peripheral is only connected to only one central device at a time. A central device can connect to many peripheral devices. The peripheral is also acting as the GATT server. It contains the definitions for profiles, services and characteristics of a device. The central device always initiates the data exchange. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== ATT - Attribute Protocol ===&lt;br /&gt;
&lt;br /&gt;
GATT is based on ATT. Each attribute gets it’s own Unique Identifier (UUID) here. These get formatted as characteristics and services.&lt;br /&gt;
&lt;br /&gt;
=== Profiles ===&lt;br /&gt;
&lt;br /&gt;
set of services per Profile &lt;br /&gt;
Example profiles: Basic audio profile, Location and navigation profile, weight scale profile, heart rate profile&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Services ===&lt;br /&gt;
&lt;br /&gt;
A Service can have multiple characteristics. It has it’s own UUID. It has a handle. UUID, permissions, value&lt;br /&gt;
&lt;br /&gt;
=== Characteristics ===&lt;br /&gt;
&lt;br /&gt;
The characteristics are the lowest-level of the GATT Profiles. They also each use their own UUID.&lt;br /&gt;
These are relevant when it comes to protecting and enhancing security of a Bluetooth Low Energy device.&lt;br /&gt;
The characteristics have a value, properties and human-readable descriptors&lt;br /&gt;
&lt;br /&gt;
=== BLE Operations ===&lt;br /&gt;
&lt;br /&gt;
* Read&lt;br /&gt;
Read the data of a characteristic&lt;br /&gt;
&lt;br /&gt;
* Write&lt;br /&gt;
Write data to a characteristic&lt;br /&gt;
&lt;br /&gt;
* Notify&lt;br /&gt;
Get notifications to value changes of a device by subscribing to it&lt;br /&gt;
&lt;br /&gt;
=== Further Context ===&lt;br /&gt;
&lt;br /&gt;
Make sure to read&lt;br /&gt;
&lt;br /&gt;
* War and Peace&lt;br /&gt;
* Lord of the Rings&lt;br /&gt;
* The Baroque Cycle&lt;br /&gt;
&lt;br /&gt;
== Used Hardware ==&lt;br /&gt;
&lt;br /&gt;
[[Device to be used with this documentation]]&lt;br /&gt;
[[Maybe another device to be used with this documentation]]&lt;br /&gt;
&lt;br /&gt;
== Courses ==&lt;br /&gt;
&lt;br /&gt;
* [[Selected IT-Security Chapters]] (2024)&lt;br /&gt;
&lt;br /&gt;
== Author ==&lt;br /&gt;
Are Maksimović&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
* https://bleak.readthedocs.io/en/latest/usage.html&lt;br /&gt;
* https://www.bluetooth.com/de/bluetooth-resources/intro-to-bluetooth-gap-gatt/&lt;br /&gt;
[[Category:Documentation]]&lt;/div&gt;</summary>
		<author><name>AMaksimovic</name></author>
	</entry>
	<entry>
		<id>https://elvis.hcw.ac.at/wiki/index.php?title=Setting_Up_Ubertooth_on_macOS_for_Bluetooth_Hacking&amp;diff=16689</id>
		<title>Setting Up Ubertooth on macOS for Bluetooth Hacking</title>
		<link rel="alternate" type="text/html" href="https://elvis.hcw.ac.at/wiki/index.php?title=Setting_Up_Ubertooth_on_macOS_for_Bluetooth_Hacking&amp;diff=16689"/>
		<updated>2024-12-05T01:06:42Z</updated>

		<summary type="html">&lt;p&gt;AMaksimovic: /* Used Hardware */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Summary == &lt;br /&gt;
&lt;br /&gt;
This is a step-by-step guide on how to sniff Bluetooth Low Energy (BLE) packets between a Polar Vantage Smartwatch and a phone using the Ubertooth One. It will go into detail on the setup on a MacBook Air with MacOS using a python environment for the libraries that are used for the setup. Additionally every step of the actual sniff will be outlined. This guide is based on the seminar paper &amp;quot;Smartwatch Hacking Attack&amp;quot; that was written within the FH-course &amp;quot;Selected IT-Security Chapters&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
== Requirements ==&lt;br /&gt;
&lt;br /&gt;
* Hardware tools: Ubertooth One: Firmware version: 2020-12-R1 (API:1.07)&lt;br /&gt;
* Unix-based Operating System: macOS (macOS Sequoia 15.1.1), on a MacBook Air with an Apple M1 chip.&lt;br /&gt;
* Virtual Environment: Python Environment: Python 3.12&lt;br /&gt;
* Packages: libusb, wget, cmake, pkg-config, setuptools, pyqt5, numpy&lt;br /&gt;
* Libraries: libbtbb, bleak&lt;br /&gt;
* Software Tools: Crackle&lt;br /&gt;
&lt;br /&gt;
For the setup this guide was used and adjusted to the given scenario. [[Ubertooth - Build Guide - https://ubertooth.readthedocs.io/en/latest/build_guide.html]].&lt;br /&gt;
&lt;br /&gt;
== Description ==&lt;br /&gt;
&lt;br /&gt;
=== Step 1 - Install homebrew ===&lt;br /&gt;
&lt;br /&gt;
Enter these commands in the shell&lt;br /&gt;
&lt;br /&gt;
 /bin/bash -c &amp;quot;$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)&amp;quot;&lt;br /&gt;
 eval &amp;quot;$(/opt/homebrew/bin/brew shellenv)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
=== Step 2 - Install Python Environment ===&lt;br /&gt;
&lt;br /&gt;
Enter these commands in the shell&lt;br /&gt;
&lt;br /&gt;
 python3.12 -m venv myenv&lt;br /&gt;
 source myenv/bin/activate&lt;br /&gt;
&lt;br /&gt;
=== Step 3 - Install libusb, wget, cmake, pkg-config ===&lt;br /&gt;
&lt;br /&gt;
Enter these commands in the shell&lt;br /&gt;
&lt;br /&gt;
 brew install libusb wget cmake pkg-config&lt;br /&gt;
&lt;br /&gt;
=== Step 4 - Install the Bluetooth baseband library ===&lt;br /&gt;
&lt;br /&gt;
Enter these commands in the shell&lt;br /&gt;
&lt;br /&gt;
 wget https://github.com/greatscottgadgets/libbtbb/archive/2020-12-R1.tar.gz -O libbtbb-2020-12-R1.tar.gz&lt;br /&gt;
 tar -xf libbtbb-2020-12-R1.tar.gz&lt;br /&gt;
 cd libbtbb-2020-12-R1&lt;br /&gt;
 mkdir build&lt;br /&gt;
 cd build&lt;br /&gt;
 cmake ..&lt;br /&gt;
 make&lt;br /&gt;
&lt;br /&gt;
If errors occur with installing distutils switch to setuptools instead.&lt;br /&gt;
&lt;br /&gt;
 pip install setuptools&lt;br /&gt;
&lt;br /&gt;
After installing the setuptools also change the &amp;quot;from distutils import setup&amp;quot; line in the the libbtbb-2020-12-R1/build/python/pcaptools/setup.py file to this:&lt;br /&gt;
&lt;br /&gt;
 from setuptools import setup&lt;br /&gt;
&lt;br /&gt;
Also update the version in that same file to this:&lt;br /&gt;
&lt;br /&gt;
 version = &#039;2020.12.R1&#039;&lt;br /&gt;
&lt;br /&gt;
If necessary set the pythonpath in case you have different python versions:&lt;br /&gt;
 &lt;br /&gt;
 export PYTHONPATH=/Users/&amp;lt;username&amp;gt;/myenv/lib/python3.12/site-packages:$PYTHONPATH&lt;br /&gt;
&lt;br /&gt;
Then retry:&lt;br /&gt;
&lt;br /&gt;
 make&lt;br /&gt;
&lt;br /&gt;
 sudo make install&lt;br /&gt;
&lt;br /&gt;
=== Step 5 - Install the Ubertooth repository ===&lt;br /&gt;
&lt;br /&gt;
For this part you can attach the Ubertooth One to the MacBook. BUT DO NOT USE WITHOUT ANTENNA! More information can be found here: https://ubertooth.readthedocs.io/en/latest/ubertooth_one.html&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Enter these commands in the shell&lt;br /&gt;
&lt;br /&gt;
 wget https://github.com/greatscottgadgets/ubertooth/releases/download/2020-12-R1/ubertooth-2020-12-R1.tar.xz&lt;br /&gt;
 tar -xf ubertooth-2020-12-R1.tar.xz&lt;br /&gt;
 cd ubertooth-2020-12-R1/host&lt;br /&gt;
 mkdir build&lt;br /&gt;
 cd build&lt;br /&gt;
 cmake ..&lt;br /&gt;
 make&lt;br /&gt;
&lt;br /&gt;
If libusb module not found errors occur go to ubertooth-2020-12-R1/host/CMakeLists.txt an add your libusb-path manually:&lt;br /&gt;
&lt;br /&gt;
 include_directories(/opt/homebrew/include)&lt;br /&gt;
 link_directories(/opt/homebrew/lib)&lt;br /&gt;
&lt;br /&gt;
Additionally again change the &amp;quot;from distutils import setup&amp;quot; line in the the ubertooth-2020-12-R1/host/build/python/specan_ui/setup.py file to this:&lt;br /&gt;
&lt;br /&gt;
 from setuptools import setup&lt;br /&gt;
&lt;br /&gt;
Also update the version in that same file to this:&lt;br /&gt;
&lt;br /&gt;
 version = &#039;2020.12.R1&#039;&lt;br /&gt;
&lt;br /&gt;
Then retry:&lt;br /&gt;
&lt;br /&gt;
 make&lt;br /&gt;
&lt;br /&gt;
 sudo make install&lt;br /&gt;
&lt;br /&gt;
If you get errors regarding the environment variables showing that your library wasnt found you need to set the library path via the MacOs&#039;s dynamic linker.&lt;br /&gt;
&lt;br /&gt;
 export DYLD_LIBRARY_PATH=&amp;quot;/usr/local/lib:$DYLD_LIBRARY_PATH&amp;quot;&lt;br /&gt;
&lt;br /&gt;
or make it persistent in shell configurations: &lt;br /&gt;
&lt;br /&gt;
 ~/.zshrc&lt;br /&gt;
&lt;br /&gt;
Afterwards confirm the ubertooth library is working correctly:&lt;br /&gt;
&lt;br /&gt;
 ubertooth-util&lt;br /&gt;
&lt;br /&gt;
=== Step 6 - Test Ubertooth One commands ===&lt;br /&gt;
&lt;br /&gt;
Test these commands:&lt;br /&gt;
&lt;br /&gt;
 ubertooth-util -H&lt;br /&gt;
 ubertooth-util -v&lt;br /&gt;
 ubertooth-util -p&lt;br /&gt;
 ubertooth-util -s&lt;br /&gt;
&lt;br /&gt;
Update Ubertooth firmware in ubertooth-2020-12-R1/ubertooth-one-firmware-bin:&lt;br /&gt;
&lt;br /&gt;
 sudo ubertooth-dfu -d bluetooth_rxtx.dfu -r&lt;br /&gt;
&lt;br /&gt;
In case the libubertooth library is not loading check if the paths are correct.&lt;br /&gt;
&lt;br /&gt;
In ubertooth-2020-12-R1/host the following command leads to getting a list of sniffed Bluetooth packets with their Lower Address Parts (LAP):&lt;br /&gt;
&lt;br /&gt;
 ubertooth-rx&lt;br /&gt;
&lt;br /&gt;
For collecting Upper Address Parts (UAP) from the captured packets add -z:&lt;br /&gt;
&lt;br /&gt;
 ubertooth-rx -z&lt;br /&gt;
&lt;br /&gt;
Let it run for a while and look at the output. It will be summarized as Survey Results at the end of the output. There you can see the significant part of Bluetooth addresses of devices that were scanned. &lt;br /&gt;
&lt;br /&gt;
=== Step 7 - Use BTLE to follow the connection of the Bluetooth device you found. (Replace with device Bluetooth Address) ===&lt;br /&gt;
&lt;br /&gt;
 ubertooth-btle -f B0:67:B5:CF:E5:10 -r test.pcap&lt;br /&gt;
&lt;br /&gt;
Or create a pipe for viewing the captures directly in Wireshark:&lt;br /&gt;
&lt;br /&gt;
 mkfifo /tmp/pipe&lt;br /&gt;
 ubertooth-btle -f B0:67:B5:CF:E5:10 -c /tmp/pipe&lt;br /&gt;
&lt;br /&gt;
Find packages that involve the Polar Smartwatch&lt;br /&gt;
&lt;br /&gt;
 systime=1728247529 freq=2402 addr=8e89bed6 delta_t=34.320 ms rssi=-60&lt;br /&gt;
 20 1b c9 28 84 1a 9e a0 02 01 06 03 02 ee fe 0d ff 6b 00 72 08 00 00 00 00 00 00 00 00 47 e9 1f &lt;br /&gt;
 Advertising / AA 8e89bed6 (valid)/ 27 bytes&lt;br /&gt;
     Channel Index: 37&lt;br /&gt;
     Type:  ADV_IND&lt;br /&gt;
     AdvA:  a0:9e:1a:84:28:c9 (public)&lt;br /&gt;
     AdvData: 02 01 06 03 02 ee fe 0d ff 6b 00 72 08 00 00 00 00 00 00 00 00&lt;br /&gt;
         Type 01 (Flags)&lt;br /&gt;
            00000110&lt;br /&gt;
                LE General Discoverable Mode&lt;br /&gt;
                BR/EDR Not Supported&lt;br /&gt;
         Type 02 (16-bit Service UUIDs, more available)&lt;br /&gt;
            feee&lt;br /&gt;
         Type ff (Manufacturer Specific Data)&lt;br /&gt;
            Company: Polar Electro OY&lt;br /&gt;
            Data: 72 08 00 00 00 00 00 00 00 00&lt;br /&gt;
     Data:  c9 28 84 1a 9e a0 02 01 06 03 02 ee fe 0d ff 6b 00 72 08 00 00 00 00 00 00 00 00&lt;br /&gt;
     CRC:   47 e9 1f&lt;br /&gt;
&lt;br /&gt;
=== Step 8 - Use Crackle to crack packages ===&lt;br /&gt;
&lt;br /&gt;
Enter these commands:&lt;br /&gt;
&lt;br /&gt;
 git clone https://github.com/mikeryan/crackle.git&lt;br /&gt;
 cd crackle&lt;br /&gt;
 make&lt;br /&gt;
&lt;br /&gt;
Now try cracking your pcap.file&lt;br /&gt;
&lt;br /&gt;
 ./crackle -i &amp;lt;your_file.pcap&amp;gt; -o &amp;lt;your_new_output_file.pcap&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this case it wasnt possible to crack any packages from the smartwatch.&lt;br /&gt;
&lt;br /&gt;
=== Step 9 - Install bleak library ===&lt;br /&gt;
&lt;br /&gt;
 pip install bleak&lt;br /&gt;
&lt;br /&gt;
More information can be found in the bleak library documentation. (https://bleak.readthedocs.io/en/latest/usage.html) It also includes sample scripts which were used in the following setup.&lt;br /&gt;
&lt;br /&gt;
=== Step 10 - Write python script for reading device UUID ===&lt;br /&gt;
&lt;br /&gt;
Enter these commands in the shell&lt;br /&gt;
&lt;br /&gt;
 mkdir BLE-scripts&lt;br /&gt;
 cd BLE-scripts&lt;br /&gt;
 nano ble_scan.py&lt;br /&gt;
&lt;br /&gt;
Write simple script to read device UUID using BleakScaner.discover() method:&lt;br /&gt;
 &lt;br /&gt;
 import asyncio&lt;br /&gt;
 from bleak import BleakScanner&lt;br /&gt;
 async def scan():&lt;br /&gt;
     devices = await BleakScanner.discover()&lt;br /&gt;
     for d in devices:&lt;br /&gt;
         print(d)&lt;br /&gt;
 asyncio.run(scan())&lt;br /&gt;
&lt;br /&gt;
Run a scan:&lt;br /&gt;
&lt;br /&gt;
 python3 BLE-scripts/ble_scan.py&lt;br /&gt;
&lt;br /&gt;
Here the device UUID of the Polar smartwatch was found:&lt;br /&gt;
&lt;br /&gt;
 C6C36C4A-7F8F-52B2-2BD7-C4F6690424E7: Polar Vantage M 8428C92D&lt;br /&gt;
&lt;br /&gt;
=== Step 11 - Check GATT services  ===&lt;br /&gt;
&lt;br /&gt;
With the gathered device UUID check for the devices services:&lt;br /&gt;
&lt;br /&gt;
 nano BLE-scripts/ble_services.py&lt;br /&gt;
&lt;br /&gt;
 import asyncio&lt;br /&gt;
 from bleak import BleakClient&lt;br /&gt;
 device_uuid = &amp;quot;C6C36C4A-7F8F-52B2-2BD7-C4F6690424E7&amp;quot;&lt;br /&gt;
 async def connect_to_device(device_uuid):&lt;br /&gt;
     async with BleakClient(device_uuid) as client:&lt;br /&gt;
         connected = client.is_connected&lt;br /&gt;
         print(f&amp;quot;Connected: {connected}&amp;quot;)&lt;br /&gt;
         services = client.services&lt;br /&gt;
         if services is None:&lt;br /&gt;
             await client.get_services()&lt;br /&gt;
         for service in services:&lt;br /&gt;
             print(f&amp;quot;Service: {service}&amp;quot;)&lt;br /&gt;
 loop = asyncio.get_event_loop()&lt;br /&gt;
 loop.run_until_complete(connect_to_device(device_uuid))&lt;br /&gt;
&lt;br /&gt;
Run a services scan:&lt;br /&gt;
&lt;br /&gt;
 python3 BLE-scripts/ble_services.py&lt;br /&gt;
&lt;br /&gt;
Now the service UUIDs that were found are going to be listed like this:&lt;br /&gt;
&lt;br /&gt;
 Service: 0000180a-0000-1000-8000-00805f9b34fb (Handle: 14): Device Information&lt;br /&gt;
 Service: 0000feee-0000-1000-8000-00805f9b34fb (Handle: 29): Polar Electro Oy&lt;br /&gt;
 Service: 0000180d-0000-1000-8000-00805f9b34fb (Handle: 38): Heart Rate&lt;br /&gt;
 Service: 0000180f-0000-1000-8000-00805f9b34fb (Handle: 42): Battery Service&lt;br /&gt;
&lt;br /&gt;
=== Step 12 - Get characteristics UUIDs  ===&lt;br /&gt;
&lt;br /&gt;
 nano BLE-scripts/ble_characteristics.py&lt;br /&gt;
&lt;br /&gt;
 import asyncio&lt;br /&gt;
 from bleak import BleakClient&lt;br /&gt;
 device_uuid = &amp;quot;C6C36C4A-7F8F-52B2-2BD7-C4F6690424E7&amp;quot;&lt;br /&gt;
 async def connect_to_device(device_uuid):&lt;br /&gt;
     async with BleakClient(device_uuid) as client:&lt;br /&gt;
         connected = client.is_connected&lt;br /&gt;
         print(f&amp;quot;Connected: {connected}&amp;quot;)&lt;br /&gt;
         services = client.services&lt;br /&gt;
         if services is None:&lt;br /&gt;
             await client.get_services()&lt;br /&gt;
         for service in services:&lt;br /&gt;
             print(f&amp;quot;Service: {service.uuid} (Handle: {service.handle}): {service.description}&amp;quot;)&lt;br /&gt;
             for characteristic in service.characteristics:&lt;br /&gt;
                 print(f&amp;quot;  Characteristic: {characteristic.uuid} (Handle: {characteristic.handle}) - Properties: {cha$&lt;br /&gt;
 loop = asyncio.get_event_loop()&lt;br /&gt;
 loop.run_until_complete(connect_to_device(device_uuid))&lt;br /&gt;
&lt;br /&gt;
Now run the script:&lt;br /&gt;
&lt;br /&gt;
 python3 BLE-scripts/ble_characteristics.py&lt;br /&gt;
&lt;br /&gt;
Expected output:&lt;br /&gt;
&lt;br /&gt;
 Service: 0000180a-0000-1000-8000-00805f9b34fb (Handle: 14): Device Information&lt;br /&gt;
  Characteristic: 00002a29-0000-1000-8000-00805f9b34fb (Handle: 15) - Properties: [&#039;read&#039;]&lt;br /&gt;
  Characteristic: 00002a24-0000-1000-8000-00805f9b34fb (Handle: 17) - Properties: [&#039;read&#039;]&lt;br /&gt;
  Characteristic: 00002a25-0000-1000-8000-00805f9b34fb (Handle: 19) - Properties: [&#039;read&#039;]&lt;br /&gt;
  Characteristic: 00002a27-0000-1000-8000-00805f9b34fb (Handle: 21) - Properties: [&#039;read&#039;]&lt;br /&gt;
  Characteristic: 00002a26-0000-1000-8000-00805f9b34fb (Handle: 23) - Properties: [&#039;read&#039;]&lt;br /&gt;
  Characteristic: 00002a28-0000-1000-8000-00805f9b34fb (Handle: 25) - Properties: [&#039;read&#039;]&lt;br /&gt;
  Characteristic: 00002a23-0000-1000-8000-00805f9b34fb (Handle: 27) - Properties: [&#039;read&#039;]&lt;br /&gt;
 Service: 0000feee-0000-1000-8000-00805f9b34fb (Handle: 29): Polar Electro Oy&lt;br /&gt;
  Characteristic: fb005c51-02e7-f387-1cad-8acd2d8df0c8 (Handle: 30) - Properties: [&#039;write-without-response&#039;, &#039;write&#039;, &#039;notify&#039;]&lt;br /&gt;
  Characteristic: fb005c52-02e7-f387-1cad-8acd2d8df0c8 (Handle: 33) - Properties: [&#039;notify&#039;]&lt;br /&gt;
  Characteristic: fb005c53-02e7-f387-1cad-8acd2d8df0c8 (Handle: 36) - Properties: [&#039;write-without-response&#039;, &#039;write&#039;]&lt;br /&gt;
 Service: 0000180d-0000-1000-8000-00805f9b34fb (Handle: 38): Heart Rate&lt;br /&gt;
  Characteristic: 00002a37-0000-1000-8000-00805f9b34fb (Handle: 39) - Properties: [&#039;notify&#039;]&lt;br /&gt;
 Service: 0000180f-0000-1000-8000-00805f9b34fb (Handle: 42): Battery Service&lt;br /&gt;
  Characteristic: 00002a19-0000-1000-8000-00805f9b34fb (Handle: 43) - Properties: [&#039;read&#039;, &#039;notify&#039;]&lt;br /&gt;
&lt;br /&gt;
=== Step 13 - Read data ===&lt;br /&gt;
&lt;br /&gt;
Now add a script for reading the actual data. Make sure to use the characteristics UUIDs you have found out.&lt;br /&gt;
&lt;br /&gt;
 nano BLE-scripts/ble_read.py&lt;br /&gt;
&lt;br /&gt;
 import asyncio&lt;br /&gt;
 from bleak import BleakClient&lt;br /&gt;
 device_uuid = &amp;quot;C6C36C4A-7F8F-52B2-2BD7-C4F6690424E7&amp;quot;&lt;br /&gt;
 HEART_RATE_CHAR_UUID = &amp;quot;00002a37-0000-1000-8000-00805f9b34fb&amp;quot;&lt;br /&gt;
 BATTERY_LEVEL_CHAR_UUID = &amp;quot;00002a19-0000-1000-8000-00805f9b34fb&amp;quot;&lt;br /&gt;
 async def connect_and_read_data(device_uuid):&lt;br /&gt;
     async with BleakClient(device_uuid) as client:&lt;br /&gt;
         connected = client.is_connected&lt;br /&gt;
         print(f&amp;quot;Connected: {connected}&amp;quot;)&lt;br /&gt;
         if connected:&lt;br /&gt;
             try:&lt;br /&gt;
                 heart_rate = await client.read_gatt_char(HEART_RATE_CHAR_UUID)&lt;br /&gt;
                 heart_rate = int(heart_rate_data[1])&lt;br /&gt;
                 print(f&amp;quot;Heart Rate: {heart_rate} bpm&amp;quot;)&lt;br /&gt;
             except Exception as e:&lt;br /&gt;
                 print(f&amp;quot;Failed to read heart rate: {e}&amp;quot;)&lt;br /&gt;
             try:&lt;br /&gt;
                 battery_level = await client.read_gatt_char(BATTERY_LEVEL_CHAR_UUID)&lt;br /&gt;
                 print(f&amp;quot;Battery Level: {int(battery_level[0])}%&amp;quot;)&lt;br /&gt;
             except Exception as e:&lt;br /&gt;
                 print(f&amp;quot;Failed to read battery level: {e}&amp;quot;)&lt;br /&gt;
 loop = asyncio.get_event_loop()&lt;br /&gt;
 loop.run_until_complete(connect_and_read_data(device_uuid))&lt;br /&gt;
&lt;br /&gt;
Run script:&lt;br /&gt;
&lt;br /&gt;
 python3 BLE-scripts/ble_read.py&lt;br /&gt;
&lt;br /&gt;
In the output the battery level was succesfully read and printed out. The heart rate couldn&#039;t be accessed because it only has the notify property and no option for reading:&lt;br /&gt;
&lt;br /&gt;
 Connected: True&lt;br /&gt;
 Failed to read heart rate: Failed to read characteristic 39: Error Domain=CBATTErrorDomain Code=2 &amp;quot;Reading is not permitted.&amp;quot; UserInfo={NSLocalizedDescription=Reading is not permitted.}&lt;br /&gt;
 Battery Level: 16%&lt;br /&gt;
&lt;br /&gt;
=== Step 14 - Subscribe to heart rate notifications ===&lt;br /&gt;
&lt;br /&gt;
 nano BLE-scripts/ble_subscribe.py&lt;br /&gt;
&lt;br /&gt;
 import asyncio&lt;br /&gt;
 from bleak import BleakClient&lt;br /&gt;
 device_uuid = &amp;quot;C6C36C4A-7F8F-52B2-2BD7-C4F6690424E7&amp;quot;&lt;br /&gt;
 HEART_RATE_CHAR_UUID = &amp;quot;00002a37-0000-1000-8000-00805f9b34fb&amp;quot;&lt;br /&gt;
 def heart_rate_handler(sender, data):&lt;br /&gt;
     heart_rate = int(data[1]) if len(data) &amp;gt; 1 else None&lt;br /&gt;
     print(f&amp;quot;Heart Rate from {sender}: {heart_rate} bpm&amp;quot;)&lt;br /&gt;
 async def connect_and_subscribe(device_uuid):&lt;br /&gt;
     async with BleakClient(device_uuid) as client:&lt;br /&gt;
         connected = client.is_connected&lt;br /&gt;
         print(f&amp;quot;Connected: {connected}&amp;quot;)&lt;br /&gt;
         if connected:&lt;br /&gt;
             try:&lt;br /&gt;
                 await client.start_notify(HEART_RATE_CHAR_UUID, heart_rate_handler)&lt;br /&gt;
                 print(&amp;quot;Subscribed to heart rate notifications.&amp;quot;)&lt;br /&gt;
                 await asyncio.sleep(60)&lt;br /&gt;
                 await client.stop_notify(HEART_RATE_CHAR_UUID)&lt;br /&gt;
                 print(&amp;quot;Stopped heart rate notifications.&amp;quot;)&lt;br /&gt;
             except Exception as e:&lt;br /&gt;
                 print(f&amp;quot;Failed to subscribe to heart rate notifications: {e}&amp;quot;)&lt;br /&gt;
 asyncio.run(connect_and_subscribe(device_uuid))&lt;br /&gt;
&lt;br /&gt;
 python3 BLE-scripts/ble_subscribe.py&lt;br /&gt;
&lt;br /&gt;
It was not possible to get the heart rate data even though the notify property was assigned. That is because typically battery status data is on a lower securiy level than heart rate data. More information on GATT can be found here: https://www.bluetooth.com/de/bluetooth-resources/intro-to-bluetooth-gap-gatt/&lt;br /&gt;
&lt;br /&gt;
This is the output of the failed try:&lt;br /&gt;
&lt;br /&gt;
 Connected: True&lt;br /&gt;
 Subscribed to heart rate notifications.&lt;br /&gt;
 Stopped heart rate notifications.&lt;br /&gt;
&lt;br /&gt;
== Used Hardware ==&lt;br /&gt;
&lt;br /&gt;
* [[Ubertooth One, 2.4 GHz wireless development platform]]&lt;br /&gt;
&lt;br /&gt;
* [[Polar Vantage M]]&lt;br /&gt;
&lt;br /&gt;
* [[Apple iPhone 13 mini]]&lt;br /&gt;
&lt;br /&gt;
* [[MacBook Air M1, 2020]]&lt;br /&gt;
&lt;br /&gt;
* [[Samsung Galaxy J3]]&lt;br /&gt;
&lt;br /&gt;
== Courses ==&lt;br /&gt;
&lt;br /&gt;
* [[Selected IT-Security Chapters]] (2024)&lt;br /&gt;
&lt;br /&gt;
== Author ==&lt;br /&gt;
&lt;br /&gt;
Are Maksimović&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
* https://ubertooth.readthedocs.io/en/latest/&lt;br /&gt;
* https://www.greatscottgadgets.com/ubertoothone/&lt;br /&gt;
* https://codemuch.net/posts/bluetooth-hacking/&lt;br /&gt;
* https://bleak.readthedocs.io/en/latest/usage.html&lt;br /&gt;
* https://www.bluetooth.com/de/bluetooth-resources/intro-to-bluetooth-gap-gatt/&lt;br /&gt;
* https://support.polar.com/en/vantage-m#all&lt;br /&gt;
&lt;br /&gt;
[[Category:Documentation]]&lt;/div&gt;</summary>
		<author><name>AMaksimovic</name></author>
	</entry>
	<entry>
		<id>https://elvis.hcw.ac.at/wiki/index.php?title=Setting_Up_Ubertooth_on_macOS_for_Bluetooth_Hacking&amp;diff=16688</id>
		<title>Setting Up Ubertooth on macOS for Bluetooth Hacking</title>
		<link rel="alternate" type="text/html" href="https://elvis.hcw.ac.at/wiki/index.php?title=Setting_Up_Ubertooth_on_macOS_for_Bluetooth_Hacking&amp;diff=16688"/>
		<updated>2024-12-05T01:06:27Z</updated>

		<summary type="html">&lt;p&gt;AMaksimovic: /* Used Hardware */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Summary == &lt;br /&gt;
&lt;br /&gt;
This is a step-by-step guide on how to sniff Bluetooth Low Energy (BLE) packets between a Polar Vantage Smartwatch and a phone using the Ubertooth One. It will go into detail on the setup on a MacBook Air with MacOS using a python environment for the libraries that are used for the setup. Additionally every step of the actual sniff will be outlined. This guide is based on the seminar paper &amp;quot;Smartwatch Hacking Attack&amp;quot; that was written within the FH-course &amp;quot;Selected IT-Security Chapters&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
== Requirements ==&lt;br /&gt;
&lt;br /&gt;
* Hardware tools: Ubertooth One: Firmware version: 2020-12-R1 (API:1.07)&lt;br /&gt;
* Unix-based Operating System: macOS (macOS Sequoia 15.1.1), on a MacBook Air with an Apple M1 chip.&lt;br /&gt;
* Virtual Environment: Python Environment: Python 3.12&lt;br /&gt;
* Packages: libusb, wget, cmake, pkg-config, setuptools, pyqt5, numpy&lt;br /&gt;
* Libraries: libbtbb, bleak&lt;br /&gt;
* Software Tools: Crackle&lt;br /&gt;
&lt;br /&gt;
For the setup this guide was used and adjusted to the given scenario. [[Ubertooth - Build Guide - https://ubertooth.readthedocs.io/en/latest/build_guide.html]].&lt;br /&gt;
&lt;br /&gt;
== Description ==&lt;br /&gt;
&lt;br /&gt;
=== Step 1 - Install homebrew ===&lt;br /&gt;
&lt;br /&gt;
Enter these commands in the shell&lt;br /&gt;
&lt;br /&gt;
 /bin/bash -c &amp;quot;$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)&amp;quot;&lt;br /&gt;
 eval &amp;quot;$(/opt/homebrew/bin/brew shellenv)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
=== Step 2 - Install Python Environment ===&lt;br /&gt;
&lt;br /&gt;
Enter these commands in the shell&lt;br /&gt;
&lt;br /&gt;
 python3.12 -m venv myenv&lt;br /&gt;
 source myenv/bin/activate&lt;br /&gt;
&lt;br /&gt;
=== Step 3 - Install libusb, wget, cmake, pkg-config ===&lt;br /&gt;
&lt;br /&gt;
Enter these commands in the shell&lt;br /&gt;
&lt;br /&gt;
 brew install libusb wget cmake pkg-config&lt;br /&gt;
&lt;br /&gt;
=== Step 4 - Install the Bluetooth baseband library ===&lt;br /&gt;
&lt;br /&gt;
Enter these commands in the shell&lt;br /&gt;
&lt;br /&gt;
 wget https://github.com/greatscottgadgets/libbtbb/archive/2020-12-R1.tar.gz -O libbtbb-2020-12-R1.tar.gz&lt;br /&gt;
 tar -xf libbtbb-2020-12-R1.tar.gz&lt;br /&gt;
 cd libbtbb-2020-12-R1&lt;br /&gt;
 mkdir build&lt;br /&gt;
 cd build&lt;br /&gt;
 cmake ..&lt;br /&gt;
 make&lt;br /&gt;
&lt;br /&gt;
If errors occur with installing distutils switch to setuptools instead.&lt;br /&gt;
&lt;br /&gt;
 pip install setuptools&lt;br /&gt;
&lt;br /&gt;
After installing the setuptools also change the &amp;quot;from distutils import setup&amp;quot; line in the the libbtbb-2020-12-R1/build/python/pcaptools/setup.py file to this:&lt;br /&gt;
&lt;br /&gt;
 from setuptools import setup&lt;br /&gt;
&lt;br /&gt;
Also update the version in that same file to this:&lt;br /&gt;
&lt;br /&gt;
 version = &#039;2020.12.R1&#039;&lt;br /&gt;
&lt;br /&gt;
If necessary set the pythonpath in case you have different python versions:&lt;br /&gt;
 &lt;br /&gt;
 export PYTHONPATH=/Users/&amp;lt;username&amp;gt;/myenv/lib/python3.12/site-packages:$PYTHONPATH&lt;br /&gt;
&lt;br /&gt;
Then retry:&lt;br /&gt;
&lt;br /&gt;
 make&lt;br /&gt;
&lt;br /&gt;
 sudo make install&lt;br /&gt;
&lt;br /&gt;
=== Step 5 - Install the Ubertooth repository ===&lt;br /&gt;
&lt;br /&gt;
For this part you can attach the Ubertooth One to the MacBook. BUT DO NOT USE WITHOUT ANTENNA! More information can be found here: https://ubertooth.readthedocs.io/en/latest/ubertooth_one.html&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Enter these commands in the shell&lt;br /&gt;
&lt;br /&gt;
 wget https://github.com/greatscottgadgets/ubertooth/releases/download/2020-12-R1/ubertooth-2020-12-R1.tar.xz&lt;br /&gt;
 tar -xf ubertooth-2020-12-R1.tar.xz&lt;br /&gt;
 cd ubertooth-2020-12-R1/host&lt;br /&gt;
 mkdir build&lt;br /&gt;
 cd build&lt;br /&gt;
 cmake ..&lt;br /&gt;
 make&lt;br /&gt;
&lt;br /&gt;
If libusb module not found errors occur go to ubertooth-2020-12-R1/host/CMakeLists.txt an add your libusb-path manually:&lt;br /&gt;
&lt;br /&gt;
 include_directories(/opt/homebrew/include)&lt;br /&gt;
 link_directories(/opt/homebrew/lib)&lt;br /&gt;
&lt;br /&gt;
Additionally again change the &amp;quot;from distutils import setup&amp;quot; line in the the ubertooth-2020-12-R1/host/build/python/specan_ui/setup.py file to this:&lt;br /&gt;
&lt;br /&gt;
 from setuptools import setup&lt;br /&gt;
&lt;br /&gt;
Also update the version in that same file to this:&lt;br /&gt;
&lt;br /&gt;
 version = &#039;2020.12.R1&#039;&lt;br /&gt;
&lt;br /&gt;
Then retry:&lt;br /&gt;
&lt;br /&gt;
 make&lt;br /&gt;
&lt;br /&gt;
 sudo make install&lt;br /&gt;
&lt;br /&gt;
If you get errors regarding the environment variables showing that your library wasnt found you need to set the library path via the MacOs&#039;s dynamic linker.&lt;br /&gt;
&lt;br /&gt;
 export DYLD_LIBRARY_PATH=&amp;quot;/usr/local/lib:$DYLD_LIBRARY_PATH&amp;quot;&lt;br /&gt;
&lt;br /&gt;
or make it persistent in shell configurations: &lt;br /&gt;
&lt;br /&gt;
 ~/.zshrc&lt;br /&gt;
&lt;br /&gt;
Afterwards confirm the ubertooth library is working correctly:&lt;br /&gt;
&lt;br /&gt;
 ubertooth-util&lt;br /&gt;
&lt;br /&gt;
=== Step 6 - Test Ubertooth One commands ===&lt;br /&gt;
&lt;br /&gt;
Test these commands:&lt;br /&gt;
&lt;br /&gt;
 ubertooth-util -H&lt;br /&gt;
 ubertooth-util -v&lt;br /&gt;
 ubertooth-util -p&lt;br /&gt;
 ubertooth-util -s&lt;br /&gt;
&lt;br /&gt;
Update Ubertooth firmware in ubertooth-2020-12-R1/ubertooth-one-firmware-bin:&lt;br /&gt;
&lt;br /&gt;
 sudo ubertooth-dfu -d bluetooth_rxtx.dfu -r&lt;br /&gt;
&lt;br /&gt;
In case the libubertooth library is not loading check if the paths are correct.&lt;br /&gt;
&lt;br /&gt;
In ubertooth-2020-12-R1/host the following command leads to getting a list of sniffed Bluetooth packets with their Lower Address Parts (LAP):&lt;br /&gt;
&lt;br /&gt;
 ubertooth-rx&lt;br /&gt;
&lt;br /&gt;
For collecting Upper Address Parts (UAP) from the captured packets add -z:&lt;br /&gt;
&lt;br /&gt;
 ubertooth-rx -z&lt;br /&gt;
&lt;br /&gt;
Let it run for a while and look at the output. It will be summarized as Survey Results at the end of the output. There you can see the significant part of Bluetooth addresses of devices that were scanned. &lt;br /&gt;
&lt;br /&gt;
=== Step 7 - Use BTLE to follow the connection of the Bluetooth device you found. (Replace with device Bluetooth Address) ===&lt;br /&gt;
&lt;br /&gt;
 ubertooth-btle -f B0:67:B5:CF:E5:10 -r test.pcap&lt;br /&gt;
&lt;br /&gt;
Or create a pipe for viewing the captures directly in Wireshark:&lt;br /&gt;
&lt;br /&gt;
 mkfifo /tmp/pipe&lt;br /&gt;
 ubertooth-btle -f B0:67:B5:CF:E5:10 -c /tmp/pipe&lt;br /&gt;
&lt;br /&gt;
Find packages that involve the Polar Smartwatch&lt;br /&gt;
&lt;br /&gt;
 systime=1728247529 freq=2402 addr=8e89bed6 delta_t=34.320 ms rssi=-60&lt;br /&gt;
 20 1b c9 28 84 1a 9e a0 02 01 06 03 02 ee fe 0d ff 6b 00 72 08 00 00 00 00 00 00 00 00 47 e9 1f &lt;br /&gt;
 Advertising / AA 8e89bed6 (valid)/ 27 bytes&lt;br /&gt;
     Channel Index: 37&lt;br /&gt;
     Type:  ADV_IND&lt;br /&gt;
     AdvA:  a0:9e:1a:84:28:c9 (public)&lt;br /&gt;
     AdvData: 02 01 06 03 02 ee fe 0d ff 6b 00 72 08 00 00 00 00 00 00 00 00&lt;br /&gt;
         Type 01 (Flags)&lt;br /&gt;
            00000110&lt;br /&gt;
                LE General Discoverable Mode&lt;br /&gt;
                BR/EDR Not Supported&lt;br /&gt;
         Type 02 (16-bit Service UUIDs, more available)&lt;br /&gt;
            feee&lt;br /&gt;
         Type ff (Manufacturer Specific Data)&lt;br /&gt;
            Company: Polar Electro OY&lt;br /&gt;
            Data: 72 08 00 00 00 00 00 00 00 00&lt;br /&gt;
     Data:  c9 28 84 1a 9e a0 02 01 06 03 02 ee fe 0d ff 6b 00 72 08 00 00 00 00 00 00 00 00&lt;br /&gt;
     CRC:   47 e9 1f&lt;br /&gt;
&lt;br /&gt;
=== Step 8 - Use Crackle to crack packages ===&lt;br /&gt;
&lt;br /&gt;
Enter these commands:&lt;br /&gt;
&lt;br /&gt;
 git clone https://github.com/mikeryan/crackle.git&lt;br /&gt;
 cd crackle&lt;br /&gt;
 make&lt;br /&gt;
&lt;br /&gt;
Now try cracking your pcap.file&lt;br /&gt;
&lt;br /&gt;
 ./crackle -i &amp;lt;your_file.pcap&amp;gt; -o &amp;lt;your_new_output_file.pcap&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this case it wasnt possible to crack any packages from the smartwatch.&lt;br /&gt;
&lt;br /&gt;
=== Step 9 - Install bleak library ===&lt;br /&gt;
&lt;br /&gt;
 pip install bleak&lt;br /&gt;
&lt;br /&gt;
More information can be found in the bleak library documentation. (https://bleak.readthedocs.io/en/latest/usage.html) It also includes sample scripts which were used in the following setup.&lt;br /&gt;
&lt;br /&gt;
=== Step 10 - Write python script for reading device UUID ===&lt;br /&gt;
&lt;br /&gt;
Enter these commands in the shell&lt;br /&gt;
&lt;br /&gt;
 mkdir BLE-scripts&lt;br /&gt;
 cd BLE-scripts&lt;br /&gt;
 nano ble_scan.py&lt;br /&gt;
&lt;br /&gt;
Write simple script to read device UUID using BleakScaner.discover() method:&lt;br /&gt;
 &lt;br /&gt;
 import asyncio&lt;br /&gt;
 from bleak import BleakScanner&lt;br /&gt;
 async def scan():&lt;br /&gt;
     devices = await BleakScanner.discover()&lt;br /&gt;
     for d in devices:&lt;br /&gt;
         print(d)&lt;br /&gt;
 asyncio.run(scan())&lt;br /&gt;
&lt;br /&gt;
Run a scan:&lt;br /&gt;
&lt;br /&gt;
 python3 BLE-scripts/ble_scan.py&lt;br /&gt;
&lt;br /&gt;
Here the device UUID of the Polar smartwatch was found:&lt;br /&gt;
&lt;br /&gt;
 C6C36C4A-7F8F-52B2-2BD7-C4F6690424E7: Polar Vantage M 8428C92D&lt;br /&gt;
&lt;br /&gt;
=== Step 11 - Check GATT services  ===&lt;br /&gt;
&lt;br /&gt;
With the gathered device UUID check for the devices services:&lt;br /&gt;
&lt;br /&gt;
 nano BLE-scripts/ble_services.py&lt;br /&gt;
&lt;br /&gt;
 import asyncio&lt;br /&gt;
 from bleak import BleakClient&lt;br /&gt;
 device_uuid = &amp;quot;C6C36C4A-7F8F-52B2-2BD7-C4F6690424E7&amp;quot;&lt;br /&gt;
 async def connect_to_device(device_uuid):&lt;br /&gt;
     async with BleakClient(device_uuid) as client:&lt;br /&gt;
         connected = client.is_connected&lt;br /&gt;
         print(f&amp;quot;Connected: {connected}&amp;quot;)&lt;br /&gt;
         services = client.services&lt;br /&gt;
         if services is None:&lt;br /&gt;
             await client.get_services()&lt;br /&gt;
         for service in services:&lt;br /&gt;
             print(f&amp;quot;Service: {service}&amp;quot;)&lt;br /&gt;
 loop = asyncio.get_event_loop()&lt;br /&gt;
 loop.run_until_complete(connect_to_device(device_uuid))&lt;br /&gt;
&lt;br /&gt;
Run a services scan:&lt;br /&gt;
&lt;br /&gt;
 python3 BLE-scripts/ble_services.py&lt;br /&gt;
&lt;br /&gt;
Now the service UUIDs that were found are going to be listed like this:&lt;br /&gt;
&lt;br /&gt;
 Service: 0000180a-0000-1000-8000-00805f9b34fb (Handle: 14): Device Information&lt;br /&gt;
 Service: 0000feee-0000-1000-8000-00805f9b34fb (Handle: 29): Polar Electro Oy&lt;br /&gt;
 Service: 0000180d-0000-1000-8000-00805f9b34fb (Handle: 38): Heart Rate&lt;br /&gt;
 Service: 0000180f-0000-1000-8000-00805f9b34fb (Handle: 42): Battery Service&lt;br /&gt;
&lt;br /&gt;
=== Step 12 - Get characteristics UUIDs  ===&lt;br /&gt;
&lt;br /&gt;
 nano BLE-scripts/ble_characteristics.py&lt;br /&gt;
&lt;br /&gt;
 import asyncio&lt;br /&gt;
 from bleak import BleakClient&lt;br /&gt;
 device_uuid = &amp;quot;C6C36C4A-7F8F-52B2-2BD7-C4F6690424E7&amp;quot;&lt;br /&gt;
 async def connect_to_device(device_uuid):&lt;br /&gt;
     async with BleakClient(device_uuid) as client:&lt;br /&gt;
         connected = client.is_connected&lt;br /&gt;
         print(f&amp;quot;Connected: {connected}&amp;quot;)&lt;br /&gt;
         services = client.services&lt;br /&gt;
         if services is None:&lt;br /&gt;
             await client.get_services()&lt;br /&gt;
         for service in services:&lt;br /&gt;
             print(f&amp;quot;Service: {service.uuid} (Handle: {service.handle}): {service.description}&amp;quot;)&lt;br /&gt;
             for characteristic in service.characteristics:&lt;br /&gt;
                 print(f&amp;quot;  Characteristic: {characteristic.uuid} (Handle: {characteristic.handle}) - Properties: {cha$&lt;br /&gt;
 loop = asyncio.get_event_loop()&lt;br /&gt;
 loop.run_until_complete(connect_to_device(device_uuid))&lt;br /&gt;
&lt;br /&gt;
Now run the script:&lt;br /&gt;
&lt;br /&gt;
 python3 BLE-scripts/ble_characteristics.py&lt;br /&gt;
&lt;br /&gt;
Expected output:&lt;br /&gt;
&lt;br /&gt;
 Service: 0000180a-0000-1000-8000-00805f9b34fb (Handle: 14): Device Information&lt;br /&gt;
  Characteristic: 00002a29-0000-1000-8000-00805f9b34fb (Handle: 15) - Properties: [&#039;read&#039;]&lt;br /&gt;
  Characteristic: 00002a24-0000-1000-8000-00805f9b34fb (Handle: 17) - Properties: [&#039;read&#039;]&lt;br /&gt;
  Characteristic: 00002a25-0000-1000-8000-00805f9b34fb (Handle: 19) - Properties: [&#039;read&#039;]&lt;br /&gt;
  Characteristic: 00002a27-0000-1000-8000-00805f9b34fb (Handle: 21) - Properties: [&#039;read&#039;]&lt;br /&gt;
  Characteristic: 00002a26-0000-1000-8000-00805f9b34fb (Handle: 23) - Properties: [&#039;read&#039;]&lt;br /&gt;
  Characteristic: 00002a28-0000-1000-8000-00805f9b34fb (Handle: 25) - Properties: [&#039;read&#039;]&lt;br /&gt;
  Characteristic: 00002a23-0000-1000-8000-00805f9b34fb (Handle: 27) - Properties: [&#039;read&#039;]&lt;br /&gt;
 Service: 0000feee-0000-1000-8000-00805f9b34fb (Handle: 29): Polar Electro Oy&lt;br /&gt;
  Characteristic: fb005c51-02e7-f387-1cad-8acd2d8df0c8 (Handle: 30) - Properties: [&#039;write-without-response&#039;, &#039;write&#039;, &#039;notify&#039;]&lt;br /&gt;
  Characteristic: fb005c52-02e7-f387-1cad-8acd2d8df0c8 (Handle: 33) - Properties: [&#039;notify&#039;]&lt;br /&gt;
  Characteristic: fb005c53-02e7-f387-1cad-8acd2d8df0c8 (Handle: 36) - Properties: [&#039;write-without-response&#039;, &#039;write&#039;]&lt;br /&gt;
 Service: 0000180d-0000-1000-8000-00805f9b34fb (Handle: 38): Heart Rate&lt;br /&gt;
  Characteristic: 00002a37-0000-1000-8000-00805f9b34fb (Handle: 39) - Properties: [&#039;notify&#039;]&lt;br /&gt;
 Service: 0000180f-0000-1000-8000-00805f9b34fb (Handle: 42): Battery Service&lt;br /&gt;
  Characteristic: 00002a19-0000-1000-8000-00805f9b34fb (Handle: 43) - Properties: [&#039;read&#039;, &#039;notify&#039;]&lt;br /&gt;
&lt;br /&gt;
=== Step 13 - Read data ===&lt;br /&gt;
&lt;br /&gt;
Now add a script for reading the actual data. Make sure to use the characteristics UUIDs you have found out.&lt;br /&gt;
&lt;br /&gt;
 nano BLE-scripts/ble_read.py&lt;br /&gt;
&lt;br /&gt;
 import asyncio&lt;br /&gt;
 from bleak import BleakClient&lt;br /&gt;
 device_uuid = &amp;quot;C6C36C4A-7F8F-52B2-2BD7-C4F6690424E7&amp;quot;&lt;br /&gt;
 HEART_RATE_CHAR_UUID = &amp;quot;00002a37-0000-1000-8000-00805f9b34fb&amp;quot;&lt;br /&gt;
 BATTERY_LEVEL_CHAR_UUID = &amp;quot;00002a19-0000-1000-8000-00805f9b34fb&amp;quot;&lt;br /&gt;
 async def connect_and_read_data(device_uuid):&lt;br /&gt;
     async with BleakClient(device_uuid) as client:&lt;br /&gt;
         connected = client.is_connected&lt;br /&gt;
         print(f&amp;quot;Connected: {connected}&amp;quot;)&lt;br /&gt;
         if connected:&lt;br /&gt;
             try:&lt;br /&gt;
                 heart_rate = await client.read_gatt_char(HEART_RATE_CHAR_UUID)&lt;br /&gt;
                 heart_rate = int(heart_rate_data[1])&lt;br /&gt;
                 print(f&amp;quot;Heart Rate: {heart_rate} bpm&amp;quot;)&lt;br /&gt;
             except Exception as e:&lt;br /&gt;
                 print(f&amp;quot;Failed to read heart rate: {e}&amp;quot;)&lt;br /&gt;
             try:&lt;br /&gt;
                 battery_level = await client.read_gatt_char(BATTERY_LEVEL_CHAR_UUID)&lt;br /&gt;
                 print(f&amp;quot;Battery Level: {int(battery_level[0])}%&amp;quot;)&lt;br /&gt;
             except Exception as e:&lt;br /&gt;
                 print(f&amp;quot;Failed to read battery level: {e}&amp;quot;)&lt;br /&gt;
 loop = asyncio.get_event_loop()&lt;br /&gt;
 loop.run_until_complete(connect_and_read_data(device_uuid))&lt;br /&gt;
&lt;br /&gt;
Run script:&lt;br /&gt;
&lt;br /&gt;
 python3 BLE-scripts/ble_read.py&lt;br /&gt;
&lt;br /&gt;
In the output the battery level was succesfully read and printed out. The heart rate couldn&#039;t be accessed because it only has the notify property and no option for reading:&lt;br /&gt;
&lt;br /&gt;
 Connected: True&lt;br /&gt;
 Failed to read heart rate: Failed to read characteristic 39: Error Domain=CBATTErrorDomain Code=2 &amp;quot;Reading is not permitted.&amp;quot; UserInfo={NSLocalizedDescription=Reading is not permitted.}&lt;br /&gt;
 Battery Level: 16%&lt;br /&gt;
&lt;br /&gt;
=== Step 14 - Subscribe to heart rate notifications ===&lt;br /&gt;
&lt;br /&gt;
 nano BLE-scripts/ble_subscribe.py&lt;br /&gt;
&lt;br /&gt;
 import asyncio&lt;br /&gt;
 from bleak import BleakClient&lt;br /&gt;
 device_uuid = &amp;quot;C6C36C4A-7F8F-52B2-2BD7-C4F6690424E7&amp;quot;&lt;br /&gt;
 HEART_RATE_CHAR_UUID = &amp;quot;00002a37-0000-1000-8000-00805f9b34fb&amp;quot;&lt;br /&gt;
 def heart_rate_handler(sender, data):&lt;br /&gt;
     heart_rate = int(data[1]) if len(data) &amp;gt; 1 else None&lt;br /&gt;
     print(f&amp;quot;Heart Rate from {sender}: {heart_rate} bpm&amp;quot;)&lt;br /&gt;
 async def connect_and_subscribe(device_uuid):&lt;br /&gt;
     async with BleakClient(device_uuid) as client:&lt;br /&gt;
         connected = client.is_connected&lt;br /&gt;
         print(f&amp;quot;Connected: {connected}&amp;quot;)&lt;br /&gt;
         if connected:&lt;br /&gt;
             try:&lt;br /&gt;
                 await client.start_notify(HEART_RATE_CHAR_UUID, heart_rate_handler)&lt;br /&gt;
                 print(&amp;quot;Subscribed to heart rate notifications.&amp;quot;)&lt;br /&gt;
                 await asyncio.sleep(60)&lt;br /&gt;
                 await client.stop_notify(HEART_RATE_CHAR_UUID)&lt;br /&gt;
                 print(&amp;quot;Stopped heart rate notifications.&amp;quot;)&lt;br /&gt;
             except Exception as e:&lt;br /&gt;
                 print(f&amp;quot;Failed to subscribe to heart rate notifications: {e}&amp;quot;)&lt;br /&gt;
 asyncio.run(connect_and_subscribe(device_uuid))&lt;br /&gt;
&lt;br /&gt;
 python3 BLE-scripts/ble_subscribe.py&lt;br /&gt;
&lt;br /&gt;
It was not possible to get the heart rate data even though the notify property was assigned. That is because typically battery status data is on a lower securiy level than heart rate data. More information on GATT can be found here: https://www.bluetooth.com/de/bluetooth-resources/intro-to-bluetooth-gap-gatt/&lt;br /&gt;
&lt;br /&gt;
This is the output of the failed try:&lt;br /&gt;
&lt;br /&gt;
 Connected: True&lt;br /&gt;
 Subscribed to heart rate notifications.&lt;br /&gt;
 Stopped heart rate notifications.&lt;br /&gt;
&lt;br /&gt;
== Used Hardware ==&lt;br /&gt;
&lt;br /&gt;
* [[Ubertooth One, 2.4 GHz wireless development platform]]&lt;br /&gt;
&lt;br /&gt;
* [[Polar Vantage M]]&lt;br /&gt;
&lt;br /&gt;
[[Apple iPhone 13 mini]]&lt;br /&gt;
&lt;br /&gt;
[[MacBook Air M1, 2020]]&lt;br /&gt;
&lt;br /&gt;
[[Samsung Galaxy J3]]&lt;br /&gt;
&lt;br /&gt;
== Courses ==&lt;br /&gt;
&lt;br /&gt;
* [[Selected IT-Security Chapters]] (2024)&lt;br /&gt;
&lt;br /&gt;
== Author ==&lt;br /&gt;
&lt;br /&gt;
Are Maksimović&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
* https://ubertooth.readthedocs.io/en/latest/&lt;br /&gt;
* https://www.greatscottgadgets.com/ubertoothone/&lt;br /&gt;
* https://codemuch.net/posts/bluetooth-hacking/&lt;br /&gt;
* https://bleak.readthedocs.io/en/latest/usage.html&lt;br /&gt;
* https://www.bluetooth.com/de/bluetooth-resources/intro-to-bluetooth-gap-gatt/&lt;br /&gt;
* https://support.polar.com/en/vantage-m#all&lt;br /&gt;
&lt;br /&gt;
[[Category:Documentation]]&lt;/div&gt;</summary>
		<author><name>AMaksimovic</name></author>
	</entry>
	<entry>
		<id>https://elvis.hcw.ac.at/wiki/index.php?title=Setting_Up_Ubertooth_on_macOS_for_Bluetooth_Hacking&amp;diff=16687</id>
		<title>Setting Up Ubertooth on macOS for Bluetooth Hacking</title>
		<link rel="alternate" type="text/html" href="https://elvis.hcw.ac.at/wiki/index.php?title=Setting_Up_Ubertooth_on_macOS_for_Bluetooth_Hacking&amp;diff=16687"/>
		<updated>2024-12-05T01:05:47Z</updated>

		<summary type="html">&lt;p&gt;AMaksimovic: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Summary == &lt;br /&gt;
&lt;br /&gt;
This is a step-by-step guide on how to sniff Bluetooth Low Energy (BLE) packets between a Polar Vantage Smartwatch and a phone using the Ubertooth One. It will go into detail on the setup on a MacBook Air with MacOS using a python environment for the libraries that are used for the setup. Additionally every step of the actual sniff will be outlined. This guide is based on the seminar paper &amp;quot;Smartwatch Hacking Attack&amp;quot; that was written within the FH-course &amp;quot;Selected IT-Security Chapters&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
== Requirements ==&lt;br /&gt;
&lt;br /&gt;
* Hardware tools: Ubertooth One: Firmware version: 2020-12-R1 (API:1.07)&lt;br /&gt;
* Unix-based Operating System: macOS (macOS Sequoia 15.1.1), on a MacBook Air with an Apple M1 chip.&lt;br /&gt;
* Virtual Environment: Python Environment: Python 3.12&lt;br /&gt;
* Packages: libusb, wget, cmake, pkg-config, setuptools, pyqt5, numpy&lt;br /&gt;
* Libraries: libbtbb, bleak&lt;br /&gt;
* Software Tools: Crackle&lt;br /&gt;
&lt;br /&gt;
For the setup this guide was used and adjusted to the given scenario. [[Ubertooth - Build Guide - https://ubertooth.readthedocs.io/en/latest/build_guide.html]].&lt;br /&gt;
&lt;br /&gt;
== Description ==&lt;br /&gt;
&lt;br /&gt;
=== Step 1 - Install homebrew ===&lt;br /&gt;
&lt;br /&gt;
Enter these commands in the shell&lt;br /&gt;
&lt;br /&gt;
 /bin/bash -c &amp;quot;$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)&amp;quot;&lt;br /&gt;
 eval &amp;quot;$(/opt/homebrew/bin/brew shellenv)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
=== Step 2 - Install Python Environment ===&lt;br /&gt;
&lt;br /&gt;
Enter these commands in the shell&lt;br /&gt;
&lt;br /&gt;
 python3.12 -m venv myenv&lt;br /&gt;
 source myenv/bin/activate&lt;br /&gt;
&lt;br /&gt;
=== Step 3 - Install libusb, wget, cmake, pkg-config ===&lt;br /&gt;
&lt;br /&gt;
Enter these commands in the shell&lt;br /&gt;
&lt;br /&gt;
 brew install libusb wget cmake pkg-config&lt;br /&gt;
&lt;br /&gt;
=== Step 4 - Install the Bluetooth baseband library ===&lt;br /&gt;
&lt;br /&gt;
Enter these commands in the shell&lt;br /&gt;
&lt;br /&gt;
 wget https://github.com/greatscottgadgets/libbtbb/archive/2020-12-R1.tar.gz -O libbtbb-2020-12-R1.tar.gz&lt;br /&gt;
 tar -xf libbtbb-2020-12-R1.tar.gz&lt;br /&gt;
 cd libbtbb-2020-12-R1&lt;br /&gt;
 mkdir build&lt;br /&gt;
 cd build&lt;br /&gt;
 cmake ..&lt;br /&gt;
 make&lt;br /&gt;
&lt;br /&gt;
If errors occur with installing distutils switch to setuptools instead.&lt;br /&gt;
&lt;br /&gt;
 pip install setuptools&lt;br /&gt;
&lt;br /&gt;
After installing the setuptools also change the &amp;quot;from distutils import setup&amp;quot; line in the the libbtbb-2020-12-R1/build/python/pcaptools/setup.py file to this:&lt;br /&gt;
&lt;br /&gt;
 from setuptools import setup&lt;br /&gt;
&lt;br /&gt;
Also update the version in that same file to this:&lt;br /&gt;
&lt;br /&gt;
 version = &#039;2020.12.R1&#039;&lt;br /&gt;
&lt;br /&gt;
If necessary set the pythonpath in case you have different python versions:&lt;br /&gt;
 &lt;br /&gt;
 export PYTHONPATH=/Users/&amp;lt;username&amp;gt;/myenv/lib/python3.12/site-packages:$PYTHONPATH&lt;br /&gt;
&lt;br /&gt;
Then retry:&lt;br /&gt;
&lt;br /&gt;
 make&lt;br /&gt;
&lt;br /&gt;
 sudo make install&lt;br /&gt;
&lt;br /&gt;
=== Step 5 - Install the Ubertooth repository ===&lt;br /&gt;
&lt;br /&gt;
For this part you can attach the Ubertooth One to the MacBook. BUT DO NOT USE WITHOUT ANTENNA! More information can be found here: https://ubertooth.readthedocs.io/en/latest/ubertooth_one.html&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Enter these commands in the shell&lt;br /&gt;
&lt;br /&gt;
 wget https://github.com/greatscottgadgets/ubertooth/releases/download/2020-12-R1/ubertooth-2020-12-R1.tar.xz&lt;br /&gt;
 tar -xf ubertooth-2020-12-R1.tar.xz&lt;br /&gt;
 cd ubertooth-2020-12-R1/host&lt;br /&gt;
 mkdir build&lt;br /&gt;
 cd build&lt;br /&gt;
 cmake ..&lt;br /&gt;
 make&lt;br /&gt;
&lt;br /&gt;
If libusb module not found errors occur go to ubertooth-2020-12-R1/host/CMakeLists.txt an add your libusb-path manually:&lt;br /&gt;
&lt;br /&gt;
 include_directories(/opt/homebrew/include)&lt;br /&gt;
 link_directories(/opt/homebrew/lib)&lt;br /&gt;
&lt;br /&gt;
Additionally again change the &amp;quot;from distutils import setup&amp;quot; line in the the ubertooth-2020-12-R1/host/build/python/specan_ui/setup.py file to this:&lt;br /&gt;
&lt;br /&gt;
 from setuptools import setup&lt;br /&gt;
&lt;br /&gt;
Also update the version in that same file to this:&lt;br /&gt;
&lt;br /&gt;
 version = &#039;2020.12.R1&#039;&lt;br /&gt;
&lt;br /&gt;
Then retry:&lt;br /&gt;
&lt;br /&gt;
 make&lt;br /&gt;
&lt;br /&gt;
 sudo make install&lt;br /&gt;
&lt;br /&gt;
If you get errors regarding the environment variables showing that your library wasnt found you need to set the library path via the MacOs&#039;s dynamic linker.&lt;br /&gt;
&lt;br /&gt;
 export DYLD_LIBRARY_PATH=&amp;quot;/usr/local/lib:$DYLD_LIBRARY_PATH&amp;quot;&lt;br /&gt;
&lt;br /&gt;
or make it persistent in shell configurations: &lt;br /&gt;
&lt;br /&gt;
 ~/.zshrc&lt;br /&gt;
&lt;br /&gt;
Afterwards confirm the ubertooth library is working correctly:&lt;br /&gt;
&lt;br /&gt;
 ubertooth-util&lt;br /&gt;
&lt;br /&gt;
=== Step 6 - Test Ubertooth One commands ===&lt;br /&gt;
&lt;br /&gt;
Test these commands:&lt;br /&gt;
&lt;br /&gt;
 ubertooth-util -H&lt;br /&gt;
 ubertooth-util -v&lt;br /&gt;
 ubertooth-util -p&lt;br /&gt;
 ubertooth-util -s&lt;br /&gt;
&lt;br /&gt;
Update Ubertooth firmware in ubertooth-2020-12-R1/ubertooth-one-firmware-bin:&lt;br /&gt;
&lt;br /&gt;
 sudo ubertooth-dfu -d bluetooth_rxtx.dfu -r&lt;br /&gt;
&lt;br /&gt;
In case the libubertooth library is not loading check if the paths are correct.&lt;br /&gt;
&lt;br /&gt;
In ubertooth-2020-12-R1/host the following command leads to getting a list of sniffed Bluetooth packets with their Lower Address Parts (LAP):&lt;br /&gt;
&lt;br /&gt;
 ubertooth-rx&lt;br /&gt;
&lt;br /&gt;
For collecting Upper Address Parts (UAP) from the captured packets add -z:&lt;br /&gt;
&lt;br /&gt;
 ubertooth-rx -z&lt;br /&gt;
&lt;br /&gt;
Let it run for a while and look at the output. It will be summarized as Survey Results at the end of the output. There you can see the significant part of Bluetooth addresses of devices that were scanned. &lt;br /&gt;
&lt;br /&gt;
=== Step 7 - Use BTLE to follow the connection of the Bluetooth device you found. (Replace with device Bluetooth Address) ===&lt;br /&gt;
&lt;br /&gt;
 ubertooth-btle -f B0:67:B5:CF:E5:10 -r test.pcap&lt;br /&gt;
&lt;br /&gt;
Or create a pipe for viewing the captures directly in Wireshark:&lt;br /&gt;
&lt;br /&gt;
 mkfifo /tmp/pipe&lt;br /&gt;
 ubertooth-btle -f B0:67:B5:CF:E5:10 -c /tmp/pipe&lt;br /&gt;
&lt;br /&gt;
Find packages that involve the Polar Smartwatch&lt;br /&gt;
&lt;br /&gt;
 systime=1728247529 freq=2402 addr=8e89bed6 delta_t=34.320 ms rssi=-60&lt;br /&gt;
 20 1b c9 28 84 1a 9e a0 02 01 06 03 02 ee fe 0d ff 6b 00 72 08 00 00 00 00 00 00 00 00 47 e9 1f &lt;br /&gt;
 Advertising / AA 8e89bed6 (valid)/ 27 bytes&lt;br /&gt;
     Channel Index: 37&lt;br /&gt;
     Type:  ADV_IND&lt;br /&gt;
     AdvA:  a0:9e:1a:84:28:c9 (public)&lt;br /&gt;
     AdvData: 02 01 06 03 02 ee fe 0d ff 6b 00 72 08 00 00 00 00 00 00 00 00&lt;br /&gt;
         Type 01 (Flags)&lt;br /&gt;
            00000110&lt;br /&gt;
                LE General Discoverable Mode&lt;br /&gt;
                BR/EDR Not Supported&lt;br /&gt;
         Type 02 (16-bit Service UUIDs, more available)&lt;br /&gt;
            feee&lt;br /&gt;
         Type ff (Manufacturer Specific Data)&lt;br /&gt;
            Company: Polar Electro OY&lt;br /&gt;
            Data: 72 08 00 00 00 00 00 00 00 00&lt;br /&gt;
     Data:  c9 28 84 1a 9e a0 02 01 06 03 02 ee fe 0d ff 6b 00 72 08 00 00 00 00 00 00 00 00&lt;br /&gt;
     CRC:   47 e9 1f&lt;br /&gt;
&lt;br /&gt;
=== Step 8 - Use Crackle to crack packages ===&lt;br /&gt;
&lt;br /&gt;
Enter these commands:&lt;br /&gt;
&lt;br /&gt;
 git clone https://github.com/mikeryan/crackle.git&lt;br /&gt;
 cd crackle&lt;br /&gt;
 make&lt;br /&gt;
&lt;br /&gt;
Now try cracking your pcap.file&lt;br /&gt;
&lt;br /&gt;
 ./crackle -i &amp;lt;your_file.pcap&amp;gt; -o &amp;lt;your_new_output_file.pcap&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this case it wasnt possible to crack any packages from the smartwatch.&lt;br /&gt;
&lt;br /&gt;
=== Step 9 - Install bleak library ===&lt;br /&gt;
&lt;br /&gt;
 pip install bleak&lt;br /&gt;
&lt;br /&gt;
More information can be found in the bleak library documentation. (https://bleak.readthedocs.io/en/latest/usage.html) It also includes sample scripts which were used in the following setup.&lt;br /&gt;
&lt;br /&gt;
=== Step 10 - Write python script for reading device UUID ===&lt;br /&gt;
&lt;br /&gt;
Enter these commands in the shell&lt;br /&gt;
&lt;br /&gt;
 mkdir BLE-scripts&lt;br /&gt;
 cd BLE-scripts&lt;br /&gt;
 nano ble_scan.py&lt;br /&gt;
&lt;br /&gt;
Write simple script to read device UUID using BleakScaner.discover() method:&lt;br /&gt;
 &lt;br /&gt;
 import asyncio&lt;br /&gt;
 from bleak import BleakScanner&lt;br /&gt;
 async def scan():&lt;br /&gt;
     devices = await BleakScanner.discover()&lt;br /&gt;
     for d in devices:&lt;br /&gt;
         print(d)&lt;br /&gt;
 asyncio.run(scan())&lt;br /&gt;
&lt;br /&gt;
Run a scan:&lt;br /&gt;
&lt;br /&gt;
 python3 BLE-scripts/ble_scan.py&lt;br /&gt;
&lt;br /&gt;
Here the device UUID of the Polar smartwatch was found:&lt;br /&gt;
&lt;br /&gt;
 C6C36C4A-7F8F-52B2-2BD7-C4F6690424E7: Polar Vantage M 8428C92D&lt;br /&gt;
&lt;br /&gt;
=== Step 11 - Check GATT services  ===&lt;br /&gt;
&lt;br /&gt;
With the gathered device UUID check for the devices services:&lt;br /&gt;
&lt;br /&gt;
 nano BLE-scripts/ble_services.py&lt;br /&gt;
&lt;br /&gt;
 import asyncio&lt;br /&gt;
 from bleak import BleakClient&lt;br /&gt;
 device_uuid = &amp;quot;C6C36C4A-7F8F-52B2-2BD7-C4F6690424E7&amp;quot;&lt;br /&gt;
 async def connect_to_device(device_uuid):&lt;br /&gt;
     async with BleakClient(device_uuid) as client:&lt;br /&gt;
         connected = client.is_connected&lt;br /&gt;
         print(f&amp;quot;Connected: {connected}&amp;quot;)&lt;br /&gt;
         services = client.services&lt;br /&gt;
         if services is None:&lt;br /&gt;
             await client.get_services()&lt;br /&gt;
         for service in services:&lt;br /&gt;
             print(f&amp;quot;Service: {service}&amp;quot;)&lt;br /&gt;
 loop = asyncio.get_event_loop()&lt;br /&gt;
 loop.run_until_complete(connect_to_device(device_uuid))&lt;br /&gt;
&lt;br /&gt;
Run a services scan:&lt;br /&gt;
&lt;br /&gt;
 python3 BLE-scripts/ble_services.py&lt;br /&gt;
&lt;br /&gt;
Now the service UUIDs that were found are going to be listed like this:&lt;br /&gt;
&lt;br /&gt;
 Service: 0000180a-0000-1000-8000-00805f9b34fb (Handle: 14): Device Information&lt;br /&gt;
 Service: 0000feee-0000-1000-8000-00805f9b34fb (Handle: 29): Polar Electro Oy&lt;br /&gt;
 Service: 0000180d-0000-1000-8000-00805f9b34fb (Handle: 38): Heart Rate&lt;br /&gt;
 Service: 0000180f-0000-1000-8000-00805f9b34fb (Handle: 42): Battery Service&lt;br /&gt;
&lt;br /&gt;
=== Step 12 - Get characteristics UUIDs  ===&lt;br /&gt;
&lt;br /&gt;
 nano BLE-scripts/ble_characteristics.py&lt;br /&gt;
&lt;br /&gt;
 import asyncio&lt;br /&gt;
 from bleak import BleakClient&lt;br /&gt;
 device_uuid = &amp;quot;C6C36C4A-7F8F-52B2-2BD7-C4F6690424E7&amp;quot;&lt;br /&gt;
 async def connect_to_device(device_uuid):&lt;br /&gt;
     async with BleakClient(device_uuid) as client:&lt;br /&gt;
         connected = client.is_connected&lt;br /&gt;
         print(f&amp;quot;Connected: {connected}&amp;quot;)&lt;br /&gt;
         services = client.services&lt;br /&gt;
         if services is None:&lt;br /&gt;
             await client.get_services()&lt;br /&gt;
         for service in services:&lt;br /&gt;
             print(f&amp;quot;Service: {service.uuid} (Handle: {service.handle}): {service.description}&amp;quot;)&lt;br /&gt;
             for characteristic in service.characteristics:&lt;br /&gt;
                 print(f&amp;quot;  Characteristic: {characteristic.uuid} (Handle: {characteristic.handle}) - Properties: {cha$&lt;br /&gt;
 loop = asyncio.get_event_loop()&lt;br /&gt;
 loop.run_until_complete(connect_to_device(device_uuid))&lt;br /&gt;
&lt;br /&gt;
Now run the script:&lt;br /&gt;
&lt;br /&gt;
 python3 BLE-scripts/ble_characteristics.py&lt;br /&gt;
&lt;br /&gt;
Expected output:&lt;br /&gt;
&lt;br /&gt;
 Service: 0000180a-0000-1000-8000-00805f9b34fb (Handle: 14): Device Information&lt;br /&gt;
  Characteristic: 00002a29-0000-1000-8000-00805f9b34fb (Handle: 15) - Properties: [&#039;read&#039;]&lt;br /&gt;
  Characteristic: 00002a24-0000-1000-8000-00805f9b34fb (Handle: 17) - Properties: [&#039;read&#039;]&lt;br /&gt;
  Characteristic: 00002a25-0000-1000-8000-00805f9b34fb (Handle: 19) - Properties: [&#039;read&#039;]&lt;br /&gt;
  Characteristic: 00002a27-0000-1000-8000-00805f9b34fb (Handle: 21) - Properties: [&#039;read&#039;]&lt;br /&gt;
  Characteristic: 00002a26-0000-1000-8000-00805f9b34fb (Handle: 23) - Properties: [&#039;read&#039;]&lt;br /&gt;
  Characteristic: 00002a28-0000-1000-8000-00805f9b34fb (Handle: 25) - Properties: [&#039;read&#039;]&lt;br /&gt;
  Characteristic: 00002a23-0000-1000-8000-00805f9b34fb (Handle: 27) - Properties: [&#039;read&#039;]&lt;br /&gt;
 Service: 0000feee-0000-1000-8000-00805f9b34fb (Handle: 29): Polar Electro Oy&lt;br /&gt;
  Characteristic: fb005c51-02e7-f387-1cad-8acd2d8df0c8 (Handle: 30) - Properties: [&#039;write-without-response&#039;, &#039;write&#039;, &#039;notify&#039;]&lt;br /&gt;
  Characteristic: fb005c52-02e7-f387-1cad-8acd2d8df0c8 (Handle: 33) - Properties: [&#039;notify&#039;]&lt;br /&gt;
  Characteristic: fb005c53-02e7-f387-1cad-8acd2d8df0c8 (Handle: 36) - Properties: [&#039;write-without-response&#039;, &#039;write&#039;]&lt;br /&gt;
 Service: 0000180d-0000-1000-8000-00805f9b34fb (Handle: 38): Heart Rate&lt;br /&gt;
  Characteristic: 00002a37-0000-1000-8000-00805f9b34fb (Handle: 39) - Properties: [&#039;notify&#039;]&lt;br /&gt;
 Service: 0000180f-0000-1000-8000-00805f9b34fb (Handle: 42): Battery Service&lt;br /&gt;
  Characteristic: 00002a19-0000-1000-8000-00805f9b34fb (Handle: 43) - Properties: [&#039;read&#039;, &#039;notify&#039;]&lt;br /&gt;
&lt;br /&gt;
=== Step 13 - Read data ===&lt;br /&gt;
&lt;br /&gt;
Now add a script for reading the actual data. Make sure to use the characteristics UUIDs you have found out.&lt;br /&gt;
&lt;br /&gt;
 nano BLE-scripts/ble_read.py&lt;br /&gt;
&lt;br /&gt;
 import asyncio&lt;br /&gt;
 from bleak import BleakClient&lt;br /&gt;
 device_uuid = &amp;quot;C6C36C4A-7F8F-52B2-2BD7-C4F6690424E7&amp;quot;&lt;br /&gt;
 HEART_RATE_CHAR_UUID = &amp;quot;00002a37-0000-1000-8000-00805f9b34fb&amp;quot;&lt;br /&gt;
 BATTERY_LEVEL_CHAR_UUID = &amp;quot;00002a19-0000-1000-8000-00805f9b34fb&amp;quot;&lt;br /&gt;
 async def connect_and_read_data(device_uuid):&lt;br /&gt;
     async with BleakClient(device_uuid) as client:&lt;br /&gt;
         connected = client.is_connected&lt;br /&gt;
         print(f&amp;quot;Connected: {connected}&amp;quot;)&lt;br /&gt;
         if connected:&lt;br /&gt;
             try:&lt;br /&gt;
                 heart_rate = await client.read_gatt_char(HEART_RATE_CHAR_UUID)&lt;br /&gt;
                 heart_rate = int(heart_rate_data[1])&lt;br /&gt;
                 print(f&amp;quot;Heart Rate: {heart_rate} bpm&amp;quot;)&lt;br /&gt;
             except Exception as e:&lt;br /&gt;
                 print(f&amp;quot;Failed to read heart rate: {e}&amp;quot;)&lt;br /&gt;
             try:&lt;br /&gt;
                 battery_level = await client.read_gatt_char(BATTERY_LEVEL_CHAR_UUID)&lt;br /&gt;
                 print(f&amp;quot;Battery Level: {int(battery_level[0])}%&amp;quot;)&lt;br /&gt;
             except Exception as e:&lt;br /&gt;
                 print(f&amp;quot;Failed to read battery level: {e}&amp;quot;)&lt;br /&gt;
 loop = asyncio.get_event_loop()&lt;br /&gt;
 loop.run_until_complete(connect_and_read_data(device_uuid))&lt;br /&gt;
&lt;br /&gt;
Run script:&lt;br /&gt;
&lt;br /&gt;
 python3 BLE-scripts/ble_read.py&lt;br /&gt;
&lt;br /&gt;
In the output the battery level was succesfully read and printed out. The heart rate couldn&#039;t be accessed because it only has the notify property and no option for reading:&lt;br /&gt;
&lt;br /&gt;
 Connected: True&lt;br /&gt;
 Failed to read heart rate: Failed to read characteristic 39: Error Domain=CBATTErrorDomain Code=2 &amp;quot;Reading is not permitted.&amp;quot; UserInfo={NSLocalizedDescription=Reading is not permitted.}&lt;br /&gt;
 Battery Level: 16%&lt;br /&gt;
&lt;br /&gt;
=== Step 14 - Subscribe to heart rate notifications ===&lt;br /&gt;
&lt;br /&gt;
 nano BLE-scripts/ble_subscribe.py&lt;br /&gt;
&lt;br /&gt;
 import asyncio&lt;br /&gt;
 from bleak import BleakClient&lt;br /&gt;
 device_uuid = &amp;quot;C6C36C4A-7F8F-52B2-2BD7-C4F6690424E7&amp;quot;&lt;br /&gt;
 HEART_RATE_CHAR_UUID = &amp;quot;00002a37-0000-1000-8000-00805f9b34fb&amp;quot;&lt;br /&gt;
 def heart_rate_handler(sender, data):&lt;br /&gt;
     heart_rate = int(data[1]) if len(data) &amp;gt; 1 else None&lt;br /&gt;
     print(f&amp;quot;Heart Rate from {sender}: {heart_rate} bpm&amp;quot;)&lt;br /&gt;
 async def connect_and_subscribe(device_uuid):&lt;br /&gt;
     async with BleakClient(device_uuid) as client:&lt;br /&gt;
         connected = client.is_connected&lt;br /&gt;
         print(f&amp;quot;Connected: {connected}&amp;quot;)&lt;br /&gt;
         if connected:&lt;br /&gt;
             try:&lt;br /&gt;
                 await client.start_notify(HEART_RATE_CHAR_UUID, heart_rate_handler)&lt;br /&gt;
                 print(&amp;quot;Subscribed to heart rate notifications.&amp;quot;)&lt;br /&gt;
                 await asyncio.sleep(60)&lt;br /&gt;
                 await client.stop_notify(HEART_RATE_CHAR_UUID)&lt;br /&gt;
                 print(&amp;quot;Stopped heart rate notifications.&amp;quot;)&lt;br /&gt;
             except Exception as e:&lt;br /&gt;
                 print(f&amp;quot;Failed to subscribe to heart rate notifications: {e}&amp;quot;)&lt;br /&gt;
 asyncio.run(connect_and_subscribe(device_uuid))&lt;br /&gt;
&lt;br /&gt;
 python3 BLE-scripts/ble_subscribe.py&lt;br /&gt;
&lt;br /&gt;
It was not possible to get the heart rate data even though the notify property was assigned. That is because typically battery status data is on a lower securiy level than heart rate data. More information on GATT can be found here: https://www.bluetooth.com/de/bluetooth-resources/intro-to-bluetooth-gap-gatt/&lt;br /&gt;
&lt;br /&gt;
This is the output of the failed try:&lt;br /&gt;
&lt;br /&gt;
 Connected: True&lt;br /&gt;
 Subscribed to heart rate notifications.&lt;br /&gt;
 Stopped heart rate notifications.&lt;br /&gt;
&lt;br /&gt;
== Used Hardware ==&lt;br /&gt;
&lt;br /&gt;
[[Ubertooth One, 2.4 GHz wireless development platform]]&lt;br /&gt;
&lt;br /&gt;
[[Polar Vantage M]]&lt;br /&gt;
&lt;br /&gt;
[[Apple iPhone 13 mini]]&lt;br /&gt;
&lt;br /&gt;
[[MacBook Air M1, 2020]]&lt;br /&gt;
&lt;br /&gt;
[[Samsung Galaxy J3]]&lt;br /&gt;
&lt;br /&gt;
== Courses ==&lt;br /&gt;
&lt;br /&gt;
* [[Selected IT-Security Chapters]] (2024)&lt;br /&gt;
&lt;br /&gt;
== Author ==&lt;br /&gt;
&lt;br /&gt;
Are Maksimović&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
* https://ubertooth.readthedocs.io/en/latest/&lt;br /&gt;
* https://www.greatscottgadgets.com/ubertoothone/&lt;br /&gt;
* https://codemuch.net/posts/bluetooth-hacking/&lt;br /&gt;
* https://bleak.readthedocs.io/en/latest/usage.html&lt;br /&gt;
* https://www.bluetooth.com/de/bluetooth-resources/intro-to-bluetooth-gap-gatt/&lt;br /&gt;
* https://support.polar.com/en/vantage-m#all&lt;br /&gt;
&lt;br /&gt;
[[Category:Documentation]]&lt;/div&gt;</summary>
		<author><name>AMaksimovic</name></author>
	</entry>
	<entry>
		<id>https://elvis.hcw.ac.at/wiki/index.php?title=Setting_Up_Ubertooth_on_macOS_for_Bluetooth_Hacking&amp;diff=16686</id>
		<title>Setting Up Ubertooth on macOS for Bluetooth Hacking</title>
		<link rel="alternate" type="text/html" href="https://elvis.hcw.ac.at/wiki/index.php?title=Setting_Up_Ubertooth_on_macOS_for_Bluetooth_Hacking&amp;diff=16686"/>
		<updated>2024-12-05T01:03:41Z</updated>

		<summary type="html">&lt;p&gt;AMaksimovic: /* Step 5 - Install the Ubertooth repository */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Summary == &lt;br /&gt;
&lt;br /&gt;
This is a step-by-step guide on how to sniff Bluetooth Low Energy (BLE) packets between a Polar Vantage Smartwatch and a phone using the Ubertooth One. It will go into detail on the setup on a MacBook Air with MacOS using a python environment for the libraries that are used for the setup. Additionally every step of the actual sniff will be outlined. This guide is based on the seminar paper &amp;quot;Smartwatch Hacking Attack&amp;quot; that was written within the FH-course &amp;quot;Selected IT-Security Chapters&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
== Requirements ==&lt;br /&gt;
&lt;br /&gt;
* Hardware tools: Ubertooth One: Firmware version: 2020-12-R1 (API:1.07)&lt;br /&gt;
* Unix-based Operating System: macOS (macOS Sequoia 15.1.1), on a MacBook Air with an Apple M1 chip.&lt;br /&gt;
* Virtual Environment: Python Environment: Python 3.12&lt;br /&gt;
* Packages: libusb, wget, cmake, pkg-config, setuptools, pyqt5, numpy&lt;br /&gt;
* Libraries: libbtbb, bleak&lt;br /&gt;
* Software Tools: Crackle&lt;br /&gt;
&lt;br /&gt;
For the setup this guide was used and adjusted to the given scenario. [[Ubertooth - Build Guide - https://ubertooth.readthedocs.io/en/latest/build_guide.html]].&lt;br /&gt;
&lt;br /&gt;
== Description ==&lt;br /&gt;
&lt;br /&gt;
=== Step 1 - Install homebrew ===&lt;br /&gt;
&lt;br /&gt;
Enter these commands in the shell&lt;br /&gt;
&lt;br /&gt;
 /bin/bash -c &amp;quot;$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)&amp;quot;&lt;br /&gt;
 eval &amp;quot;$(/opt/homebrew/bin/brew shellenv)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
=== Step 2 - Install Python Environment ===&lt;br /&gt;
&lt;br /&gt;
Enter these commands in the shell&lt;br /&gt;
&lt;br /&gt;
 python3.12 -m venv myenv&lt;br /&gt;
 source myenv/bin/activate&lt;br /&gt;
&lt;br /&gt;
=== Step 3 - Install libusb, wget, cmake, pkg-config ===&lt;br /&gt;
&lt;br /&gt;
Enter these commands in the shell&lt;br /&gt;
&lt;br /&gt;
 brew install libusb wget cmake pkg-config&lt;br /&gt;
&lt;br /&gt;
=== Step 4 - Install the Bluetooth baseband library ===&lt;br /&gt;
&lt;br /&gt;
Enter these commands in the shell&lt;br /&gt;
&lt;br /&gt;
 wget https://github.com/greatscottgadgets/libbtbb/archive/2020-12-R1.tar.gz -O libbtbb-2020-12-R1.tar.gz&lt;br /&gt;
 tar -xf libbtbb-2020-12-R1.tar.gz&lt;br /&gt;
 cd libbtbb-2020-12-R1&lt;br /&gt;
 mkdir build&lt;br /&gt;
 cd build&lt;br /&gt;
 cmake ..&lt;br /&gt;
 make&lt;br /&gt;
&lt;br /&gt;
If errors occur with installing distutils switch to setuptools instead.&lt;br /&gt;
&lt;br /&gt;
 pip install setuptools&lt;br /&gt;
&lt;br /&gt;
After installing the setuptools also change the &amp;quot;from distutils import setup&amp;quot; line in the the libbtbb-2020-12-R1/build/python/pcaptools/setup.py file to this:&lt;br /&gt;
&lt;br /&gt;
 from setuptools import setup&lt;br /&gt;
&lt;br /&gt;
Also update the version in that same file to this:&lt;br /&gt;
&lt;br /&gt;
 version = &#039;2020.12.R1&#039;&lt;br /&gt;
&lt;br /&gt;
If necessary set the pythonpath in case you have different python versions:&lt;br /&gt;
 &lt;br /&gt;
 export PYTHONPATH=/Users/&amp;lt;username&amp;gt;/myenv/lib/python3.12/site-packages:$PYTHONPATH&lt;br /&gt;
&lt;br /&gt;
Then retry:&lt;br /&gt;
&lt;br /&gt;
 make&lt;br /&gt;
&lt;br /&gt;
 sudo make install&lt;br /&gt;
&lt;br /&gt;
=== Step 5 - Install the Ubertooth repository ===&lt;br /&gt;
&lt;br /&gt;
For this part you can attach the Ubertooth One to the MacBook. BUT DO NOT USE WITHOUT ANTENNA! More information can be found here: https://ubertooth.readthedocs.io/en/latest/ubertooth_one.html&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Enter these commands in the shell&lt;br /&gt;
&lt;br /&gt;
 wget https://github.com/greatscottgadgets/ubertooth/releases/download/2020-12-R1/ubertooth-2020-12-R1.tar.xz&lt;br /&gt;
 tar -xf ubertooth-2020-12-R1.tar.xz&lt;br /&gt;
 cd ubertooth-2020-12-R1/host&lt;br /&gt;
 mkdir build&lt;br /&gt;
 cd build&lt;br /&gt;
 cmake ..&lt;br /&gt;
 make&lt;br /&gt;
&lt;br /&gt;
If libusb module not found errors occur go to ubertooth-2020-12-R1/host/CMakeLists.txt an add your libusb-path manually:&lt;br /&gt;
&lt;br /&gt;
 include_directories(/opt/homebrew/include)&lt;br /&gt;
 link_directories(/opt/homebrew/lib)&lt;br /&gt;
&lt;br /&gt;
Additionally again change the &amp;quot;from distutils import setup&amp;quot; line in the the ubertooth-2020-12-R1/host/build/python/specan_ui/setup.py file to this:&lt;br /&gt;
&lt;br /&gt;
 from setuptools import setup&lt;br /&gt;
&lt;br /&gt;
Also update the version in that same file to this:&lt;br /&gt;
&lt;br /&gt;
 version = &#039;2020.12.R1&#039;&lt;br /&gt;
&lt;br /&gt;
Then retry:&lt;br /&gt;
&lt;br /&gt;
 make&lt;br /&gt;
&lt;br /&gt;
 sudo make install&lt;br /&gt;
&lt;br /&gt;
If you get errors regarding the environment variables showing that your library wasnt found you need to set the library path via the MacOs&#039;s dynamic linker.&lt;br /&gt;
&lt;br /&gt;
 export DYLD_LIBRARY_PATH=&amp;quot;/usr/local/lib:$DYLD_LIBRARY_PATH&amp;quot;&lt;br /&gt;
&lt;br /&gt;
or make it persistent in shell configurations: &lt;br /&gt;
&lt;br /&gt;
 ~/.zshrc&lt;br /&gt;
&lt;br /&gt;
Afterwards confirm the ubertooth library is working correctly:&lt;br /&gt;
&lt;br /&gt;
 ubertooth-util&lt;br /&gt;
&lt;br /&gt;
=== Step 6 - Test Ubertooth One commands ===&lt;br /&gt;
&lt;br /&gt;
Test these commands:&lt;br /&gt;
&lt;br /&gt;
 ubertooth-util -H&lt;br /&gt;
 ubertooth-util -v&lt;br /&gt;
 ubertooth-util -p&lt;br /&gt;
 ubertooth-util -s&lt;br /&gt;
&lt;br /&gt;
Update Ubertooth firmware in ubertooth-2020-12-R1/ubertooth-one-firmware-bin:&lt;br /&gt;
&lt;br /&gt;
 sudo ubertooth-dfu -d bluetooth_rxtx.dfu -r&lt;br /&gt;
&lt;br /&gt;
In case the libubertooth library is not loading check if the paths are correct.&lt;br /&gt;
&lt;br /&gt;
In ubertooth-2020-12-R1/host the following command leads to getting a list of sniffed Bluetooth packets with their Lower Address Parts (LAP):&lt;br /&gt;
&lt;br /&gt;
 ubertooth-rx&lt;br /&gt;
&lt;br /&gt;
For collecting Upper Address Parts (UAP) from the captured packets add -z:&lt;br /&gt;
&lt;br /&gt;
 ubertooth-rx -z&lt;br /&gt;
&lt;br /&gt;
Let it run for a while and look at the output. It will be summarized as Survey Results at the end of the output. There you can see the significant part of Bluetooth addresses of devices that were scanned. &lt;br /&gt;
&lt;br /&gt;
=== Step 7 - Use BTLE to follow the connection of the Bluetooth device you found. (Replace with device Bluetooth Address) ===&lt;br /&gt;
&lt;br /&gt;
 ubertooth-btle -f B0:67:B5:CF:E5:10 -r test.pcap&lt;br /&gt;
&lt;br /&gt;
Or create a pipe for viewing the captures directly in Wireshark:&lt;br /&gt;
&lt;br /&gt;
 mkfifo /tmp/pipe&lt;br /&gt;
 ubertooth-btle -f B0:67:B5:CF:E5:10 -c /tmp/pipe&lt;br /&gt;
&lt;br /&gt;
Find packages that involve the Polar Smartwatch&lt;br /&gt;
&lt;br /&gt;
 systime=1728247529 freq=2402 addr=8e89bed6 delta_t=34.320 ms rssi=-60&lt;br /&gt;
 20 1b c9 28 84 1a 9e a0 02 01 06 03 02 ee fe 0d ff 6b 00 72 08 00 00 00 00 00 00 00 00 47 e9 1f &lt;br /&gt;
 Advertising / AA 8e89bed6 (valid)/ 27 bytes&lt;br /&gt;
     Channel Index: 37&lt;br /&gt;
     Type:  ADV_IND&lt;br /&gt;
     AdvA:  a0:9e:1a:84:28:c9 (public)&lt;br /&gt;
     AdvData: 02 01 06 03 02 ee fe 0d ff 6b 00 72 08 00 00 00 00 00 00 00 00&lt;br /&gt;
         Type 01 (Flags)&lt;br /&gt;
            00000110&lt;br /&gt;
                LE General Discoverable Mode&lt;br /&gt;
                BR/EDR Not Supported&lt;br /&gt;
         Type 02 (16-bit Service UUIDs, more available)&lt;br /&gt;
            feee&lt;br /&gt;
         Type ff (Manufacturer Specific Data)&lt;br /&gt;
            Company: Polar Electro OY&lt;br /&gt;
            Data: 72 08 00 00 00 00 00 00 00 00&lt;br /&gt;
     Data:  c9 28 84 1a 9e a0 02 01 06 03 02 ee fe 0d ff 6b 00 72 08 00 00 00 00 00 00 00 00&lt;br /&gt;
     CRC:   47 e9 1f&lt;br /&gt;
&lt;br /&gt;
=== Step 8 - Use Crackle to crack packages ===&lt;br /&gt;
&lt;br /&gt;
Enter these commands:&lt;br /&gt;
&lt;br /&gt;
 git clone https://github.com/mikeryan/crackle.git&lt;br /&gt;
 cd crackle&lt;br /&gt;
 make&lt;br /&gt;
&lt;br /&gt;
Now try cracking your pcap.file&lt;br /&gt;
&lt;br /&gt;
 ./crackle -i &amp;lt;your_file.pcap&amp;gt; -o &amp;lt;your_new_output_file.pcap&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this case it wasnt possible to crack any packages from the smartwatch.&lt;br /&gt;
&lt;br /&gt;
=== Step 9 - Install bleak library ===&lt;br /&gt;
&lt;br /&gt;
 pip install bleak&lt;br /&gt;
&lt;br /&gt;
More information can be found in the bleak library documentation. (https://bleak.readthedocs.io/en/latest/usage.html) It also includes sample scripts which were used in the following setup.&lt;br /&gt;
&lt;br /&gt;
=== Step 10 - Write python script for reading device UUID ===&lt;br /&gt;
&lt;br /&gt;
Enter these commands in the shell&lt;br /&gt;
&lt;br /&gt;
 mkdir BLE-scripts&lt;br /&gt;
 cd BLE-scripts&lt;br /&gt;
 nano ble_scan.py&lt;br /&gt;
&lt;br /&gt;
Write simple script to read device UUID using BleakScaner.discover() method:&lt;br /&gt;
 &lt;br /&gt;
 import asyncio&lt;br /&gt;
 from bleak import BleakScanner&lt;br /&gt;
 async def scan():&lt;br /&gt;
     devices = await BleakScanner.discover()&lt;br /&gt;
     for d in devices:&lt;br /&gt;
         print(d)&lt;br /&gt;
 asyncio.run(scan())&lt;br /&gt;
&lt;br /&gt;
Run a scan:&lt;br /&gt;
&lt;br /&gt;
 python3 BLE-scripts/ble_scan.py&lt;br /&gt;
&lt;br /&gt;
Here the device UUID of the Polar smartwatch was found:&lt;br /&gt;
&lt;br /&gt;
 C6C36C4A-7F8F-52B2-2BD7-C4F6690424E7: Polar Vantage M 8428C92D&lt;br /&gt;
&lt;br /&gt;
=== Step 11 - Check GATT services  ===&lt;br /&gt;
&lt;br /&gt;
With the gathered device UUID check for the devices services:&lt;br /&gt;
&lt;br /&gt;
 nano BLE-scripts/ble_services.py&lt;br /&gt;
&lt;br /&gt;
 import asyncio&lt;br /&gt;
 from bleak import BleakClient&lt;br /&gt;
 device_uuid = &amp;quot;C6C36C4A-7F8F-52B2-2BD7-C4F6690424E7&amp;quot;&lt;br /&gt;
 async def connect_to_device(device_uuid):&lt;br /&gt;
     async with BleakClient(device_uuid) as client:&lt;br /&gt;
         connected = client.is_connected&lt;br /&gt;
         print(f&amp;quot;Connected: {connected}&amp;quot;)&lt;br /&gt;
         services = client.services&lt;br /&gt;
         if services is None:&lt;br /&gt;
             await client.get_services()&lt;br /&gt;
         for service in services:&lt;br /&gt;
             print(f&amp;quot;Service: {service}&amp;quot;)&lt;br /&gt;
 loop = asyncio.get_event_loop()&lt;br /&gt;
 loop.run_until_complete(connect_to_device(device_uuid))&lt;br /&gt;
&lt;br /&gt;
Run a services scan:&lt;br /&gt;
&lt;br /&gt;
 python3 BLE-scripts/ble_services.py&lt;br /&gt;
&lt;br /&gt;
Now the service UUIDs that were found are going to be listed like this:&lt;br /&gt;
&lt;br /&gt;
 Service: 0000180a-0000-1000-8000-00805f9b34fb (Handle: 14): Device Information&lt;br /&gt;
 Service: 0000feee-0000-1000-8000-00805f9b34fb (Handle: 29): Polar Electro Oy&lt;br /&gt;
 Service: 0000180d-0000-1000-8000-00805f9b34fb (Handle: 38): Heart Rate&lt;br /&gt;
 Service: 0000180f-0000-1000-8000-00805f9b34fb (Handle: 42): Battery Service&lt;br /&gt;
&lt;br /&gt;
=== Step 12 - Get characteristics UUIDs  ===&lt;br /&gt;
&lt;br /&gt;
 nano BLE-scripts/ble_characteristics.py&lt;br /&gt;
&lt;br /&gt;
 import asyncio&lt;br /&gt;
 from bleak import BleakClient&lt;br /&gt;
 device_uuid = &amp;quot;C6C36C4A-7F8F-52B2-2BD7-C4F6690424E7&amp;quot;&lt;br /&gt;
 async def connect_to_device(device_uuid):&lt;br /&gt;
     async with BleakClient(device_uuid) as client:&lt;br /&gt;
         connected = client.is_connected&lt;br /&gt;
         print(f&amp;quot;Connected: {connected}&amp;quot;)&lt;br /&gt;
         services = client.services&lt;br /&gt;
         if services is None:&lt;br /&gt;
             await client.get_services()&lt;br /&gt;
         for service in services:&lt;br /&gt;
             print(f&amp;quot;Service: {service.uuid} (Handle: {service.handle}): {service.description}&amp;quot;)&lt;br /&gt;
             for characteristic in service.characteristics:&lt;br /&gt;
                 print(f&amp;quot;  Characteristic: {characteristic.uuid} (Handle: {characteristic.handle}) - Properties: {cha$&lt;br /&gt;
 loop = asyncio.get_event_loop()&lt;br /&gt;
 loop.run_until_complete(connect_to_device(device_uuid))&lt;br /&gt;
&lt;br /&gt;
Now run the script:&lt;br /&gt;
&lt;br /&gt;
 python3 BLE-scripts/ble_characteristics.py&lt;br /&gt;
&lt;br /&gt;
Expected output:&lt;br /&gt;
&lt;br /&gt;
 Service: 0000180a-0000-1000-8000-00805f9b34fb (Handle: 14): Device Information&lt;br /&gt;
  Characteristic: 00002a29-0000-1000-8000-00805f9b34fb (Handle: 15) - Properties: [&#039;read&#039;]&lt;br /&gt;
  Characteristic: 00002a24-0000-1000-8000-00805f9b34fb (Handle: 17) - Properties: [&#039;read&#039;]&lt;br /&gt;
  Characteristic: 00002a25-0000-1000-8000-00805f9b34fb (Handle: 19) - Properties: [&#039;read&#039;]&lt;br /&gt;
  Characteristic: 00002a27-0000-1000-8000-00805f9b34fb (Handle: 21) - Properties: [&#039;read&#039;]&lt;br /&gt;
  Characteristic: 00002a26-0000-1000-8000-00805f9b34fb (Handle: 23) - Properties: [&#039;read&#039;]&lt;br /&gt;
  Characteristic: 00002a28-0000-1000-8000-00805f9b34fb (Handle: 25) - Properties: [&#039;read&#039;]&lt;br /&gt;
  Characteristic: 00002a23-0000-1000-8000-00805f9b34fb (Handle: 27) - Properties: [&#039;read&#039;]&lt;br /&gt;
 Service: 0000feee-0000-1000-8000-00805f9b34fb (Handle: 29): Polar Electro Oy&lt;br /&gt;
  Characteristic: fb005c51-02e7-f387-1cad-8acd2d8df0c8 (Handle: 30) - Properties: [&#039;write-without-response&#039;, &#039;write&#039;, &#039;notify&#039;]&lt;br /&gt;
  Characteristic: fb005c52-02e7-f387-1cad-8acd2d8df0c8 (Handle: 33) - Properties: [&#039;notify&#039;]&lt;br /&gt;
  Characteristic: fb005c53-02e7-f387-1cad-8acd2d8df0c8 (Handle: 36) - Properties: [&#039;write-without-response&#039;, &#039;write&#039;]&lt;br /&gt;
 Service: 0000180d-0000-1000-8000-00805f9b34fb (Handle: 38): Heart Rate&lt;br /&gt;
  Characteristic: 00002a37-0000-1000-8000-00805f9b34fb (Handle: 39) - Properties: [&#039;notify&#039;]&lt;br /&gt;
 Service: 0000180f-0000-1000-8000-00805f9b34fb (Handle: 42): Battery Service&lt;br /&gt;
  Characteristic: 00002a19-0000-1000-8000-00805f9b34fb (Handle: 43) - Properties: [&#039;read&#039;, &#039;notify&#039;]&lt;br /&gt;
&lt;br /&gt;
=== Step 13 - Read data ===&lt;br /&gt;
&lt;br /&gt;
Now add a script for reading the actual data. Make sure to use the characteristics UUIDs you have found out.&lt;br /&gt;
&lt;br /&gt;
 nano BLE-scripts/ble_read.py&lt;br /&gt;
&lt;br /&gt;
 import asyncio&lt;br /&gt;
 from bleak import BleakClient&lt;br /&gt;
 device_uuid = &amp;quot;C6C36C4A-7F8F-52B2-2BD7-C4F6690424E7&amp;quot;&lt;br /&gt;
 HEART_RATE_CHAR_UUID = &amp;quot;00002a37-0000-1000-8000-00805f9b34fb&amp;quot;&lt;br /&gt;
 BATTERY_LEVEL_CHAR_UUID = &amp;quot;00002a19-0000-1000-8000-00805f9b34fb&amp;quot;&lt;br /&gt;
 async def connect_and_read_data(device_uuid):&lt;br /&gt;
     async with BleakClient(device_uuid) as client:&lt;br /&gt;
         connected = client.is_connected&lt;br /&gt;
         print(f&amp;quot;Connected: {connected}&amp;quot;)&lt;br /&gt;
         if connected:&lt;br /&gt;
             try:&lt;br /&gt;
                 heart_rate = await client.read_gatt_char(HEART_RATE_CHAR_UUID)&lt;br /&gt;
                 heart_rate = int(heart_rate_data[1])&lt;br /&gt;
                 print(f&amp;quot;Heart Rate: {heart_rate} bpm&amp;quot;)&lt;br /&gt;
             except Exception as e:&lt;br /&gt;
                 print(f&amp;quot;Failed to read heart rate: {e}&amp;quot;)&lt;br /&gt;
             try:&lt;br /&gt;
                 battery_level = await client.read_gatt_char(BATTERY_LEVEL_CHAR_UUID)&lt;br /&gt;
                 print(f&amp;quot;Battery Level: {int(battery_level[0])}%&amp;quot;)&lt;br /&gt;
             except Exception as e:&lt;br /&gt;
                 print(f&amp;quot;Failed to read battery level: {e}&amp;quot;)&lt;br /&gt;
 loop = asyncio.get_event_loop()&lt;br /&gt;
 loop.run_until_complete(connect_and_read_data(device_uuid))&lt;br /&gt;
&lt;br /&gt;
Run script:&lt;br /&gt;
&lt;br /&gt;
 python3 BLE-scripts/ble_read.py&lt;br /&gt;
&lt;br /&gt;
In the output the battery level was succesfully read and printed out. The heart rate couldn&#039;t be accessed because it only has the notify property and no option for reading:&lt;br /&gt;
&lt;br /&gt;
 Connected: True&lt;br /&gt;
 Failed to read heart rate: Failed to read characteristic 39: Error Domain=CBATTErrorDomain Code=2 &amp;quot;Reading is not permitted.&amp;quot; UserInfo={NSLocalizedDescription=Reading is not permitted.}&lt;br /&gt;
 Battery Level: 16%&lt;br /&gt;
&lt;br /&gt;
=== Step 14 - Subscribe to heart rate notifications ===&lt;br /&gt;
&lt;br /&gt;
 nano BLE-scripts/ble_subscribe.py&lt;br /&gt;
&lt;br /&gt;
 import asyncio&lt;br /&gt;
 from bleak import BleakClient&lt;br /&gt;
 device_uuid = &amp;quot;C6C36C4A-7F8F-52B2-2BD7-C4F6690424E7&amp;quot;&lt;br /&gt;
 HEART_RATE_CHAR_UUID = &amp;quot;00002a37-0000-1000-8000-00805f9b34fb&amp;quot;&lt;br /&gt;
 def heart_rate_handler(sender, data):&lt;br /&gt;
     heart_rate = int(data[1]) if len(data) &amp;gt; 1 else None&lt;br /&gt;
     print(f&amp;quot;Heart Rate from {sender}: {heart_rate} bpm&amp;quot;)&lt;br /&gt;
 async def connect_and_subscribe(device_uuid):&lt;br /&gt;
     async with BleakClient(device_uuid) as client:&lt;br /&gt;
         connected = client.is_connected&lt;br /&gt;
         print(f&amp;quot;Connected: {connected}&amp;quot;)&lt;br /&gt;
         if connected:&lt;br /&gt;
             try:&lt;br /&gt;
                 await client.start_notify(HEART_RATE_CHAR_UUID, heart_rate_handler)&lt;br /&gt;
                 print(&amp;quot;Subscribed to heart rate notifications.&amp;quot;)&lt;br /&gt;
                 await asyncio.sleep(60)&lt;br /&gt;
                 await client.stop_notify(HEART_RATE_CHAR_UUID)&lt;br /&gt;
                 print(&amp;quot;Stopped heart rate notifications.&amp;quot;)&lt;br /&gt;
             except Exception as e:&lt;br /&gt;
                 print(f&amp;quot;Failed to subscribe to heart rate notifications: {e}&amp;quot;)&lt;br /&gt;
 asyncio.run(connect_and_subscribe(device_uuid))&lt;br /&gt;
&lt;br /&gt;
 python3 BLE-scripts/ble_subscribe.py&lt;br /&gt;
&lt;br /&gt;
It was not possible to get the heart rate data even though the notify property was assigned. That is because typically battery status data is on a lower securiy level than heart rate data. More information on GATT can be found here: https://www.bluetooth.com/de/bluetooth-resources/intro-to-bluetooth-gap-gatt/&lt;br /&gt;
&lt;br /&gt;
This is the output of the failed try:&lt;br /&gt;
&lt;br /&gt;
 Connected: True&lt;br /&gt;
 Subscribed to heart rate notifications.&lt;br /&gt;
 Stopped heart rate notifications.&lt;br /&gt;
&lt;br /&gt;
== Used Hardware ==&lt;br /&gt;
&lt;br /&gt;
[[Ubertooth One, 2.4 GHz wireless development platform]]&lt;br /&gt;
&lt;br /&gt;
[[Polar Vantage M]]&lt;br /&gt;
&lt;br /&gt;
[[Apple iPhone 13 mini]]&lt;br /&gt;
&lt;br /&gt;
[[MacBook Air M1, 2020]]&lt;br /&gt;
&lt;br /&gt;
[[Samsung Galaxy J3]]&lt;br /&gt;
&lt;br /&gt;
== Courses ==&lt;br /&gt;
&lt;br /&gt;
* [[Selected IT-Security Chapters]] (2024)&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
* https://ubertooth.readthedocs.io/en/latest/&lt;br /&gt;
* https://www.greatscottgadgets.com/ubertoothone/&lt;br /&gt;
* https://codemuch.net/posts/bluetooth-hacking/&lt;br /&gt;
* https://bleak.readthedocs.io/en/latest/usage.html&lt;br /&gt;
* https://www.bluetooth.com/de/bluetooth-resources/intro-to-bluetooth-gap-gatt/&lt;br /&gt;
* https://support.polar.com/en/vantage-m#all&lt;br /&gt;
&lt;br /&gt;
[[Category:Documentation]]&lt;/div&gt;</summary>
		<author><name>AMaksimovic</name></author>
	</entry>
	<entry>
		<id>https://elvis.hcw.ac.at/wiki/index.php?title=Setting_Up_Ubertooth_on_macOS_for_Bluetooth_Hacking&amp;diff=16685</id>
		<title>Setting Up Ubertooth on macOS for Bluetooth Hacking</title>
		<link rel="alternate" type="text/html" href="https://elvis.hcw.ac.at/wiki/index.php?title=Setting_Up_Ubertooth_on_macOS_for_Bluetooth_Hacking&amp;diff=16685"/>
		<updated>2024-12-05T01:01:09Z</updated>

		<summary type="html">&lt;p&gt;AMaksimovic: /* Step 14 - Subscribe to heart rate notifications */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Summary == &lt;br /&gt;
&lt;br /&gt;
This is a step-by-step guide on how to sniff Bluetooth Low Energy (BLE) packets between a Polar Vantage Smartwatch and a phone using the Ubertooth One. It will go into detail on the setup on a MacBook Air with MacOS using a python environment for the libraries that are used for the setup. Additionally every step of the actual sniff will be outlined. This guide is based on the seminar paper &amp;quot;Smartwatch Hacking Attack&amp;quot; that was written within the FH-course &amp;quot;Selected IT-Security Chapters&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
== Requirements ==&lt;br /&gt;
&lt;br /&gt;
* Hardware tools: Ubertooth One: Firmware version: 2020-12-R1 (API:1.07)&lt;br /&gt;
* Unix-based Operating System: macOS (macOS Sequoia 15.1.1), on a MacBook Air with an Apple M1 chip.&lt;br /&gt;
* Virtual Environment: Python Environment: Python 3.12&lt;br /&gt;
* Packages: libusb, wget, cmake, pkg-config, setuptools, pyqt5, numpy&lt;br /&gt;
* Libraries: libbtbb, bleak&lt;br /&gt;
* Software Tools: Crackle&lt;br /&gt;
&lt;br /&gt;
For the setup this guide was used and adjusted to the given scenario. [[Ubertooth - Build Guide - https://ubertooth.readthedocs.io/en/latest/build_guide.html]].&lt;br /&gt;
&lt;br /&gt;
== Description ==&lt;br /&gt;
&lt;br /&gt;
=== Step 1 - Install homebrew ===&lt;br /&gt;
&lt;br /&gt;
Enter these commands in the shell&lt;br /&gt;
&lt;br /&gt;
 /bin/bash -c &amp;quot;$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)&amp;quot;&lt;br /&gt;
 eval &amp;quot;$(/opt/homebrew/bin/brew shellenv)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
=== Step 2 - Install Python Environment ===&lt;br /&gt;
&lt;br /&gt;
Enter these commands in the shell&lt;br /&gt;
&lt;br /&gt;
 python3.12 -m venv myenv&lt;br /&gt;
 source myenv/bin/activate&lt;br /&gt;
&lt;br /&gt;
=== Step 3 - Install libusb, wget, cmake, pkg-config ===&lt;br /&gt;
&lt;br /&gt;
Enter these commands in the shell&lt;br /&gt;
&lt;br /&gt;
 brew install libusb wget cmake pkg-config&lt;br /&gt;
&lt;br /&gt;
=== Step 4 - Install the Bluetooth baseband library ===&lt;br /&gt;
&lt;br /&gt;
Enter these commands in the shell&lt;br /&gt;
&lt;br /&gt;
 wget https://github.com/greatscottgadgets/libbtbb/archive/2020-12-R1.tar.gz -O libbtbb-2020-12-R1.tar.gz&lt;br /&gt;
 tar -xf libbtbb-2020-12-R1.tar.gz&lt;br /&gt;
 cd libbtbb-2020-12-R1&lt;br /&gt;
 mkdir build&lt;br /&gt;
 cd build&lt;br /&gt;
 cmake ..&lt;br /&gt;
 make&lt;br /&gt;
&lt;br /&gt;
If errors occur with installing distutils switch to setuptools instead.&lt;br /&gt;
&lt;br /&gt;
 pip install setuptools&lt;br /&gt;
&lt;br /&gt;
After installing the setuptools also change the &amp;quot;from distutils import setup&amp;quot; line in the the libbtbb-2020-12-R1/build/python/pcaptools/setup.py file to this:&lt;br /&gt;
&lt;br /&gt;
 from setuptools import setup&lt;br /&gt;
&lt;br /&gt;
Also update the version in that same file to this:&lt;br /&gt;
&lt;br /&gt;
 version = &#039;2020.12.R1&#039;&lt;br /&gt;
&lt;br /&gt;
If necessary set the pythonpath in case you have different python versions:&lt;br /&gt;
 &lt;br /&gt;
 export PYTHONPATH=/Users/&amp;lt;username&amp;gt;/myenv/lib/python3.12/site-packages:$PYTHONPATH&lt;br /&gt;
&lt;br /&gt;
Then retry:&lt;br /&gt;
&lt;br /&gt;
 make&lt;br /&gt;
&lt;br /&gt;
 sudo make install&lt;br /&gt;
&lt;br /&gt;
=== Step 5 - Install the Ubertooth repository ===&lt;br /&gt;
&lt;br /&gt;
Enter these commands in the shell&lt;br /&gt;
&lt;br /&gt;
 wget https://github.com/greatscottgadgets/ubertooth/releases/download/2020-12-R1/ubertooth-2020-12-R1.tar.xz&lt;br /&gt;
 tar -xf ubertooth-2020-12-R1.tar.xz&lt;br /&gt;
 cd ubertooth-2020-12-R1/host&lt;br /&gt;
 mkdir build&lt;br /&gt;
 cd build&lt;br /&gt;
 cmake ..&lt;br /&gt;
 make&lt;br /&gt;
&lt;br /&gt;
If libusb module not found errors occur go to ubertooth-2020-12-R1/host/CMakeLists.txt an add your libusb-path manually:&lt;br /&gt;
&lt;br /&gt;
 include_directories(/opt/homebrew/include)&lt;br /&gt;
 link_directories(/opt/homebrew/lib)&lt;br /&gt;
&lt;br /&gt;
Additionally again change the &amp;quot;from distutils import setup&amp;quot; line in the the ubertooth-2020-12-R1/host/build/python/specan_ui/setup.py file to this:&lt;br /&gt;
&lt;br /&gt;
 from setuptools import setup&lt;br /&gt;
&lt;br /&gt;
Also update the version in that same file to this:&lt;br /&gt;
&lt;br /&gt;
 version = &#039;2020.12.R1&#039;&lt;br /&gt;
&lt;br /&gt;
Then retry:&lt;br /&gt;
&lt;br /&gt;
 make&lt;br /&gt;
&lt;br /&gt;
 sudo make install&lt;br /&gt;
&lt;br /&gt;
If you get errors regarding the environment variables showing that your library wasnt found you need to set the library path via the MacOs&#039;s dynamic linker.&lt;br /&gt;
&lt;br /&gt;
 export DYLD_LIBRARY_PATH=&amp;quot;/usr/local/lib:$DYLD_LIBRARY_PATH&amp;quot;&lt;br /&gt;
&lt;br /&gt;
or make it persistent in shell configurations: &lt;br /&gt;
&lt;br /&gt;
 ~/.zshrc&lt;br /&gt;
&lt;br /&gt;
Afterwards confirm the ubertooth library is working correctly:&lt;br /&gt;
&lt;br /&gt;
 ubertooth-util&lt;br /&gt;
&lt;br /&gt;
=== Step 6 - Test Ubertooth One commands ===&lt;br /&gt;
&lt;br /&gt;
Test these commands:&lt;br /&gt;
&lt;br /&gt;
 ubertooth-util -H&lt;br /&gt;
 ubertooth-util -v&lt;br /&gt;
 ubertooth-util -p&lt;br /&gt;
 ubertooth-util -s&lt;br /&gt;
&lt;br /&gt;
Update Ubertooth firmware in ubertooth-2020-12-R1/ubertooth-one-firmware-bin:&lt;br /&gt;
&lt;br /&gt;
 sudo ubertooth-dfu -d bluetooth_rxtx.dfu -r&lt;br /&gt;
&lt;br /&gt;
In case the libubertooth library is not loading check if the paths are correct.&lt;br /&gt;
&lt;br /&gt;
In ubertooth-2020-12-R1/host the following command leads to getting a list of sniffed Bluetooth packets with their Lower Address Parts (LAP):&lt;br /&gt;
&lt;br /&gt;
 ubertooth-rx&lt;br /&gt;
&lt;br /&gt;
For collecting Upper Address Parts (UAP) from the captured packets add -z:&lt;br /&gt;
&lt;br /&gt;
 ubertooth-rx -z&lt;br /&gt;
&lt;br /&gt;
Let it run for a while and look at the output. It will be summarized as Survey Results at the end of the output. There you can see the significant part of Bluetooth addresses of devices that were scanned. &lt;br /&gt;
&lt;br /&gt;
=== Step 7 - Use BTLE to follow the connection of the Bluetooth device you found. (Replace with device Bluetooth Address) ===&lt;br /&gt;
&lt;br /&gt;
 ubertooth-btle -f B0:67:B5:CF:E5:10 -r test.pcap&lt;br /&gt;
&lt;br /&gt;
Or create a pipe for viewing the captures directly in Wireshark:&lt;br /&gt;
&lt;br /&gt;
 mkfifo /tmp/pipe&lt;br /&gt;
 ubertooth-btle -f B0:67:B5:CF:E5:10 -c /tmp/pipe&lt;br /&gt;
&lt;br /&gt;
Find packages that involve the Polar Smartwatch&lt;br /&gt;
&lt;br /&gt;
 systime=1728247529 freq=2402 addr=8e89bed6 delta_t=34.320 ms rssi=-60&lt;br /&gt;
 20 1b c9 28 84 1a 9e a0 02 01 06 03 02 ee fe 0d ff 6b 00 72 08 00 00 00 00 00 00 00 00 47 e9 1f &lt;br /&gt;
 Advertising / AA 8e89bed6 (valid)/ 27 bytes&lt;br /&gt;
     Channel Index: 37&lt;br /&gt;
     Type:  ADV_IND&lt;br /&gt;
     AdvA:  a0:9e:1a:84:28:c9 (public)&lt;br /&gt;
     AdvData: 02 01 06 03 02 ee fe 0d ff 6b 00 72 08 00 00 00 00 00 00 00 00&lt;br /&gt;
         Type 01 (Flags)&lt;br /&gt;
            00000110&lt;br /&gt;
                LE General Discoverable Mode&lt;br /&gt;
                BR/EDR Not Supported&lt;br /&gt;
         Type 02 (16-bit Service UUIDs, more available)&lt;br /&gt;
            feee&lt;br /&gt;
         Type ff (Manufacturer Specific Data)&lt;br /&gt;
            Company: Polar Electro OY&lt;br /&gt;
            Data: 72 08 00 00 00 00 00 00 00 00&lt;br /&gt;
     Data:  c9 28 84 1a 9e a0 02 01 06 03 02 ee fe 0d ff 6b 00 72 08 00 00 00 00 00 00 00 00&lt;br /&gt;
     CRC:   47 e9 1f&lt;br /&gt;
&lt;br /&gt;
=== Step 8 - Use Crackle to crack packages ===&lt;br /&gt;
&lt;br /&gt;
Enter these commands:&lt;br /&gt;
&lt;br /&gt;
 git clone https://github.com/mikeryan/crackle.git&lt;br /&gt;
 cd crackle&lt;br /&gt;
 make&lt;br /&gt;
&lt;br /&gt;
Now try cracking your pcap.file&lt;br /&gt;
&lt;br /&gt;
 ./crackle -i &amp;lt;your_file.pcap&amp;gt; -o &amp;lt;your_new_output_file.pcap&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this case it wasnt possible to crack any packages from the smartwatch.&lt;br /&gt;
&lt;br /&gt;
=== Step 9 - Install bleak library ===&lt;br /&gt;
&lt;br /&gt;
 pip install bleak&lt;br /&gt;
&lt;br /&gt;
More information can be found in the bleak library documentation. (https://bleak.readthedocs.io/en/latest/usage.html) It also includes sample scripts which were used in the following setup.&lt;br /&gt;
&lt;br /&gt;
=== Step 10 - Write python script for reading device UUID ===&lt;br /&gt;
&lt;br /&gt;
Enter these commands in the shell&lt;br /&gt;
&lt;br /&gt;
 mkdir BLE-scripts&lt;br /&gt;
 cd BLE-scripts&lt;br /&gt;
 nano ble_scan.py&lt;br /&gt;
&lt;br /&gt;
Write simple script to read device UUID using BleakScaner.discover() method:&lt;br /&gt;
 &lt;br /&gt;
 import asyncio&lt;br /&gt;
 from bleak import BleakScanner&lt;br /&gt;
 async def scan():&lt;br /&gt;
     devices = await BleakScanner.discover()&lt;br /&gt;
     for d in devices:&lt;br /&gt;
         print(d)&lt;br /&gt;
 asyncio.run(scan())&lt;br /&gt;
&lt;br /&gt;
Run a scan:&lt;br /&gt;
&lt;br /&gt;
 python3 BLE-scripts/ble_scan.py&lt;br /&gt;
&lt;br /&gt;
Here the device UUID of the Polar smartwatch was found:&lt;br /&gt;
&lt;br /&gt;
 C6C36C4A-7F8F-52B2-2BD7-C4F6690424E7: Polar Vantage M 8428C92D&lt;br /&gt;
&lt;br /&gt;
=== Step 11 - Check GATT services  ===&lt;br /&gt;
&lt;br /&gt;
With the gathered device UUID check for the devices services:&lt;br /&gt;
&lt;br /&gt;
 nano BLE-scripts/ble_services.py&lt;br /&gt;
&lt;br /&gt;
 import asyncio&lt;br /&gt;
 from bleak import BleakClient&lt;br /&gt;
 device_uuid = &amp;quot;C6C36C4A-7F8F-52B2-2BD7-C4F6690424E7&amp;quot;&lt;br /&gt;
 async def connect_to_device(device_uuid):&lt;br /&gt;
     async with BleakClient(device_uuid) as client:&lt;br /&gt;
         connected = client.is_connected&lt;br /&gt;
         print(f&amp;quot;Connected: {connected}&amp;quot;)&lt;br /&gt;
         services = client.services&lt;br /&gt;
         if services is None:&lt;br /&gt;
             await client.get_services()&lt;br /&gt;
         for service in services:&lt;br /&gt;
             print(f&amp;quot;Service: {service}&amp;quot;)&lt;br /&gt;
 loop = asyncio.get_event_loop()&lt;br /&gt;
 loop.run_until_complete(connect_to_device(device_uuid))&lt;br /&gt;
&lt;br /&gt;
Run a services scan:&lt;br /&gt;
&lt;br /&gt;
 python3 BLE-scripts/ble_services.py&lt;br /&gt;
&lt;br /&gt;
Now the service UUIDs that were found are going to be listed like this:&lt;br /&gt;
&lt;br /&gt;
 Service: 0000180a-0000-1000-8000-00805f9b34fb (Handle: 14): Device Information&lt;br /&gt;
 Service: 0000feee-0000-1000-8000-00805f9b34fb (Handle: 29): Polar Electro Oy&lt;br /&gt;
 Service: 0000180d-0000-1000-8000-00805f9b34fb (Handle: 38): Heart Rate&lt;br /&gt;
 Service: 0000180f-0000-1000-8000-00805f9b34fb (Handle: 42): Battery Service&lt;br /&gt;
&lt;br /&gt;
=== Step 12 - Get characteristics UUIDs  ===&lt;br /&gt;
&lt;br /&gt;
 nano BLE-scripts/ble_characteristics.py&lt;br /&gt;
&lt;br /&gt;
 import asyncio&lt;br /&gt;
 from bleak import BleakClient&lt;br /&gt;
 device_uuid = &amp;quot;C6C36C4A-7F8F-52B2-2BD7-C4F6690424E7&amp;quot;&lt;br /&gt;
 async def connect_to_device(device_uuid):&lt;br /&gt;
     async with BleakClient(device_uuid) as client:&lt;br /&gt;
         connected = client.is_connected&lt;br /&gt;
         print(f&amp;quot;Connected: {connected}&amp;quot;)&lt;br /&gt;
         services = client.services&lt;br /&gt;
         if services is None:&lt;br /&gt;
             await client.get_services()&lt;br /&gt;
         for service in services:&lt;br /&gt;
             print(f&amp;quot;Service: {service.uuid} (Handle: {service.handle}): {service.description}&amp;quot;)&lt;br /&gt;
             for characteristic in service.characteristics:&lt;br /&gt;
                 print(f&amp;quot;  Characteristic: {characteristic.uuid} (Handle: {characteristic.handle}) - Properties: {cha$&lt;br /&gt;
 loop = asyncio.get_event_loop()&lt;br /&gt;
 loop.run_until_complete(connect_to_device(device_uuid))&lt;br /&gt;
&lt;br /&gt;
Now run the script:&lt;br /&gt;
&lt;br /&gt;
 python3 BLE-scripts/ble_characteristics.py&lt;br /&gt;
&lt;br /&gt;
Expected output:&lt;br /&gt;
&lt;br /&gt;
 Service: 0000180a-0000-1000-8000-00805f9b34fb (Handle: 14): Device Information&lt;br /&gt;
  Characteristic: 00002a29-0000-1000-8000-00805f9b34fb (Handle: 15) - Properties: [&#039;read&#039;]&lt;br /&gt;
  Characteristic: 00002a24-0000-1000-8000-00805f9b34fb (Handle: 17) - Properties: [&#039;read&#039;]&lt;br /&gt;
  Characteristic: 00002a25-0000-1000-8000-00805f9b34fb (Handle: 19) - Properties: [&#039;read&#039;]&lt;br /&gt;
  Characteristic: 00002a27-0000-1000-8000-00805f9b34fb (Handle: 21) - Properties: [&#039;read&#039;]&lt;br /&gt;
  Characteristic: 00002a26-0000-1000-8000-00805f9b34fb (Handle: 23) - Properties: [&#039;read&#039;]&lt;br /&gt;
  Characteristic: 00002a28-0000-1000-8000-00805f9b34fb (Handle: 25) - Properties: [&#039;read&#039;]&lt;br /&gt;
  Characteristic: 00002a23-0000-1000-8000-00805f9b34fb (Handle: 27) - Properties: [&#039;read&#039;]&lt;br /&gt;
 Service: 0000feee-0000-1000-8000-00805f9b34fb (Handle: 29): Polar Electro Oy&lt;br /&gt;
  Characteristic: fb005c51-02e7-f387-1cad-8acd2d8df0c8 (Handle: 30) - Properties: [&#039;write-without-response&#039;, &#039;write&#039;, &#039;notify&#039;]&lt;br /&gt;
  Characteristic: fb005c52-02e7-f387-1cad-8acd2d8df0c8 (Handle: 33) - Properties: [&#039;notify&#039;]&lt;br /&gt;
  Characteristic: fb005c53-02e7-f387-1cad-8acd2d8df0c8 (Handle: 36) - Properties: [&#039;write-without-response&#039;, &#039;write&#039;]&lt;br /&gt;
 Service: 0000180d-0000-1000-8000-00805f9b34fb (Handle: 38): Heart Rate&lt;br /&gt;
  Characteristic: 00002a37-0000-1000-8000-00805f9b34fb (Handle: 39) - Properties: [&#039;notify&#039;]&lt;br /&gt;
 Service: 0000180f-0000-1000-8000-00805f9b34fb (Handle: 42): Battery Service&lt;br /&gt;
  Characteristic: 00002a19-0000-1000-8000-00805f9b34fb (Handle: 43) - Properties: [&#039;read&#039;, &#039;notify&#039;]&lt;br /&gt;
&lt;br /&gt;
=== Step 13 - Read data ===&lt;br /&gt;
&lt;br /&gt;
Now add a script for reading the actual data. Make sure to use the characteristics UUIDs you have found out.&lt;br /&gt;
&lt;br /&gt;
 nano BLE-scripts/ble_read.py&lt;br /&gt;
&lt;br /&gt;
 import asyncio&lt;br /&gt;
 from bleak import BleakClient&lt;br /&gt;
 device_uuid = &amp;quot;C6C36C4A-7F8F-52B2-2BD7-C4F6690424E7&amp;quot;&lt;br /&gt;
 HEART_RATE_CHAR_UUID = &amp;quot;00002a37-0000-1000-8000-00805f9b34fb&amp;quot;&lt;br /&gt;
 BATTERY_LEVEL_CHAR_UUID = &amp;quot;00002a19-0000-1000-8000-00805f9b34fb&amp;quot;&lt;br /&gt;
 async def connect_and_read_data(device_uuid):&lt;br /&gt;
     async with BleakClient(device_uuid) as client:&lt;br /&gt;
         connected = client.is_connected&lt;br /&gt;
         print(f&amp;quot;Connected: {connected}&amp;quot;)&lt;br /&gt;
         if connected:&lt;br /&gt;
             try:&lt;br /&gt;
                 heart_rate = await client.read_gatt_char(HEART_RATE_CHAR_UUID)&lt;br /&gt;
                 heart_rate = int(heart_rate_data[1])&lt;br /&gt;
                 print(f&amp;quot;Heart Rate: {heart_rate} bpm&amp;quot;)&lt;br /&gt;
             except Exception as e:&lt;br /&gt;
                 print(f&amp;quot;Failed to read heart rate: {e}&amp;quot;)&lt;br /&gt;
             try:&lt;br /&gt;
                 battery_level = await client.read_gatt_char(BATTERY_LEVEL_CHAR_UUID)&lt;br /&gt;
                 print(f&amp;quot;Battery Level: {int(battery_level[0])}%&amp;quot;)&lt;br /&gt;
             except Exception as e:&lt;br /&gt;
                 print(f&amp;quot;Failed to read battery level: {e}&amp;quot;)&lt;br /&gt;
 loop = asyncio.get_event_loop()&lt;br /&gt;
 loop.run_until_complete(connect_and_read_data(device_uuid))&lt;br /&gt;
&lt;br /&gt;
Run script:&lt;br /&gt;
&lt;br /&gt;
 python3 BLE-scripts/ble_read.py&lt;br /&gt;
&lt;br /&gt;
In the output the battery level was succesfully read and printed out. The heart rate couldn&#039;t be accessed because it only has the notify property and no option for reading:&lt;br /&gt;
&lt;br /&gt;
 Connected: True&lt;br /&gt;
 Failed to read heart rate: Failed to read characteristic 39: Error Domain=CBATTErrorDomain Code=2 &amp;quot;Reading is not permitted.&amp;quot; UserInfo={NSLocalizedDescription=Reading is not permitted.}&lt;br /&gt;
 Battery Level: 16%&lt;br /&gt;
&lt;br /&gt;
=== Step 14 - Subscribe to heart rate notifications ===&lt;br /&gt;
&lt;br /&gt;
 nano BLE-scripts/ble_subscribe.py&lt;br /&gt;
&lt;br /&gt;
 import asyncio&lt;br /&gt;
 from bleak import BleakClient&lt;br /&gt;
 device_uuid = &amp;quot;C6C36C4A-7F8F-52B2-2BD7-C4F6690424E7&amp;quot;&lt;br /&gt;
 HEART_RATE_CHAR_UUID = &amp;quot;00002a37-0000-1000-8000-00805f9b34fb&amp;quot;&lt;br /&gt;
 def heart_rate_handler(sender, data):&lt;br /&gt;
     heart_rate = int(data[1]) if len(data) &amp;gt; 1 else None&lt;br /&gt;
     print(f&amp;quot;Heart Rate from {sender}: {heart_rate} bpm&amp;quot;)&lt;br /&gt;
 async def connect_and_subscribe(device_uuid):&lt;br /&gt;
     async with BleakClient(device_uuid) as client:&lt;br /&gt;
         connected = client.is_connected&lt;br /&gt;
         print(f&amp;quot;Connected: {connected}&amp;quot;)&lt;br /&gt;
         if connected:&lt;br /&gt;
             try:&lt;br /&gt;
                 await client.start_notify(HEART_RATE_CHAR_UUID, heart_rate_handler)&lt;br /&gt;
                 print(&amp;quot;Subscribed to heart rate notifications.&amp;quot;)&lt;br /&gt;
                 await asyncio.sleep(60)&lt;br /&gt;
                 await client.stop_notify(HEART_RATE_CHAR_UUID)&lt;br /&gt;
                 print(&amp;quot;Stopped heart rate notifications.&amp;quot;)&lt;br /&gt;
             except Exception as e:&lt;br /&gt;
                 print(f&amp;quot;Failed to subscribe to heart rate notifications: {e}&amp;quot;)&lt;br /&gt;
 asyncio.run(connect_and_subscribe(device_uuid))&lt;br /&gt;
&lt;br /&gt;
 python3 BLE-scripts/ble_subscribe.py&lt;br /&gt;
&lt;br /&gt;
It was not possible to get the heart rate data even though the notify property was assigned. That is because typically battery status data is on a lower securiy level than heart rate data. More information on GATT can be found here: https://www.bluetooth.com/de/bluetooth-resources/intro-to-bluetooth-gap-gatt/&lt;br /&gt;
&lt;br /&gt;
This is the output of the failed try:&lt;br /&gt;
&lt;br /&gt;
 Connected: True&lt;br /&gt;
 Subscribed to heart rate notifications.&lt;br /&gt;
 Stopped heart rate notifications.&lt;br /&gt;
&lt;br /&gt;
== Used Hardware ==&lt;br /&gt;
&lt;br /&gt;
[[Ubertooth One, 2.4 GHz wireless development platform]]&lt;br /&gt;
&lt;br /&gt;
[[Polar Vantage M]]&lt;br /&gt;
&lt;br /&gt;
[[Apple iPhone 13 mini]]&lt;br /&gt;
&lt;br /&gt;
[[MacBook Air M1, 2020]]&lt;br /&gt;
&lt;br /&gt;
[[Samsung Galaxy J3]]&lt;br /&gt;
&lt;br /&gt;
== Courses ==&lt;br /&gt;
&lt;br /&gt;
* [[Selected IT-Security Chapters]] (2024)&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
* https://ubertooth.readthedocs.io/en/latest/&lt;br /&gt;
* https://www.greatscottgadgets.com/ubertoothone/&lt;br /&gt;
* https://codemuch.net/posts/bluetooth-hacking/&lt;br /&gt;
* https://bleak.readthedocs.io/en/latest/usage.html&lt;br /&gt;
* https://www.bluetooth.com/de/bluetooth-resources/intro-to-bluetooth-gap-gatt/&lt;br /&gt;
* https://support.polar.com/en/vantage-m#all&lt;br /&gt;
&lt;br /&gt;
[[Category:Documentation]]&lt;/div&gt;</summary>
		<author><name>AMaksimovic</name></author>
	</entry>
	<entry>
		<id>https://elvis.hcw.ac.at/wiki/index.php?title=Setting_Up_Ubertooth_on_macOS_for_Bluetooth_Hacking&amp;diff=16684</id>
		<title>Setting Up Ubertooth on macOS for Bluetooth Hacking</title>
		<link rel="alternate" type="text/html" href="https://elvis.hcw.ac.at/wiki/index.php?title=Setting_Up_Ubertooth_on_macOS_for_Bluetooth_Hacking&amp;diff=16684"/>
		<updated>2024-12-05T00:59:37Z</updated>

		<summary type="html">&lt;p&gt;AMaksimovic: /* Step 9 - Install bleak library */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Summary == &lt;br /&gt;
&lt;br /&gt;
This is a step-by-step guide on how to sniff Bluetooth Low Energy (BLE) packets between a Polar Vantage Smartwatch and a phone using the Ubertooth One. It will go into detail on the setup on a MacBook Air with MacOS using a python environment for the libraries that are used for the setup. Additionally every step of the actual sniff will be outlined. This guide is based on the seminar paper &amp;quot;Smartwatch Hacking Attack&amp;quot; that was written within the FH-course &amp;quot;Selected IT-Security Chapters&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
== Requirements ==&lt;br /&gt;
&lt;br /&gt;
* Hardware tools: Ubertooth One: Firmware version: 2020-12-R1 (API:1.07)&lt;br /&gt;
* Unix-based Operating System: macOS (macOS Sequoia 15.1.1), on a MacBook Air with an Apple M1 chip.&lt;br /&gt;
* Virtual Environment: Python Environment: Python 3.12&lt;br /&gt;
* Packages: libusb, wget, cmake, pkg-config, setuptools, pyqt5, numpy&lt;br /&gt;
* Libraries: libbtbb, bleak&lt;br /&gt;
* Software Tools: Crackle&lt;br /&gt;
&lt;br /&gt;
For the setup this guide was used and adjusted to the given scenario. [[Ubertooth - Build Guide - https://ubertooth.readthedocs.io/en/latest/build_guide.html]].&lt;br /&gt;
&lt;br /&gt;
== Description ==&lt;br /&gt;
&lt;br /&gt;
=== Step 1 - Install homebrew ===&lt;br /&gt;
&lt;br /&gt;
Enter these commands in the shell&lt;br /&gt;
&lt;br /&gt;
 /bin/bash -c &amp;quot;$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)&amp;quot;&lt;br /&gt;
 eval &amp;quot;$(/opt/homebrew/bin/brew shellenv)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
=== Step 2 - Install Python Environment ===&lt;br /&gt;
&lt;br /&gt;
Enter these commands in the shell&lt;br /&gt;
&lt;br /&gt;
 python3.12 -m venv myenv&lt;br /&gt;
 source myenv/bin/activate&lt;br /&gt;
&lt;br /&gt;
=== Step 3 - Install libusb, wget, cmake, pkg-config ===&lt;br /&gt;
&lt;br /&gt;
Enter these commands in the shell&lt;br /&gt;
&lt;br /&gt;
 brew install libusb wget cmake pkg-config&lt;br /&gt;
&lt;br /&gt;
=== Step 4 - Install the Bluetooth baseband library ===&lt;br /&gt;
&lt;br /&gt;
Enter these commands in the shell&lt;br /&gt;
&lt;br /&gt;
 wget https://github.com/greatscottgadgets/libbtbb/archive/2020-12-R1.tar.gz -O libbtbb-2020-12-R1.tar.gz&lt;br /&gt;
 tar -xf libbtbb-2020-12-R1.tar.gz&lt;br /&gt;
 cd libbtbb-2020-12-R1&lt;br /&gt;
 mkdir build&lt;br /&gt;
 cd build&lt;br /&gt;
 cmake ..&lt;br /&gt;
 make&lt;br /&gt;
&lt;br /&gt;
If errors occur with installing distutils switch to setuptools instead.&lt;br /&gt;
&lt;br /&gt;
 pip install setuptools&lt;br /&gt;
&lt;br /&gt;
After installing the setuptools also change the &amp;quot;from distutils import setup&amp;quot; line in the the libbtbb-2020-12-R1/build/python/pcaptools/setup.py file to this:&lt;br /&gt;
&lt;br /&gt;
 from setuptools import setup&lt;br /&gt;
&lt;br /&gt;
Also update the version in that same file to this:&lt;br /&gt;
&lt;br /&gt;
 version = &#039;2020.12.R1&#039;&lt;br /&gt;
&lt;br /&gt;
If necessary set the pythonpath in case you have different python versions:&lt;br /&gt;
 &lt;br /&gt;
 export PYTHONPATH=/Users/&amp;lt;username&amp;gt;/myenv/lib/python3.12/site-packages:$PYTHONPATH&lt;br /&gt;
&lt;br /&gt;
Then retry:&lt;br /&gt;
&lt;br /&gt;
 make&lt;br /&gt;
&lt;br /&gt;
 sudo make install&lt;br /&gt;
&lt;br /&gt;
=== Step 5 - Install the Ubertooth repository ===&lt;br /&gt;
&lt;br /&gt;
Enter these commands in the shell&lt;br /&gt;
&lt;br /&gt;
 wget https://github.com/greatscottgadgets/ubertooth/releases/download/2020-12-R1/ubertooth-2020-12-R1.tar.xz&lt;br /&gt;
 tar -xf ubertooth-2020-12-R1.tar.xz&lt;br /&gt;
 cd ubertooth-2020-12-R1/host&lt;br /&gt;
 mkdir build&lt;br /&gt;
 cd build&lt;br /&gt;
 cmake ..&lt;br /&gt;
 make&lt;br /&gt;
&lt;br /&gt;
If libusb module not found errors occur go to ubertooth-2020-12-R1/host/CMakeLists.txt an add your libusb-path manually:&lt;br /&gt;
&lt;br /&gt;
 include_directories(/opt/homebrew/include)&lt;br /&gt;
 link_directories(/opt/homebrew/lib)&lt;br /&gt;
&lt;br /&gt;
Additionally again change the &amp;quot;from distutils import setup&amp;quot; line in the the ubertooth-2020-12-R1/host/build/python/specan_ui/setup.py file to this:&lt;br /&gt;
&lt;br /&gt;
 from setuptools import setup&lt;br /&gt;
&lt;br /&gt;
Also update the version in that same file to this:&lt;br /&gt;
&lt;br /&gt;
 version = &#039;2020.12.R1&#039;&lt;br /&gt;
&lt;br /&gt;
Then retry:&lt;br /&gt;
&lt;br /&gt;
 make&lt;br /&gt;
&lt;br /&gt;
 sudo make install&lt;br /&gt;
&lt;br /&gt;
If you get errors regarding the environment variables showing that your library wasnt found you need to set the library path via the MacOs&#039;s dynamic linker.&lt;br /&gt;
&lt;br /&gt;
 export DYLD_LIBRARY_PATH=&amp;quot;/usr/local/lib:$DYLD_LIBRARY_PATH&amp;quot;&lt;br /&gt;
&lt;br /&gt;
or make it persistent in shell configurations: &lt;br /&gt;
&lt;br /&gt;
 ~/.zshrc&lt;br /&gt;
&lt;br /&gt;
Afterwards confirm the ubertooth library is working correctly:&lt;br /&gt;
&lt;br /&gt;
 ubertooth-util&lt;br /&gt;
&lt;br /&gt;
=== Step 6 - Test Ubertooth One commands ===&lt;br /&gt;
&lt;br /&gt;
Test these commands:&lt;br /&gt;
&lt;br /&gt;
 ubertooth-util -H&lt;br /&gt;
 ubertooth-util -v&lt;br /&gt;
 ubertooth-util -p&lt;br /&gt;
 ubertooth-util -s&lt;br /&gt;
&lt;br /&gt;
Update Ubertooth firmware in ubertooth-2020-12-R1/ubertooth-one-firmware-bin:&lt;br /&gt;
&lt;br /&gt;
 sudo ubertooth-dfu -d bluetooth_rxtx.dfu -r&lt;br /&gt;
&lt;br /&gt;
In case the libubertooth library is not loading check if the paths are correct.&lt;br /&gt;
&lt;br /&gt;
In ubertooth-2020-12-R1/host the following command leads to getting a list of sniffed Bluetooth packets with their Lower Address Parts (LAP):&lt;br /&gt;
&lt;br /&gt;
 ubertooth-rx&lt;br /&gt;
&lt;br /&gt;
For collecting Upper Address Parts (UAP) from the captured packets add -z:&lt;br /&gt;
&lt;br /&gt;
 ubertooth-rx -z&lt;br /&gt;
&lt;br /&gt;
Let it run for a while and look at the output. It will be summarized as Survey Results at the end of the output. There you can see the significant part of Bluetooth addresses of devices that were scanned. &lt;br /&gt;
&lt;br /&gt;
=== Step 7 - Use BTLE to follow the connection of the Bluetooth device you found. (Replace with device Bluetooth Address) ===&lt;br /&gt;
&lt;br /&gt;
 ubertooth-btle -f B0:67:B5:CF:E5:10 -r test.pcap&lt;br /&gt;
&lt;br /&gt;
Or create a pipe for viewing the captures directly in Wireshark:&lt;br /&gt;
&lt;br /&gt;
 mkfifo /tmp/pipe&lt;br /&gt;
 ubertooth-btle -f B0:67:B5:CF:E5:10 -c /tmp/pipe&lt;br /&gt;
&lt;br /&gt;
Find packages that involve the Polar Smartwatch&lt;br /&gt;
&lt;br /&gt;
 systime=1728247529 freq=2402 addr=8e89bed6 delta_t=34.320 ms rssi=-60&lt;br /&gt;
 20 1b c9 28 84 1a 9e a0 02 01 06 03 02 ee fe 0d ff 6b 00 72 08 00 00 00 00 00 00 00 00 47 e9 1f &lt;br /&gt;
 Advertising / AA 8e89bed6 (valid)/ 27 bytes&lt;br /&gt;
     Channel Index: 37&lt;br /&gt;
     Type:  ADV_IND&lt;br /&gt;
     AdvA:  a0:9e:1a:84:28:c9 (public)&lt;br /&gt;
     AdvData: 02 01 06 03 02 ee fe 0d ff 6b 00 72 08 00 00 00 00 00 00 00 00&lt;br /&gt;
         Type 01 (Flags)&lt;br /&gt;
            00000110&lt;br /&gt;
                LE General Discoverable Mode&lt;br /&gt;
                BR/EDR Not Supported&lt;br /&gt;
         Type 02 (16-bit Service UUIDs, more available)&lt;br /&gt;
            feee&lt;br /&gt;
         Type ff (Manufacturer Specific Data)&lt;br /&gt;
            Company: Polar Electro OY&lt;br /&gt;
            Data: 72 08 00 00 00 00 00 00 00 00&lt;br /&gt;
     Data:  c9 28 84 1a 9e a0 02 01 06 03 02 ee fe 0d ff 6b 00 72 08 00 00 00 00 00 00 00 00&lt;br /&gt;
     CRC:   47 e9 1f&lt;br /&gt;
&lt;br /&gt;
=== Step 8 - Use Crackle to crack packages ===&lt;br /&gt;
&lt;br /&gt;
Enter these commands:&lt;br /&gt;
&lt;br /&gt;
 git clone https://github.com/mikeryan/crackle.git&lt;br /&gt;
 cd crackle&lt;br /&gt;
 make&lt;br /&gt;
&lt;br /&gt;
Now try cracking your pcap.file&lt;br /&gt;
&lt;br /&gt;
 ./crackle -i &amp;lt;your_file.pcap&amp;gt; -o &amp;lt;your_new_output_file.pcap&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this case it wasnt possible to crack any packages from the smartwatch.&lt;br /&gt;
&lt;br /&gt;
=== Step 9 - Install bleak library ===&lt;br /&gt;
&lt;br /&gt;
 pip install bleak&lt;br /&gt;
&lt;br /&gt;
More information can be found in the bleak library documentation. (https://bleak.readthedocs.io/en/latest/usage.html) It also includes sample scripts which were used in the following setup.&lt;br /&gt;
&lt;br /&gt;
=== Step 10 - Write python script for reading device UUID ===&lt;br /&gt;
&lt;br /&gt;
Enter these commands in the shell&lt;br /&gt;
&lt;br /&gt;
 mkdir BLE-scripts&lt;br /&gt;
 cd BLE-scripts&lt;br /&gt;
 nano ble_scan.py&lt;br /&gt;
&lt;br /&gt;
Write simple script to read device UUID using BleakScaner.discover() method:&lt;br /&gt;
 &lt;br /&gt;
 import asyncio&lt;br /&gt;
 from bleak import BleakScanner&lt;br /&gt;
 async def scan():&lt;br /&gt;
     devices = await BleakScanner.discover()&lt;br /&gt;
     for d in devices:&lt;br /&gt;
         print(d)&lt;br /&gt;
 asyncio.run(scan())&lt;br /&gt;
&lt;br /&gt;
Run a scan:&lt;br /&gt;
&lt;br /&gt;
 python3 BLE-scripts/ble_scan.py&lt;br /&gt;
&lt;br /&gt;
Here the device UUID of the Polar smartwatch was found:&lt;br /&gt;
&lt;br /&gt;
 C6C36C4A-7F8F-52B2-2BD7-C4F6690424E7: Polar Vantage M 8428C92D&lt;br /&gt;
&lt;br /&gt;
=== Step 11 - Check GATT services  ===&lt;br /&gt;
&lt;br /&gt;
With the gathered device UUID check for the devices services:&lt;br /&gt;
&lt;br /&gt;
 nano BLE-scripts/ble_services.py&lt;br /&gt;
&lt;br /&gt;
 import asyncio&lt;br /&gt;
 from bleak import BleakClient&lt;br /&gt;
 device_uuid = &amp;quot;C6C36C4A-7F8F-52B2-2BD7-C4F6690424E7&amp;quot;&lt;br /&gt;
 async def connect_to_device(device_uuid):&lt;br /&gt;
     async with BleakClient(device_uuid) as client:&lt;br /&gt;
         connected = client.is_connected&lt;br /&gt;
         print(f&amp;quot;Connected: {connected}&amp;quot;)&lt;br /&gt;
         services = client.services&lt;br /&gt;
         if services is None:&lt;br /&gt;
             await client.get_services()&lt;br /&gt;
         for service in services:&lt;br /&gt;
             print(f&amp;quot;Service: {service}&amp;quot;)&lt;br /&gt;
 loop = asyncio.get_event_loop()&lt;br /&gt;
 loop.run_until_complete(connect_to_device(device_uuid))&lt;br /&gt;
&lt;br /&gt;
Run a services scan:&lt;br /&gt;
&lt;br /&gt;
 python3 BLE-scripts/ble_services.py&lt;br /&gt;
&lt;br /&gt;
Now the service UUIDs that were found are going to be listed like this:&lt;br /&gt;
&lt;br /&gt;
 Service: 0000180a-0000-1000-8000-00805f9b34fb (Handle: 14): Device Information&lt;br /&gt;
 Service: 0000feee-0000-1000-8000-00805f9b34fb (Handle: 29): Polar Electro Oy&lt;br /&gt;
 Service: 0000180d-0000-1000-8000-00805f9b34fb (Handle: 38): Heart Rate&lt;br /&gt;
 Service: 0000180f-0000-1000-8000-00805f9b34fb (Handle: 42): Battery Service&lt;br /&gt;
&lt;br /&gt;
=== Step 12 - Get characteristics UUIDs  ===&lt;br /&gt;
&lt;br /&gt;
 nano BLE-scripts/ble_characteristics.py&lt;br /&gt;
&lt;br /&gt;
 import asyncio&lt;br /&gt;
 from bleak import BleakClient&lt;br /&gt;
 device_uuid = &amp;quot;C6C36C4A-7F8F-52B2-2BD7-C4F6690424E7&amp;quot;&lt;br /&gt;
 async def connect_to_device(device_uuid):&lt;br /&gt;
     async with BleakClient(device_uuid) as client:&lt;br /&gt;
         connected = client.is_connected&lt;br /&gt;
         print(f&amp;quot;Connected: {connected}&amp;quot;)&lt;br /&gt;
         services = client.services&lt;br /&gt;
         if services is None:&lt;br /&gt;
             await client.get_services()&lt;br /&gt;
         for service in services:&lt;br /&gt;
             print(f&amp;quot;Service: {service.uuid} (Handle: {service.handle}): {service.description}&amp;quot;)&lt;br /&gt;
             for characteristic in service.characteristics:&lt;br /&gt;
                 print(f&amp;quot;  Characteristic: {characteristic.uuid} (Handle: {characteristic.handle}) - Properties: {cha$&lt;br /&gt;
 loop = asyncio.get_event_loop()&lt;br /&gt;
 loop.run_until_complete(connect_to_device(device_uuid))&lt;br /&gt;
&lt;br /&gt;
Now run the script:&lt;br /&gt;
&lt;br /&gt;
 python3 BLE-scripts/ble_characteristics.py&lt;br /&gt;
&lt;br /&gt;
Expected output:&lt;br /&gt;
&lt;br /&gt;
 Service: 0000180a-0000-1000-8000-00805f9b34fb (Handle: 14): Device Information&lt;br /&gt;
  Characteristic: 00002a29-0000-1000-8000-00805f9b34fb (Handle: 15) - Properties: [&#039;read&#039;]&lt;br /&gt;
  Characteristic: 00002a24-0000-1000-8000-00805f9b34fb (Handle: 17) - Properties: [&#039;read&#039;]&lt;br /&gt;
  Characteristic: 00002a25-0000-1000-8000-00805f9b34fb (Handle: 19) - Properties: [&#039;read&#039;]&lt;br /&gt;
  Characteristic: 00002a27-0000-1000-8000-00805f9b34fb (Handle: 21) - Properties: [&#039;read&#039;]&lt;br /&gt;
  Characteristic: 00002a26-0000-1000-8000-00805f9b34fb (Handle: 23) - Properties: [&#039;read&#039;]&lt;br /&gt;
  Characteristic: 00002a28-0000-1000-8000-00805f9b34fb (Handle: 25) - Properties: [&#039;read&#039;]&lt;br /&gt;
  Characteristic: 00002a23-0000-1000-8000-00805f9b34fb (Handle: 27) - Properties: [&#039;read&#039;]&lt;br /&gt;
 Service: 0000feee-0000-1000-8000-00805f9b34fb (Handle: 29): Polar Electro Oy&lt;br /&gt;
  Characteristic: fb005c51-02e7-f387-1cad-8acd2d8df0c8 (Handle: 30) - Properties: [&#039;write-without-response&#039;, &#039;write&#039;, &#039;notify&#039;]&lt;br /&gt;
  Characteristic: fb005c52-02e7-f387-1cad-8acd2d8df0c8 (Handle: 33) - Properties: [&#039;notify&#039;]&lt;br /&gt;
  Characteristic: fb005c53-02e7-f387-1cad-8acd2d8df0c8 (Handle: 36) - Properties: [&#039;write-without-response&#039;, &#039;write&#039;]&lt;br /&gt;
 Service: 0000180d-0000-1000-8000-00805f9b34fb (Handle: 38): Heart Rate&lt;br /&gt;
  Characteristic: 00002a37-0000-1000-8000-00805f9b34fb (Handle: 39) - Properties: [&#039;notify&#039;]&lt;br /&gt;
 Service: 0000180f-0000-1000-8000-00805f9b34fb (Handle: 42): Battery Service&lt;br /&gt;
  Characteristic: 00002a19-0000-1000-8000-00805f9b34fb (Handle: 43) - Properties: [&#039;read&#039;, &#039;notify&#039;]&lt;br /&gt;
&lt;br /&gt;
=== Step 13 - Read data ===&lt;br /&gt;
&lt;br /&gt;
Now add a script for reading the actual data. Make sure to use the characteristics UUIDs you have found out.&lt;br /&gt;
&lt;br /&gt;
 nano BLE-scripts/ble_read.py&lt;br /&gt;
&lt;br /&gt;
 import asyncio&lt;br /&gt;
 from bleak import BleakClient&lt;br /&gt;
 device_uuid = &amp;quot;C6C36C4A-7F8F-52B2-2BD7-C4F6690424E7&amp;quot;&lt;br /&gt;
 HEART_RATE_CHAR_UUID = &amp;quot;00002a37-0000-1000-8000-00805f9b34fb&amp;quot;&lt;br /&gt;
 BATTERY_LEVEL_CHAR_UUID = &amp;quot;00002a19-0000-1000-8000-00805f9b34fb&amp;quot;&lt;br /&gt;
 async def connect_and_read_data(device_uuid):&lt;br /&gt;
     async with BleakClient(device_uuid) as client:&lt;br /&gt;
         connected = client.is_connected&lt;br /&gt;
         print(f&amp;quot;Connected: {connected}&amp;quot;)&lt;br /&gt;
         if connected:&lt;br /&gt;
             try:&lt;br /&gt;
                 heart_rate = await client.read_gatt_char(HEART_RATE_CHAR_UUID)&lt;br /&gt;
                 heart_rate = int(heart_rate_data[1])&lt;br /&gt;
                 print(f&amp;quot;Heart Rate: {heart_rate} bpm&amp;quot;)&lt;br /&gt;
             except Exception as e:&lt;br /&gt;
                 print(f&amp;quot;Failed to read heart rate: {e}&amp;quot;)&lt;br /&gt;
             try:&lt;br /&gt;
                 battery_level = await client.read_gatt_char(BATTERY_LEVEL_CHAR_UUID)&lt;br /&gt;
                 print(f&amp;quot;Battery Level: {int(battery_level[0])}%&amp;quot;)&lt;br /&gt;
             except Exception as e:&lt;br /&gt;
                 print(f&amp;quot;Failed to read battery level: {e}&amp;quot;)&lt;br /&gt;
 loop = asyncio.get_event_loop()&lt;br /&gt;
 loop.run_until_complete(connect_and_read_data(device_uuid))&lt;br /&gt;
&lt;br /&gt;
Run script:&lt;br /&gt;
&lt;br /&gt;
 python3 BLE-scripts/ble_read.py&lt;br /&gt;
&lt;br /&gt;
In the output the battery level was succesfully read and printed out. The heart rate couldn&#039;t be accessed because it only has the notify property and no option for reading:&lt;br /&gt;
&lt;br /&gt;
 Connected: True&lt;br /&gt;
 Failed to read heart rate: Failed to read characteristic 39: Error Domain=CBATTErrorDomain Code=2 &amp;quot;Reading is not permitted.&amp;quot; UserInfo={NSLocalizedDescription=Reading is not permitted.}&lt;br /&gt;
 Battery Level: 16%&lt;br /&gt;
&lt;br /&gt;
=== Step 14 - Subscribe to heart rate notifications ===&lt;br /&gt;
&lt;br /&gt;
 nano BLE-scripts/ble_subscribe.py&lt;br /&gt;
&lt;br /&gt;
 import asyncio&lt;br /&gt;
 from bleak import BleakClient&lt;br /&gt;
 device_uuid = &amp;quot;C6C36C4A-7F8F-52B2-2BD7-C4F6690424E7&amp;quot;&lt;br /&gt;
 HEART_RATE_CHAR_UUID = &amp;quot;00002a37-0000-1000-8000-00805f9b34fb&amp;quot;&lt;br /&gt;
 def heart_rate_handler(sender, data):&lt;br /&gt;
     heart_rate = int(data[1]) if len(data) &amp;gt; 1 else None&lt;br /&gt;
     print(f&amp;quot;Heart Rate from {sender}: {heart_rate} bpm&amp;quot;)&lt;br /&gt;
 async def connect_and_subscribe(device_uuid):&lt;br /&gt;
     async with BleakClient(device_uuid) as client:&lt;br /&gt;
         connected = client.is_connected&lt;br /&gt;
         print(f&amp;quot;Connected: {connected}&amp;quot;)&lt;br /&gt;
         if connected:&lt;br /&gt;
             try:&lt;br /&gt;
                 await client.start_notify(HEART_RATE_CHAR_UUID, heart_rate_handler)&lt;br /&gt;
                 print(&amp;quot;Subscribed to heart rate notifications.&amp;quot;)&lt;br /&gt;
                 await asyncio.sleep(60)&lt;br /&gt;
                 await client.stop_notify(HEART_RATE_CHAR_UUID)&lt;br /&gt;
                 print(&amp;quot;Stopped heart rate notifications.&amp;quot;)&lt;br /&gt;
             except Exception as e:&lt;br /&gt;
                 print(f&amp;quot;Failed to subscribe to heart rate notifications: {e}&amp;quot;)&lt;br /&gt;
 asyncio.run(connect_and_subscribe(device_uuid))&lt;br /&gt;
&lt;br /&gt;
 python3 BLE-scripts/ble_subscribe.py&lt;br /&gt;
&lt;br /&gt;
It was not possible to get the heart rate data even though the notify property was assigned. That is because typically battery status data is on a lower securiy level than heart rate data. This is the output of the failed try:&lt;br /&gt;
&lt;br /&gt;
 Connected: True&lt;br /&gt;
 Subscribed to heart rate notifications.&lt;br /&gt;
 Stopped heart rate notifications.&lt;br /&gt;
&lt;br /&gt;
== Used Hardware ==&lt;br /&gt;
&lt;br /&gt;
[[Ubertooth One, 2.4 GHz wireless development platform]]&lt;br /&gt;
&lt;br /&gt;
[[Polar Vantage M]]&lt;br /&gt;
&lt;br /&gt;
[[Apple iPhone 13 mini]]&lt;br /&gt;
&lt;br /&gt;
[[MacBook Air M1, 2020]]&lt;br /&gt;
&lt;br /&gt;
[[Samsung Galaxy J3]]&lt;br /&gt;
&lt;br /&gt;
== Courses ==&lt;br /&gt;
&lt;br /&gt;
* [[Selected IT-Security Chapters]] (2024)&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
* https://ubertooth.readthedocs.io/en/latest/&lt;br /&gt;
* https://www.greatscottgadgets.com/ubertoothone/&lt;br /&gt;
* https://codemuch.net/posts/bluetooth-hacking/&lt;br /&gt;
* https://bleak.readthedocs.io/en/latest/usage.html&lt;br /&gt;
* https://www.bluetooth.com/de/bluetooth-resources/intro-to-bluetooth-gap-gatt/&lt;br /&gt;
* https://support.polar.com/en/vantage-m#all&lt;br /&gt;
&lt;br /&gt;
[[Category:Documentation]]&lt;/div&gt;</summary>
		<author><name>AMaksimovic</name></author>
	</entry>
	<entry>
		<id>https://elvis.hcw.ac.at/wiki/index.php?title=Setting_Up_Ubertooth_on_macOS_for_Bluetooth_Hacking&amp;diff=16683</id>
		<title>Setting Up Ubertooth on macOS for Bluetooth Hacking</title>
		<link rel="alternate" type="text/html" href="https://elvis.hcw.ac.at/wiki/index.php?title=Setting_Up_Ubertooth_on_macOS_for_Bluetooth_Hacking&amp;diff=16683"/>
		<updated>2024-12-05T00:57:34Z</updated>

		<summary type="html">&lt;p&gt;AMaksimovic: /* References */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Summary == &lt;br /&gt;
&lt;br /&gt;
This is a step-by-step guide on how to sniff Bluetooth Low Energy (BLE) packets between a Polar Vantage Smartwatch and a phone using the Ubertooth One. It will go into detail on the setup on a MacBook Air with MacOS using a python environment for the libraries that are used for the setup. Additionally every step of the actual sniff will be outlined. This guide is based on the seminar paper &amp;quot;Smartwatch Hacking Attack&amp;quot; that was written within the FH-course &amp;quot;Selected IT-Security Chapters&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
== Requirements ==&lt;br /&gt;
&lt;br /&gt;
* Hardware tools: Ubertooth One: Firmware version: 2020-12-R1 (API:1.07)&lt;br /&gt;
* Unix-based Operating System: macOS (macOS Sequoia 15.1.1), on a MacBook Air with an Apple M1 chip.&lt;br /&gt;
* Virtual Environment: Python Environment: Python 3.12&lt;br /&gt;
* Packages: libusb, wget, cmake, pkg-config, setuptools, pyqt5, numpy&lt;br /&gt;
* Libraries: libbtbb, bleak&lt;br /&gt;
* Software Tools: Crackle&lt;br /&gt;
&lt;br /&gt;
For the setup this guide was used and adjusted to the given scenario. [[Ubertooth - Build Guide - https://ubertooth.readthedocs.io/en/latest/build_guide.html]].&lt;br /&gt;
&lt;br /&gt;
== Description ==&lt;br /&gt;
&lt;br /&gt;
=== Step 1 - Install homebrew ===&lt;br /&gt;
&lt;br /&gt;
Enter these commands in the shell&lt;br /&gt;
&lt;br /&gt;
 /bin/bash -c &amp;quot;$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)&amp;quot;&lt;br /&gt;
 eval &amp;quot;$(/opt/homebrew/bin/brew shellenv)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
=== Step 2 - Install Python Environment ===&lt;br /&gt;
&lt;br /&gt;
Enter these commands in the shell&lt;br /&gt;
&lt;br /&gt;
 python3.12 -m venv myenv&lt;br /&gt;
 source myenv/bin/activate&lt;br /&gt;
&lt;br /&gt;
=== Step 3 - Install libusb, wget, cmake, pkg-config ===&lt;br /&gt;
&lt;br /&gt;
Enter these commands in the shell&lt;br /&gt;
&lt;br /&gt;
 brew install libusb wget cmake pkg-config&lt;br /&gt;
&lt;br /&gt;
=== Step 4 - Install the Bluetooth baseband library ===&lt;br /&gt;
&lt;br /&gt;
Enter these commands in the shell&lt;br /&gt;
&lt;br /&gt;
 wget https://github.com/greatscottgadgets/libbtbb/archive/2020-12-R1.tar.gz -O libbtbb-2020-12-R1.tar.gz&lt;br /&gt;
 tar -xf libbtbb-2020-12-R1.tar.gz&lt;br /&gt;
 cd libbtbb-2020-12-R1&lt;br /&gt;
 mkdir build&lt;br /&gt;
 cd build&lt;br /&gt;
 cmake ..&lt;br /&gt;
 make&lt;br /&gt;
&lt;br /&gt;
If errors occur with installing distutils switch to setuptools instead.&lt;br /&gt;
&lt;br /&gt;
 pip install setuptools&lt;br /&gt;
&lt;br /&gt;
After installing the setuptools also change the &amp;quot;from distutils import setup&amp;quot; line in the the libbtbb-2020-12-R1/build/python/pcaptools/setup.py file to this:&lt;br /&gt;
&lt;br /&gt;
 from setuptools import setup&lt;br /&gt;
&lt;br /&gt;
Also update the version in that same file to this:&lt;br /&gt;
&lt;br /&gt;
 version = &#039;2020.12.R1&#039;&lt;br /&gt;
&lt;br /&gt;
If necessary set the pythonpath in case you have different python versions:&lt;br /&gt;
 &lt;br /&gt;
 export PYTHONPATH=/Users/&amp;lt;username&amp;gt;/myenv/lib/python3.12/site-packages:$PYTHONPATH&lt;br /&gt;
&lt;br /&gt;
Then retry:&lt;br /&gt;
&lt;br /&gt;
 make&lt;br /&gt;
&lt;br /&gt;
 sudo make install&lt;br /&gt;
&lt;br /&gt;
=== Step 5 - Install the Ubertooth repository ===&lt;br /&gt;
&lt;br /&gt;
Enter these commands in the shell&lt;br /&gt;
&lt;br /&gt;
 wget https://github.com/greatscottgadgets/ubertooth/releases/download/2020-12-R1/ubertooth-2020-12-R1.tar.xz&lt;br /&gt;
 tar -xf ubertooth-2020-12-R1.tar.xz&lt;br /&gt;
 cd ubertooth-2020-12-R1/host&lt;br /&gt;
 mkdir build&lt;br /&gt;
 cd build&lt;br /&gt;
 cmake ..&lt;br /&gt;
 make&lt;br /&gt;
&lt;br /&gt;
If libusb module not found errors occur go to ubertooth-2020-12-R1/host/CMakeLists.txt an add your libusb-path manually:&lt;br /&gt;
&lt;br /&gt;
 include_directories(/opt/homebrew/include)&lt;br /&gt;
 link_directories(/opt/homebrew/lib)&lt;br /&gt;
&lt;br /&gt;
Additionally again change the &amp;quot;from distutils import setup&amp;quot; line in the the ubertooth-2020-12-R1/host/build/python/specan_ui/setup.py file to this:&lt;br /&gt;
&lt;br /&gt;
 from setuptools import setup&lt;br /&gt;
&lt;br /&gt;
Also update the version in that same file to this:&lt;br /&gt;
&lt;br /&gt;
 version = &#039;2020.12.R1&#039;&lt;br /&gt;
&lt;br /&gt;
Then retry:&lt;br /&gt;
&lt;br /&gt;
 make&lt;br /&gt;
&lt;br /&gt;
 sudo make install&lt;br /&gt;
&lt;br /&gt;
If you get errors regarding the environment variables showing that your library wasnt found you need to set the library path via the MacOs&#039;s dynamic linker.&lt;br /&gt;
&lt;br /&gt;
 export DYLD_LIBRARY_PATH=&amp;quot;/usr/local/lib:$DYLD_LIBRARY_PATH&amp;quot;&lt;br /&gt;
&lt;br /&gt;
or make it persistent in shell configurations: &lt;br /&gt;
&lt;br /&gt;
 ~/.zshrc&lt;br /&gt;
&lt;br /&gt;
Afterwards confirm the ubertooth library is working correctly:&lt;br /&gt;
&lt;br /&gt;
 ubertooth-util&lt;br /&gt;
&lt;br /&gt;
=== Step 6 - Test Ubertooth One commands ===&lt;br /&gt;
&lt;br /&gt;
Test these commands:&lt;br /&gt;
&lt;br /&gt;
 ubertooth-util -H&lt;br /&gt;
 ubertooth-util -v&lt;br /&gt;
 ubertooth-util -p&lt;br /&gt;
 ubertooth-util -s&lt;br /&gt;
&lt;br /&gt;
Update Ubertooth firmware in ubertooth-2020-12-R1/ubertooth-one-firmware-bin:&lt;br /&gt;
&lt;br /&gt;
 sudo ubertooth-dfu -d bluetooth_rxtx.dfu -r&lt;br /&gt;
&lt;br /&gt;
In case the libubertooth library is not loading check if the paths are correct.&lt;br /&gt;
&lt;br /&gt;
In ubertooth-2020-12-R1/host the following command leads to getting a list of sniffed Bluetooth packets with their Lower Address Parts (LAP):&lt;br /&gt;
&lt;br /&gt;
 ubertooth-rx&lt;br /&gt;
&lt;br /&gt;
For collecting Upper Address Parts (UAP) from the captured packets add -z:&lt;br /&gt;
&lt;br /&gt;
 ubertooth-rx -z&lt;br /&gt;
&lt;br /&gt;
Let it run for a while and look at the output. It will be summarized as Survey Results at the end of the output. There you can see the significant part of Bluetooth addresses of devices that were scanned. &lt;br /&gt;
&lt;br /&gt;
=== Step 7 - Use BTLE to follow the connection of the Bluetooth device you found. (Replace with device Bluetooth Address) ===&lt;br /&gt;
&lt;br /&gt;
 ubertooth-btle -f B0:67:B5:CF:E5:10 -r test.pcap&lt;br /&gt;
&lt;br /&gt;
Or create a pipe for viewing the captures directly in Wireshark:&lt;br /&gt;
&lt;br /&gt;
 mkfifo /tmp/pipe&lt;br /&gt;
 ubertooth-btle -f B0:67:B5:CF:E5:10 -c /tmp/pipe&lt;br /&gt;
&lt;br /&gt;
Find packages that involve the Polar Smartwatch&lt;br /&gt;
&lt;br /&gt;
 systime=1728247529 freq=2402 addr=8e89bed6 delta_t=34.320 ms rssi=-60&lt;br /&gt;
 20 1b c9 28 84 1a 9e a0 02 01 06 03 02 ee fe 0d ff 6b 00 72 08 00 00 00 00 00 00 00 00 47 e9 1f &lt;br /&gt;
 Advertising / AA 8e89bed6 (valid)/ 27 bytes&lt;br /&gt;
     Channel Index: 37&lt;br /&gt;
     Type:  ADV_IND&lt;br /&gt;
     AdvA:  a0:9e:1a:84:28:c9 (public)&lt;br /&gt;
     AdvData: 02 01 06 03 02 ee fe 0d ff 6b 00 72 08 00 00 00 00 00 00 00 00&lt;br /&gt;
         Type 01 (Flags)&lt;br /&gt;
            00000110&lt;br /&gt;
                LE General Discoverable Mode&lt;br /&gt;
                BR/EDR Not Supported&lt;br /&gt;
         Type 02 (16-bit Service UUIDs, more available)&lt;br /&gt;
            feee&lt;br /&gt;
         Type ff (Manufacturer Specific Data)&lt;br /&gt;
            Company: Polar Electro OY&lt;br /&gt;
            Data: 72 08 00 00 00 00 00 00 00 00&lt;br /&gt;
     Data:  c9 28 84 1a 9e a0 02 01 06 03 02 ee fe 0d ff 6b 00 72 08 00 00 00 00 00 00 00 00&lt;br /&gt;
     CRC:   47 e9 1f&lt;br /&gt;
&lt;br /&gt;
=== Step 8 - Use Crackle to crack packages ===&lt;br /&gt;
&lt;br /&gt;
Enter these commands:&lt;br /&gt;
&lt;br /&gt;
 git clone https://github.com/mikeryan/crackle.git&lt;br /&gt;
 cd crackle&lt;br /&gt;
 make&lt;br /&gt;
&lt;br /&gt;
Now try cracking your pcap.file&lt;br /&gt;
&lt;br /&gt;
 ./crackle -i &amp;lt;your_file.pcap&amp;gt; -o &amp;lt;your_new_output_file.pcap&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this case it wasnt possible to crack any packages from the smartwatch.&lt;br /&gt;
&lt;br /&gt;
=== Step 9 - Install bleak library ===&lt;br /&gt;
&lt;br /&gt;
 pip install bleak&lt;br /&gt;
&lt;br /&gt;
=== Step 10 - Write python script for reading device UUID ===&lt;br /&gt;
&lt;br /&gt;
Enter these commands in the shell&lt;br /&gt;
&lt;br /&gt;
 mkdir BLE-scripts&lt;br /&gt;
 cd BLE-scripts&lt;br /&gt;
 nano ble_scan.py&lt;br /&gt;
&lt;br /&gt;
Write simple script to read device UUID using BleakScaner.discover() method:&lt;br /&gt;
 &lt;br /&gt;
 import asyncio&lt;br /&gt;
 from bleak import BleakScanner&lt;br /&gt;
 async def scan():&lt;br /&gt;
     devices = await BleakScanner.discover()&lt;br /&gt;
     for d in devices:&lt;br /&gt;
         print(d)&lt;br /&gt;
 asyncio.run(scan())&lt;br /&gt;
&lt;br /&gt;
Run a scan:&lt;br /&gt;
&lt;br /&gt;
 python3 BLE-scripts/ble_scan.py&lt;br /&gt;
&lt;br /&gt;
Here the device UUID of the Polar smartwatch was found:&lt;br /&gt;
&lt;br /&gt;
 C6C36C4A-7F8F-52B2-2BD7-C4F6690424E7: Polar Vantage M 8428C92D&lt;br /&gt;
&lt;br /&gt;
=== Step 11 - Check GATT services  ===&lt;br /&gt;
&lt;br /&gt;
With the gathered device UUID check for the devices services:&lt;br /&gt;
&lt;br /&gt;
 nano BLE-scripts/ble_services.py&lt;br /&gt;
&lt;br /&gt;
 import asyncio&lt;br /&gt;
 from bleak import BleakClient&lt;br /&gt;
 device_uuid = &amp;quot;C6C36C4A-7F8F-52B2-2BD7-C4F6690424E7&amp;quot;&lt;br /&gt;
 async def connect_to_device(device_uuid):&lt;br /&gt;
     async with BleakClient(device_uuid) as client:&lt;br /&gt;
         connected = client.is_connected&lt;br /&gt;
         print(f&amp;quot;Connected: {connected}&amp;quot;)&lt;br /&gt;
         services = client.services&lt;br /&gt;
         if services is None:&lt;br /&gt;
             await client.get_services()&lt;br /&gt;
         for service in services:&lt;br /&gt;
             print(f&amp;quot;Service: {service}&amp;quot;)&lt;br /&gt;
 loop = asyncio.get_event_loop()&lt;br /&gt;
 loop.run_until_complete(connect_to_device(device_uuid))&lt;br /&gt;
&lt;br /&gt;
Run a services scan:&lt;br /&gt;
&lt;br /&gt;
 python3 BLE-scripts/ble_services.py&lt;br /&gt;
&lt;br /&gt;
Now the service UUIDs that were found are going to be listed like this:&lt;br /&gt;
&lt;br /&gt;
 Service: 0000180a-0000-1000-8000-00805f9b34fb (Handle: 14): Device Information&lt;br /&gt;
 Service: 0000feee-0000-1000-8000-00805f9b34fb (Handle: 29): Polar Electro Oy&lt;br /&gt;
 Service: 0000180d-0000-1000-8000-00805f9b34fb (Handle: 38): Heart Rate&lt;br /&gt;
 Service: 0000180f-0000-1000-8000-00805f9b34fb (Handle: 42): Battery Service&lt;br /&gt;
&lt;br /&gt;
=== Step 12 - Get characteristics UUIDs  ===&lt;br /&gt;
&lt;br /&gt;
 nano BLE-scripts/ble_characteristics.py&lt;br /&gt;
&lt;br /&gt;
 import asyncio&lt;br /&gt;
 from bleak import BleakClient&lt;br /&gt;
 device_uuid = &amp;quot;C6C36C4A-7F8F-52B2-2BD7-C4F6690424E7&amp;quot;&lt;br /&gt;
 async def connect_to_device(device_uuid):&lt;br /&gt;
     async with BleakClient(device_uuid) as client:&lt;br /&gt;
         connected = client.is_connected&lt;br /&gt;
         print(f&amp;quot;Connected: {connected}&amp;quot;)&lt;br /&gt;
         services = client.services&lt;br /&gt;
         if services is None:&lt;br /&gt;
             await client.get_services()&lt;br /&gt;
         for service in services:&lt;br /&gt;
             print(f&amp;quot;Service: {service.uuid} (Handle: {service.handle}): {service.description}&amp;quot;)&lt;br /&gt;
             for characteristic in service.characteristics:&lt;br /&gt;
                 print(f&amp;quot;  Characteristic: {characteristic.uuid} (Handle: {characteristic.handle}) - Properties: {cha$&lt;br /&gt;
 loop = asyncio.get_event_loop()&lt;br /&gt;
 loop.run_until_complete(connect_to_device(device_uuid))&lt;br /&gt;
&lt;br /&gt;
Now run the script:&lt;br /&gt;
&lt;br /&gt;
 python3 BLE-scripts/ble_characteristics.py&lt;br /&gt;
&lt;br /&gt;
Expected output:&lt;br /&gt;
&lt;br /&gt;
 Service: 0000180a-0000-1000-8000-00805f9b34fb (Handle: 14): Device Information&lt;br /&gt;
  Characteristic: 00002a29-0000-1000-8000-00805f9b34fb (Handle: 15) - Properties: [&#039;read&#039;]&lt;br /&gt;
  Characteristic: 00002a24-0000-1000-8000-00805f9b34fb (Handle: 17) - Properties: [&#039;read&#039;]&lt;br /&gt;
  Characteristic: 00002a25-0000-1000-8000-00805f9b34fb (Handle: 19) - Properties: [&#039;read&#039;]&lt;br /&gt;
  Characteristic: 00002a27-0000-1000-8000-00805f9b34fb (Handle: 21) - Properties: [&#039;read&#039;]&lt;br /&gt;
  Characteristic: 00002a26-0000-1000-8000-00805f9b34fb (Handle: 23) - Properties: [&#039;read&#039;]&lt;br /&gt;
  Characteristic: 00002a28-0000-1000-8000-00805f9b34fb (Handle: 25) - Properties: [&#039;read&#039;]&lt;br /&gt;
  Characteristic: 00002a23-0000-1000-8000-00805f9b34fb (Handle: 27) - Properties: [&#039;read&#039;]&lt;br /&gt;
 Service: 0000feee-0000-1000-8000-00805f9b34fb (Handle: 29): Polar Electro Oy&lt;br /&gt;
  Characteristic: fb005c51-02e7-f387-1cad-8acd2d8df0c8 (Handle: 30) - Properties: [&#039;write-without-response&#039;, &#039;write&#039;, &#039;notify&#039;]&lt;br /&gt;
  Characteristic: fb005c52-02e7-f387-1cad-8acd2d8df0c8 (Handle: 33) - Properties: [&#039;notify&#039;]&lt;br /&gt;
  Characteristic: fb005c53-02e7-f387-1cad-8acd2d8df0c8 (Handle: 36) - Properties: [&#039;write-without-response&#039;, &#039;write&#039;]&lt;br /&gt;
 Service: 0000180d-0000-1000-8000-00805f9b34fb (Handle: 38): Heart Rate&lt;br /&gt;
  Characteristic: 00002a37-0000-1000-8000-00805f9b34fb (Handle: 39) - Properties: [&#039;notify&#039;]&lt;br /&gt;
 Service: 0000180f-0000-1000-8000-00805f9b34fb (Handle: 42): Battery Service&lt;br /&gt;
  Characteristic: 00002a19-0000-1000-8000-00805f9b34fb (Handle: 43) - Properties: [&#039;read&#039;, &#039;notify&#039;]&lt;br /&gt;
&lt;br /&gt;
=== Step 13 - Read data ===&lt;br /&gt;
&lt;br /&gt;
Now add a script for reading the actual data. Make sure to use the characteristics UUIDs you have found out.&lt;br /&gt;
&lt;br /&gt;
 nano BLE-scripts/ble_read.py&lt;br /&gt;
&lt;br /&gt;
 import asyncio&lt;br /&gt;
 from bleak import BleakClient&lt;br /&gt;
 device_uuid = &amp;quot;C6C36C4A-7F8F-52B2-2BD7-C4F6690424E7&amp;quot;&lt;br /&gt;
 HEART_RATE_CHAR_UUID = &amp;quot;00002a37-0000-1000-8000-00805f9b34fb&amp;quot;&lt;br /&gt;
 BATTERY_LEVEL_CHAR_UUID = &amp;quot;00002a19-0000-1000-8000-00805f9b34fb&amp;quot;&lt;br /&gt;
 async def connect_and_read_data(device_uuid):&lt;br /&gt;
     async with BleakClient(device_uuid) as client:&lt;br /&gt;
         connected = client.is_connected&lt;br /&gt;
         print(f&amp;quot;Connected: {connected}&amp;quot;)&lt;br /&gt;
         if connected:&lt;br /&gt;
             try:&lt;br /&gt;
                 heart_rate = await client.read_gatt_char(HEART_RATE_CHAR_UUID)&lt;br /&gt;
                 heart_rate = int(heart_rate_data[1])&lt;br /&gt;
                 print(f&amp;quot;Heart Rate: {heart_rate} bpm&amp;quot;)&lt;br /&gt;
             except Exception as e:&lt;br /&gt;
                 print(f&amp;quot;Failed to read heart rate: {e}&amp;quot;)&lt;br /&gt;
             try:&lt;br /&gt;
                 battery_level = await client.read_gatt_char(BATTERY_LEVEL_CHAR_UUID)&lt;br /&gt;
                 print(f&amp;quot;Battery Level: {int(battery_level[0])}%&amp;quot;)&lt;br /&gt;
             except Exception as e:&lt;br /&gt;
                 print(f&amp;quot;Failed to read battery level: {e}&amp;quot;)&lt;br /&gt;
 loop = asyncio.get_event_loop()&lt;br /&gt;
 loop.run_until_complete(connect_and_read_data(device_uuid))&lt;br /&gt;
&lt;br /&gt;
Run script:&lt;br /&gt;
&lt;br /&gt;
 python3 BLE-scripts/ble_read.py&lt;br /&gt;
&lt;br /&gt;
In the output the battery level was succesfully read and printed out. The heart rate couldn&#039;t be accessed because it only has the notify property and no option for reading:&lt;br /&gt;
&lt;br /&gt;
 Connected: True&lt;br /&gt;
 Failed to read heart rate: Failed to read characteristic 39: Error Domain=CBATTErrorDomain Code=2 &amp;quot;Reading is not permitted.&amp;quot; UserInfo={NSLocalizedDescription=Reading is not permitted.}&lt;br /&gt;
 Battery Level: 16%&lt;br /&gt;
&lt;br /&gt;
=== Step 14 - Subscribe to heart rate notifications ===&lt;br /&gt;
&lt;br /&gt;
 nano BLE-scripts/ble_subscribe.py&lt;br /&gt;
&lt;br /&gt;
 import asyncio&lt;br /&gt;
 from bleak import BleakClient&lt;br /&gt;
 device_uuid = &amp;quot;C6C36C4A-7F8F-52B2-2BD7-C4F6690424E7&amp;quot;&lt;br /&gt;
 HEART_RATE_CHAR_UUID = &amp;quot;00002a37-0000-1000-8000-00805f9b34fb&amp;quot;&lt;br /&gt;
 def heart_rate_handler(sender, data):&lt;br /&gt;
     heart_rate = int(data[1]) if len(data) &amp;gt; 1 else None&lt;br /&gt;
     print(f&amp;quot;Heart Rate from {sender}: {heart_rate} bpm&amp;quot;)&lt;br /&gt;
 async def connect_and_subscribe(device_uuid):&lt;br /&gt;
     async with BleakClient(device_uuid) as client:&lt;br /&gt;
         connected = client.is_connected&lt;br /&gt;
         print(f&amp;quot;Connected: {connected}&amp;quot;)&lt;br /&gt;
         if connected:&lt;br /&gt;
             try:&lt;br /&gt;
                 await client.start_notify(HEART_RATE_CHAR_UUID, heart_rate_handler)&lt;br /&gt;
                 print(&amp;quot;Subscribed to heart rate notifications.&amp;quot;)&lt;br /&gt;
                 await asyncio.sleep(60)&lt;br /&gt;
                 await client.stop_notify(HEART_RATE_CHAR_UUID)&lt;br /&gt;
                 print(&amp;quot;Stopped heart rate notifications.&amp;quot;)&lt;br /&gt;
             except Exception as e:&lt;br /&gt;
                 print(f&amp;quot;Failed to subscribe to heart rate notifications: {e}&amp;quot;)&lt;br /&gt;
 asyncio.run(connect_and_subscribe(device_uuid))&lt;br /&gt;
&lt;br /&gt;
 python3 BLE-scripts/ble_subscribe.py&lt;br /&gt;
&lt;br /&gt;
It was not possible to get the heart rate data even though the notify property was assigned. That is because typically battery status data is on a lower securiy level than heart rate data. This is the output of the failed try:&lt;br /&gt;
&lt;br /&gt;
 Connected: True&lt;br /&gt;
 Subscribed to heart rate notifications.&lt;br /&gt;
 Stopped heart rate notifications.&lt;br /&gt;
&lt;br /&gt;
== Used Hardware ==&lt;br /&gt;
&lt;br /&gt;
[[Ubertooth One, 2.4 GHz wireless development platform]]&lt;br /&gt;
&lt;br /&gt;
[[Polar Vantage M]]&lt;br /&gt;
&lt;br /&gt;
[[Apple iPhone 13 mini]]&lt;br /&gt;
&lt;br /&gt;
[[MacBook Air M1, 2020]]&lt;br /&gt;
&lt;br /&gt;
[[Samsung Galaxy J3]]&lt;br /&gt;
&lt;br /&gt;
== Courses ==&lt;br /&gt;
&lt;br /&gt;
* [[Selected IT-Security Chapters]] (2024)&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
* https://ubertooth.readthedocs.io/en/latest/&lt;br /&gt;
* https://www.greatscottgadgets.com/ubertoothone/&lt;br /&gt;
* https://codemuch.net/posts/bluetooth-hacking/&lt;br /&gt;
* https://bleak.readthedocs.io/en/latest/usage.html&lt;br /&gt;
* https://www.bluetooth.com/de/bluetooth-resources/intro-to-bluetooth-gap-gatt/&lt;br /&gt;
* https://support.polar.com/en/vantage-m#all&lt;br /&gt;
&lt;br /&gt;
[[Category:Documentation]]&lt;/div&gt;</summary>
		<author><name>AMaksimovic</name></author>
	</entry>
	<entry>
		<id>https://elvis.hcw.ac.at/wiki/index.php?title=Setting_Up_Ubertooth_on_macOS_for_Bluetooth_Hacking&amp;diff=16682</id>
		<title>Setting Up Ubertooth on macOS for Bluetooth Hacking</title>
		<link rel="alternate" type="text/html" href="https://elvis.hcw.ac.at/wiki/index.php?title=Setting_Up_Ubertooth_on_macOS_for_Bluetooth_Hacking&amp;diff=16682"/>
		<updated>2024-12-05T00:50:47Z</updated>

		<summary type="html">&lt;p&gt;AMaksimovic: /* Courses */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Summary == &lt;br /&gt;
&lt;br /&gt;
This is a step-by-step guide on how to sniff Bluetooth Low Energy (BLE) packets between a Polar Vantage Smartwatch and a phone using the Ubertooth One. It will go into detail on the setup on a MacBook Air with MacOS using a python environment for the libraries that are used for the setup. Additionally every step of the actual sniff will be outlined. This guide is based on the seminar paper &amp;quot;Smartwatch Hacking Attack&amp;quot; that was written within the FH-course &amp;quot;Selected IT-Security Chapters&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
== Requirements ==&lt;br /&gt;
&lt;br /&gt;
* Hardware tools: Ubertooth One: Firmware version: 2020-12-R1 (API:1.07)&lt;br /&gt;
* Unix-based Operating System: macOS (macOS Sequoia 15.1.1), on a MacBook Air with an Apple M1 chip.&lt;br /&gt;
* Virtual Environment: Python Environment: Python 3.12&lt;br /&gt;
* Packages: libusb, wget, cmake, pkg-config, setuptools, pyqt5, numpy&lt;br /&gt;
* Libraries: libbtbb, bleak&lt;br /&gt;
* Software Tools: Crackle&lt;br /&gt;
&lt;br /&gt;
For the setup this guide was used and adjusted to the given scenario. [[Ubertooth - Build Guide - https://ubertooth.readthedocs.io/en/latest/build_guide.html]].&lt;br /&gt;
&lt;br /&gt;
== Description ==&lt;br /&gt;
&lt;br /&gt;
=== Step 1 - Install homebrew ===&lt;br /&gt;
&lt;br /&gt;
Enter these commands in the shell&lt;br /&gt;
&lt;br /&gt;
 /bin/bash -c &amp;quot;$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)&amp;quot;&lt;br /&gt;
 eval &amp;quot;$(/opt/homebrew/bin/brew shellenv)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
=== Step 2 - Install Python Environment ===&lt;br /&gt;
&lt;br /&gt;
Enter these commands in the shell&lt;br /&gt;
&lt;br /&gt;
 python3.12 -m venv myenv&lt;br /&gt;
 source myenv/bin/activate&lt;br /&gt;
&lt;br /&gt;
=== Step 3 - Install libusb, wget, cmake, pkg-config ===&lt;br /&gt;
&lt;br /&gt;
Enter these commands in the shell&lt;br /&gt;
&lt;br /&gt;
 brew install libusb wget cmake pkg-config&lt;br /&gt;
&lt;br /&gt;
=== Step 4 - Install the Bluetooth baseband library ===&lt;br /&gt;
&lt;br /&gt;
Enter these commands in the shell&lt;br /&gt;
&lt;br /&gt;
 wget https://github.com/greatscottgadgets/libbtbb/archive/2020-12-R1.tar.gz -O libbtbb-2020-12-R1.tar.gz&lt;br /&gt;
 tar -xf libbtbb-2020-12-R1.tar.gz&lt;br /&gt;
 cd libbtbb-2020-12-R1&lt;br /&gt;
 mkdir build&lt;br /&gt;
 cd build&lt;br /&gt;
 cmake ..&lt;br /&gt;
 make&lt;br /&gt;
&lt;br /&gt;
If errors occur with installing distutils switch to setuptools instead.&lt;br /&gt;
&lt;br /&gt;
 pip install setuptools&lt;br /&gt;
&lt;br /&gt;
After installing the setuptools also change the &amp;quot;from distutils import setup&amp;quot; line in the the libbtbb-2020-12-R1/build/python/pcaptools/setup.py file to this:&lt;br /&gt;
&lt;br /&gt;
 from setuptools import setup&lt;br /&gt;
&lt;br /&gt;
Also update the version in that same file to this:&lt;br /&gt;
&lt;br /&gt;
 version = &#039;2020.12.R1&#039;&lt;br /&gt;
&lt;br /&gt;
If necessary set the pythonpath in case you have different python versions:&lt;br /&gt;
 &lt;br /&gt;
 export PYTHONPATH=/Users/&amp;lt;username&amp;gt;/myenv/lib/python3.12/site-packages:$PYTHONPATH&lt;br /&gt;
&lt;br /&gt;
Then retry:&lt;br /&gt;
&lt;br /&gt;
 make&lt;br /&gt;
&lt;br /&gt;
 sudo make install&lt;br /&gt;
&lt;br /&gt;
=== Step 5 - Install the Ubertooth repository ===&lt;br /&gt;
&lt;br /&gt;
Enter these commands in the shell&lt;br /&gt;
&lt;br /&gt;
 wget https://github.com/greatscottgadgets/ubertooth/releases/download/2020-12-R1/ubertooth-2020-12-R1.tar.xz&lt;br /&gt;
 tar -xf ubertooth-2020-12-R1.tar.xz&lt;br /&gt;
 cd ubertooth-2020-12-R1/host&lt;br /&gt;
 mkdir build&lt;br /&gt;
 cd build&lt;br /&gt;
 cmake ..&lt;br /&gt;
 make&lt;br /&gt;
&lt;br /&gt;
If libusb module not found errors occur go to ubertooth-2020-12-R1/host/CMakeLists.txt an add your libusb-path manually:&lt;br /&gt;
&lt;br /&gt;
 include_directories(/opt/homebrew/include)&lt;br /&gt;
 link_directories(/opt/homebrew/lib)&lt;br /&gt;
&lt;br /&gt;
Additionally again change the &amp;quot;from distutils import setup&amp;quot; line in the the ubertooth-2020-12-R1/host/build/python/specan_ui/setup.py file to this:&lt;br /&gt;
&lt;br /&gt;
 from setuptools import setup&lt;br /&gt;
&lt;br /&gt;
Also update the version in that same file to this:&lt;br /&gt;
&lt;br /&gt;
 version = &#039;2020.12.R1&#039;&lt;br /&gt;
&lt;br /&gt;
Then retry:&lt;br /&gt;
&lt;br /&gt;
 make&lt;br /&gt;
&lt;br /&gt;
 sudo make install&lt;br /&gt;
&lt;br /&gt;
If you get errors regarding the environment variables showing that your library wasnt found you need to set the library path via the MacOs&#039;s dynamic linker.&lt;br /&gt;
&lt;br /&gt;
 export DYLD_LIBRARY_PATH=&amp;quot;/usr/local/lib:$DYLD_LIBRARY_PATH&amp;quot;&lt;br /&gt;
&lt;br /&gt;
or make it persistent in shell configurations: &lt;br /&gt;
&lt;br /&gt;
 ~/.zshrc&lt;br /&gt;
&lt;br /&gt;
Afterwards confirm the ubertooth library is working correctly:&lt;br /&gt;
&lt;br /&gt;
 ubertooth-util&lt;br /&gt;
&lt;br /&gt;
=== Step 6 - Test Ubertooth One commands ===&lt;br /&gt;
&lt;br /&gt;
Test these commands:&lt;br /&gt;
&lt;br /&gt;
 ubertooth-util -H&lt;br /&gt;
 ubertooth-util -v&lt;br /&gt;
 ubertooth-util -p&lt;br /&gt;
 ubertooth-util -s&lt;br /&gt;
&lt;br /&gt;
Update Ubertooth firmware in ubertooth-2020-12-R1/ubertooth-one-firmware-bin:&lt;br /&gt;
&lt;br /&gt;
 sudo ubertooth-dfu -d bluetooth_rxtx.dfu -r&lt;br /&gt;
&lt;br /&gt;
In case the libubertooth library is not loading check if the paths are correct.&lt;br /&gt;
&lt;br /&gt;
In ubertooth-2020-12-R1/host the following command leads to getting a list of sniffed Bluetooth packets with their Lower Address Parts (LAP):&lt;br /&gt;
&lt;br /&gt;
 ubertooth-rx&lt;br /&gt;
&lt;br /&gt;
For collecting Upper Address Parts (UAP) from the captured packets add -z:&lt;br /&gt;
&lt;br /&gt;
 ubertooth-rx -z&lt;br /&gt;
&lt;br /&gt;
Let it run for a while and look at the output. It will be summarized as Survey Results at the end of the output. There you can see the significant part of Bluetooth addresses of devices that were scanned. &lt;br /&gt;
&lt;br /&gt;
=== Step 7 - Use BTLE to follow the connection of the Bluetooth device you found. (Replace with device Bluetooth Address) ===&lt;br /&gt;
&lt;br /&gt;
 ubertooth-btle -f B0:67:B5:CF:E5:10 -r test.pcap&lt;br /&gt;
&lt;br /&gt;
Or create a pipe for viewing the captures directly in Wireshark:&lt;br /&gt;
&lt;br /&gt;
 mkfifo /tmp/pipe&lt;br /&gt;
 ubertooth-btle -f B0:67:B5:CF:E5:10 -c /tmp/pipe&lt;br /&gt;
&lt;br /&gt;
Find packages that involve the Polar Smartwatch&lt;br /&gt;
&lt;br /&gt;
 systime=1728247529 freq=2402 addr=8e89bed6 delta_t=34.320 ms rssi=-60&lt;br /&gt;
 20 1b c9 28 84 1a 9e a0 02 01 06 03 02 ee fe 0d ff 6b 00 72 08 00 00 00 00 00 00 00 00 47 e9 1f &lt;br /&gt;
 Advertising / AA 8e89bed6 (valid)/ 27 bytes&lt;br /&gt;
     Channel Index: 37&lt;br /&gt;
     Type:  ADV_IND&lt;br /&gt;
     AdvA:  a0:9e:1a:84:28:c9 (public)&lt;br /&gt;
     AdvData: 02 01 06 03 02 ee fe 0d ff 6b 00 72 08 00 00 00 00 00 00 00 00&lt;br /&gt;
         Type 01 (Flags)&lt;br /&gt;
            00000110&lt;br /&gt;
                LE General Discoverable Mode&lt;br /&gt;
                BR/EDR Not Supported&lt;br /&gt;
         Type 02 (16-bit Service UUIDs, more available)&lt;br /&gt;
            feee&lt;br /&gt;
         Type ff (Manufacturer Specific Data)&lt;br /&gt;
            Company: Polar Electro OY&lt;br /&gt;
            Data: 72 08 00 00 00 00 00 00 00 00&lt;br /&gt;
     Data:  c9 28 84 1a 9e a0 02 01 06 03 02 ee fe 0d ff 6b 00 72 08 00 00 00 00 00 00 00 00&lt;br /&gt;
     CRC:   47 e9 1f&lt;br /&gt;
&lt;br /&gt;
=== Step 8 - Use Crackle to crack packages ===&lt;br /&gt;
&lt;br /&gt;
Enter these commands:&lt;br /&gt;
&lt;br /&gt;
 git clone https://github.com/mikeryan/crackle.git&lt;br /&gt;
 cd crackle&lt;br /&gt;
 make&lt;br /&gt;
&lt;br /&gt;
Now try cracking your pcap.file&lt;br /&gt;
&lt;br /&gt;
 ./crackle -i &amp;lt;your_file.pcap&amp;gt; -o &amp;lt;your_new_output_file.pcap&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this case it wasnt possible to crack any packages from the smartwatch.&lt;br /&gt;
&lt;br /&gt;
=== Step 9 - Install bleak library ===&lt;br /&gt;
&lt;br /&gt;
 pip install bleak&lt;br /&gt;
&lt;br /&gt;
=== Step 10 - Write python script for reading device UUID ===&lt;br /&gt;
&lt;br /&gt;
Enter these commands in the shell&lt;br /&gt;
&lt;br /&gt;
 mkdir BLE-scripts&lt;br /&gt;
 cd BLE-scripts&lt;br /&gt;
 nano ble_scan.py&lt;br /&gt;
&lt;br /&gt;
Write simple script to read device UUID using BleakScaner.discover() method:&lt;br /&gt;
 &lt;br /&gt;
 import asyncio&lt;br /&gt;
 from bleak import BleakScanner&lt;br /&gt;
 async def scan():&lt;br /&gt;
     devices = await BleakScanner.discover()&lt;br /&gt;
     for d in devices:&lt;br /&gt;
         print(d)&lt;br /&gt;
 asyncio.run(scan())&lt;br /&gt;
&lt;br /&gt;
Run a scan:&lt;br /&gt;
&lt;br /&gt;
 python3 BLE-scripts/ble_scan.py&lt;br /&gt;
&lt;br /&gt;
Here the device UUID of the Polar smartwatch was found:&lt;br /&gt;
&lt;br /&gt;
 C6C36C4A-7F8F-52B2-2BD7-C4F6690424E7: Polar Vantage M 8428C92D&lt;br /&gt;
&lt;br /&gt;
=== Step 11 - Check GATT services  ===&lt;br /&gt;
&lt;br /&gt;
With the gathered device UUID check for the devices services:&lt;br /&gt;
&lt;br /&gt;
 nano BLE-scripts/ble_services.py&lt;br /&gt;
&lt;br /&gt;
 import asyncio&lt;br /&gt;
 from bleak import BleakClient&lt;br /&gt;
 device_uuid = &amp;quot;C6C36C4A-7F8F-52B2-2BD7-C4F6690424E7&amp;quot;&lt;br /&gt;
 async def connect_to_device(device_uuid):&lt;br /&gt;
     async with BleakClient(device_uuid) as client:&lt;br /&gt;
         connected = client.is_connected&lt;br /&gt;
         print(f&amp;quot;Connected: {connected}&amp;quot;)&lt;br /&gt;
         services = client.services&lt;br /&gt;
         if services is None:&lt;br /&gt;
             await client.get_services()&lt;br /&gt;
         for service in services:&lt;br /&gt;
             print(f&amp;quot;Service: {service}&amp;quot;)&lt;br /&gt;
 loop = asyncio.get_event_loop()&lt;br /&gt;
 loop.run_until_complete(connect_to_device(device_uuid))&lt;br /&gt;
&lt;br /&gt;
Run a services scan:&lt;br /&gt;
&lt;br /&gt;
 python3 BLE-scripts/ble_services.py&lt;br /&gt;
&lt;br /&gt;
Now the service UUIDs that were found are going to be listed like this:&lt;br /&gt;
&lt;br /&gt;
 Service: 0000180a-0000-1000-8000-00805f9b34fb (Handle: 14): Device Information&lt;br /&gt;
 Service: 0000feee-0000-1000-8000-00805f9b34fb (Handle: 29): Polar Electro Oy&lt;br /&gt;
 Service: 0000180d-0000-1000-8000-00805f9b34fb (Handle: 38): Heart Rate&lt;br /&gt;
 Service: 0000180f-0000-1000-8000-00805f9b34fb (Handle: 42): Battery Service&lt;br /&gt;
&lt;br /&gt;
=== Step 12 - Get characteristics UUIDs  ===&lt;br /&gt;
&lt;br /&gt;
 nano BLE-scripts/ble_characteristics.py&lt;br /&gt;
&lt;br /&gt;
 import asyncio&lt;br /&gt;
 from bleak import BleakClient&lt;br /&gt;
 device_uuid = &amp;quot;C6C36C4A-7F8F-52B2-2BD7-C4F6690424E7&amp;quot;&lt;br /&gt;
 async def connect_to_device(device_uuid):&lt;br /&gt;
     async with BleakClient(device_uuid) as client:&lt;br /&gt;
         connected = client.is_connected&lt;br /&gt;
         print(f&amp;quot;Connected: {connected}&amp;quot;)&lt;br /&gt;
         services = client.services&lt;br /&gt;
         if services is None:&lt;br /&gt;
             await client.get_services()&lt;br /&gt;
         for service in services:&lt;br /&gt;
             print(f&amp;quot;Service: {service.uuid} (Handle: {service.handle}): {service.description}&amp;quot;)&lt;br /&gt;
             for characteristic in service.characteristics:&lt;br /&gt;
                 print(f&amp;quot;  Characteristic: {characteristic.uuid} (Handle: {characteristic.handle}) - Properties: {cha$&lt;br /&gt;
 loop = asyncio.get_event_loop()&lt;br /&gt;
 loop.run_until_complete(connect_to_device(device_uuid))&lt;br /&gt;
&lt;br /&gt;
Now run the script:&lt;br /&gt;
&lt;br /&gt;
 python3 BLE-scripts/ble_characteristics.py&lt;br /&gt;
&lt;br /&gt;
Expected output:&lt;br /&gt;
&lt;br /&gt;
 Service: 0000180a-0000-1000-8000-00805f9b34fb (Handle: 14): Device Information&lt;br /&gt;
  Characteristic: 00002a29-0000-1000-8000-00805f9b34fb (Handle: 15) - Properties: [&#039;read&#039;]&lt;br /&gt;
  Characteristic: 00002a24-0000-1000-8000-00805f9b34fb (Handle: 17) - Properties: [&#039;read&#039;]&lt;br /&gt;
  Characteristic: 00002a25-0000-1000-8000-00805f9b34fb (Handle: 19) - Properties: [&#039;read&#039;]&lt;br /&gt;
  Characteristic: 00002a27-0000-1000-8000-00805f9b34fb (Handle: 21) - Properties: [&#039;read&#039;]&lt;br /&gt;
  Characteristic: 00002a26-0000-1000-8000-00805f9b34fb (Handle: 23) - Properties: [&#039;read&#039;]&lt;br /&gt;
  Characteristic: 00002a28-0000-1000-8000-00805f9b34fb (Handle: 25) - Properties: [&#039;read&#039;]&lt;br /&gt;
  Characteristic: 00002a23-0000-1000-8000-00805f9b34fb (Handle: 27) - Properties: [&#039;read&#039;]&lt;br /&gt;
 Service: 0000feee-0000-1000-8000-00805f9b34fb (Handle: 29): Polar Electro Oy&lt;br /&gt;
  Characteristic: fb005c51-02e7-f387-1cad-8acd2d8df0c8 (Handle: 30) - Properties: [&#039;write-without-response&#039;, &#039;write&#039;, &#039;notify&#039;]&lt;br /&gt;
  Characteristic: fb005c52-02e7-f387-1cad-8acd2d8df0c8 (Handle: 33) - Properties: [&#039;notify&#039;]&lt;br /&gt;
  Characteristic: fb005c53-02e7-f387-1cad-8acd2d8df0c8 (Handle: 36) - Properties: [&#039;write-without-response&#039;, &#039;write&#039;]&lt;br /&gt;
 Service: 0000180d-0000-1000-8000-00805f9b34fb (Handle: 38): Heart Rate&lt;br /&gt;
  Characteristic: 00002a37-0000-1000-8000-00805f9b34fb (Handle: 39) - Properties: [&#039;notify&#039;]&lt;br /&gt;
 Service: 0000180f-0000-1000-8000-00805f9b34fb (Handle: 42): Battery Service&lt;br /&gt;
  Characteristic: 00002a19-0000-1000-8000-00805f9b34fb (Handle: 43) - Properties: [&#039;read&#039;, &#039;notify&#039;]&lt;br /&gt;
&lt;br /&gt;
=== Step 13 - Read data ===&lt;br /&gt;
&lt;br /&gt;
Now add a script for reading the actual data. Make sure to use the characteristics UUIDs you have found out.&lt;br /&gt;
&lt;br /&gt;
 nano BLE-scripts/ble_read.py&lt;br /&gt;
&lt;br /&gt;
 import asyncio&lt;br /&gt;
 from bleak import BleakClient&lt;br /&gt;
 device_uuid = &amp;quot;C6C36C4A-7F8F-52B2-2BD7-C4F6690424E7&amp;quot;&lt;br /&gt;
 HEART_RATE_CHAR_UUID = &amp;quot;00002a37-0000-1000-8000-00805f9b34fb&amp;quot;&lt;br /&gt;
 BATTERY_LEVEL_CHAR_UUID = &amp;quot;00002a19-0000-1000-8000-00805f9b34fb&amp;quot;&lt;br /&gt;
 async def connect_and_read_data(device_uuid):&lt;br /&gt;
     async with BleakClient(device_uuid) as client:&lt;br /&gt;
         connected = client.is_connected&lt;br /&gt;
         print(f&amp;quot;Connected: {connected}&amp;quot;)&lt;br /&gt;
         if connected:&lt;br /&gt;
             try:&lt;br /&gt;
                 heart_rate = await client.read_gatt_char(HEART_RATE_CHAR_UUID)&lt;br /&gt;
                 heart_rate = int(heart_rate_data[1])&lt;br /&gt;
                 print(f&amp;quot;Heart Rate: {heart_rate} bpm&amp;quot;)&lt;br /&gt;
             except Exception as e:&lt;br /&gt;
                 print(f&amp;quot;Failed to read heart rate: {e}&amp;quot;)&lt;br /&gt;
             try:&lt;br /&gt;
                 battery_level = await client.read_gatt_char(BATTERY_LEVEL_CHAR_UUID)&lt;br /&gt;
                 print(f&amp;quot;Battery Level: {int(battery_level[0])}%&amp;quot;)&lt;br /&gt;
             except Exception as e:&lt;br /&gt;
                 print(f&amp;quot;Failed to read battery level: {e}&amp;quot;)&lt;br /&gt;
 loop = asyncio.get_event_loop()&lt;br /&gt;
 loop.run_until_complete(connect_and_read_data(device_uuid))&lt;br /&gt;
&lt;br /&gt;
Run script:&lt;br /&gt;
&lt;br /&gt;
 python3 BLE-scripts/ble_read.py&lt;br /&gt;
&lt;br /&gt;
In the output the battery level was succesfully read and printed out. The heart rate couldn&#039;t be accessed because it only has the notify property and no option for reading:&lt;br /&gt;
&lt;br /&gt;
 Connected: True&lt;br /&gt;
 Failed to read heart rate: Failed to read characteristic 39: Error Domain=CBATTErrorDomain Code=2 &amp;quot;Reading is not permitted.&amp;quot; UserInfo={NSLocalizedDescription=Reading is not permitted.}&lt;br /&gt;
 Battery Level: 16%&lt;br /&gt;
&lt;br /&gt;
=== Step 14 - Subscribe to heart rate notifications ===&lt;br /&gt;
&lt;br /&gt;
 nano BLE-scripts/ble_subscribe.py&lt;br /&gt;
&lt;br /&gt;
 import asyncio&lt;br /&gt;
 from bleak import BleakClient&lt;br /&gt;
 device_uuid = &amp;quot;C6C36C4A-7F8F-52B2-2BD7-C4F6690424E7&amp;quot;&lt;br /&gt;
 HEART_RATE_CHAR_UUID = &amp;quot;00002a37-0000-1000-8000-00805f9b34fb&amp;quot;&lt;br /&gt;
 def heart_rate_handler(sender, data):&lt;br /&gt;
     heart_rate = int(data[1]) if len(data) &amp;gt; 1 else None&lt;br /&gt;
     print(f&amp;quot;Heart Rate from {sender}: {heart_rate} bpm&amp;quot;)&lt;br /&gt;
 async def connect_and_subscribe(device_uuid):&lt;br /&gt;
     async with BleakClient(device_uuid) as client:&lt;br /&gt;
         connected = client.is_connected&lt;br /&gt;
         print(f&amp;quot;Connected: {connected}&amp;quot;)&lt;br /&gt;
         if connected:&lt;br /&gt;
             try:&lt;br /&gt;
                 await client.start_notify(HEART_RATE_CHAR_UUID, heart_rate_handler)&lt;br /&gt;
                 print(&amp;quot;Subscribed to heart rate notifications.&amp;quot;)&lt;br /&gt;
                 await asyncio.sleep(60)&lt;br /&gt;
                 await client.stop_notify(HEART_RATE_CHAR_UUID)&lt;br /&gt;
                 print(&amp;quot;Stopped heart rate notifications.&amp;quot;)&lt;br /&gt;
             except Exception as e:&lt;br /&gt;
                 print(f&amp;quot;Failed to subscribe to heart rate notifications: {e}&amp;quot;)&lt;br /&gt;
 asyncio.run(connect_and_subscribe(device_uuid))&lt;br /&gt;
&lt;br /&gt;
 python3 BLE-scripts/ble_subscribe.py&lt;br /&gt;
&lt;br /&gt;
It was not possible to get the heart rate data even though the notify property was assigned. That is because typically battery status data is on a lower securiy level than heart rate data. This is the output of the failed try:&lt;br /&gt;
&lt;br /&gt;
 Connected: True&lt;br /&gt;
 Subscribed to heart rate notifications.&lt;br /&gt;
 Stopped heart rate notifications.&lt;br /&gt;
&lt;br /&gt;
== Used Hardware ==&lt;br /&gt;
&lt;br /&gt;
[[Ubertooth One, 2.4 GHz wireless development platform]]&lt;br /&gt;
&lt;br /&gt;
[[Polar Vantage M]]&lt;br /&gt;
&lt;br /&gt;
[[Apple iPhone 13 mini]]&lt;br /&gt;
&lt;br /&gt;
[[MacBook Air M1, 2020]]&lt;br /&gt;
&lt;br /&gt;
[[Samsung Galaxy J3]]&lt;br /&gt;
&lt;br /&gt;
== Courses ==&lt;br /&gt;
&lt;br /&gt;
* [[Selected IT-Security Chapters]] (2024)&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
* https://wikipedia.org&lt;br /&gt;
* https://google.com&lt;br /&gt;
&lt;br /&gt;
[[Category:Documentation]]&lt;/div&gt;</summary>
		<author><name>AMaksimovic</name></author>
	</entry>
	<entry>
		<id>https://elvis.hcw.ac.at/wiki/index.php?title=Polar_Vantage_M&amp;diff=16681</id>
		<title>Polar Vantage M</title>
		<link rel="alternate" type="text/html" href="https://elvis.hcw.ac.at/wiki/index.php?title=Polar_Vantage_M&amp;diff=16681"/>
		<updated>2024-12-05T00:46:24Z</updated>

		<summary type="html">&lt;p&gt;AMaksimovic: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Device|device_name=Polar Vantage M|manufacturer=Polar|link=https://support.polar.com/en/vantage-m|description=Bluetooth Smartwatch and Fitnesstracker|technicalSpecification=https://support.polar.com/en/vantage-m#features|supportedTechnologies=Bluetooth LE|includedEquipment=1x smartwatch with charger|elviscategory=Smart Home|image_link=https://support.polar.com/img/cms/0eb6102b5d9875b8b51b3ea6f4dd8aa3d5e7f479-345x345-default.png}}&lt;/div&gt;</summary>
		<author><name>AMaksimovic</name></author>
	</entry>
	<entry>
		<id>https://elvis.hcw.ac.at/wiki/index.php?title=Polar_Vantage_M&amp;diff=16680</id>
		<title>Polar Vantage M</title>
		<link rel="alternate" type="text/html" href="https://elvis.hcw.ac.at/wiki/index.php?title=Polar_Vantage_M&amp;diff=16680"/>
		<updated>2024-12-05T00:45:40Z</updated>

		<summary type="html">&lt;p&gt;AMaksimovic: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Device|device_name=Polar Vantage M|manufacturer=Polar|link=https://support.polar.com/en/vantage-m|description=smartwatch|technicalSpecification=https://support.polar.com/en/vantage-m#features|supportedTechnologies=Bluetooth LE|includedEquipment=1x smartwatch with charger|elviscategory=Smart Home|image_link=https://support.polar.com/img/cms/0eb6102b5d9875b8b51b3ea6f4dd8aa3d5e7f479-345x345-default.png}}&lt;/div&gt;</summary>
		<author><name>AMaksimovic</name></author>
	</entry>
	<entry>
		<id>https://elvis.hcw.ac.at/wiki/index.php?title=Polar_Vantage_M&amp;diff=16679</id>
		<title>Polar Vantage M</title>
		<link rel="alternate" type="text/html" href="https://elvis.hcw.ac.at/wiki/index.php?title=Polar_Vantage_M&amp;diff=16679"/>
		<updated>2024-12-05T00:44:35Z</updated>

		<summary type="html">&lt;p&gt;AMaksimovic: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Device|device_name=Polar Vantage M|manufacturer=Polar|link=https://support.polar.com/en/vantage-m|description=smartwatch|technicalSpecification=https://support.polar.com/en/vantage-m#features|supportedTechnologies=Bluetooth LE|includedEquipment=1x smartwatch with charger|elviscategory=Smart Home|image_link=https://support.polar.com/en/vantage-m#features}}&lt;/div&gt;</summary>
		<author><name>AMaksimovic</name></author>
	</entry>
	<entry>
		<id>https://elvis.hcw.ac.at/wiki/index.php?title=Polar_Vantage_M&amp;diff=16678</id>
		<title>Polar Vantage M</title>
		<link rel="alternate" type="text/html" href="https://elvis.hcw.ac.at/wiki/index.php?title=Polar_Vantage_M&amp;diff=16678"/>
		<updated>2024-12-05T00:43:44Z</updated>

		<summary type="html">&lt;p&gt;AMaksimovic: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Device|device_name=Polar Vantage M|manufacturer=Polar|link=https://support.polar.com/en/vantage-m|description=smartwatch|technicalSpecification=https://support.polar.com/en/vantage-m#features|supportedTechnologies=Bluetooth LE|includedEquipment=1x smartwatch with charger|elviscategory=Smart Home}}&lt;/div&gt;</summary>
		<author><name>AMaksimovic</name></author>
	</entry>
	<entry>
		<id>https://elvis.hcw.ac.at/wiki/index.php?title=Polar_Vantage_M&amp;diff=16677</id>
		<title>Polar Vantage M</title>
		<link rel="alternate" type="text/html" href="https://elvis.hcw.ac.at/wiki/index.php?title=Polar_Vantage_M&amp;diff=16677"/>
		<updated>2024-12-05T00:43:19Z</updated>

		<summary type="html">&lt;p&gt;AMaksimovic: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Device|device_name=Polar Vantage M|manufacturer=Polar|link=https://support.polar.com/en/vantage-m|description=smartwatch|technicalSpecification=https://support.polar.com/en/vantage-m#features|supportedTechnologies=Bluetooth LE|includedEquipment=1x smartwatch with charger|elviscategory=Smart Home}|image_link=https://support.polar.com/en/vantage-m#features}&lt;/div&gt;</summary>
		<author><name>AMaksimovic</name></author>
	</entry>
	<entry>
		<id>https://elvis.hcw.ac.at/wiki/index.php?title=Polar_Vantage_M&amp;diff=16676</id>
		<title>Polar Vantage M</title>
		<link rel="alternate" type="text/html" href="https://elvis.hcw.ac.at/wiki/index.php?title=Polar_Vantage_M&amp;diff=16676"/>
		<updated>2024-12-05T00:42:40Z</updated>

		<summary type="html">&lt;p&gt;AMaksimovic: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Device|device_name=Polar Vantage M|manufacturer=Polar|link=https://support.polar.com/en/vantage-m|description=smartwatch|technicalSpecification=https://support.polar.com/en/vantage-m#features|supportedTechnologies=Bluetooth LE|includedEquipment=1x smartwatch with charger|elviscategory=Smart Home}}&lt;/div&gt;</summary>
		<author><name>AMaksimovic</name></author>
	</entry>
	<entry>
		<id>https://elvis.hcw.ac.at/wiki/index.php?title=Polar_Vantage_M&amp;diff=16675</id>
		<title>Polar Vantage M</title>
		<link rel="alternate" type="text/html" href="https://elvis.hcw.ac.at/wiki/index.php?title=Polar_Vantage_M&amp;diff=16675"/>
		<updated>2024-12-05T00:40:46Z</updated>

		<summary type="html">&lt;p&gt;AMaksimovic: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Device|device_name=Polar Vantage M|manufacturer=Polar|description=smartwatch|technicalSpecification=https://support.polar.com/en/vantage-m#features|supportedTechnologies=Bluetooth LE|includedEquipment=1x smartwatch with charger|elviscategory=Smart Home}}&lt;/div&gt;</summary>
		<author><name>AMaksimovic</name></author>
	</entry>
	<entry>
		<id>https://elvis.hcw.ac.at/wiki/index.php?title=Polar_Vantage_M&amp;diff=16674</id>
		<title>Polar Vantage M</title>
		<link rel="alternate" type="text/html" href="https://elvis.hcw.ac.at/wiki/index.php?title=Polar_Vantage_M&amp;diff=16674"/>
		<updated>2024-12-05T00:39:55Z</updated>

		<summary type="html">&lt;p&gt;AMaksimovic: Created page with &amp;quot;{{Device|device_name=Polar Vantage M|manufacturer=Polar|link=technicalSpecification: https://support.polar.com/en/vantage-m#features|description=smartwatch|technicalSpecification=https://support.polar.com/en/vantage-m#features|supportedTechnologies=Bluetooth LE|includedEquipment=1x smartwatch with charger|elviscategory=Smart Home}}&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Device|device_name=Polar Vantage M|manufacturer=Polar|link=technicalSpecification: https://support.polar.com/en/vantage-m#features|description=smartwatch|technicalSpecification=https://support.polar.com/en/vantage-m#features|supportedTechnologies=Bluetooth LE|includedEquipment=1x smartwatch with charger|elviscategory=Smart Home}}&lt;/div&gt;</summary>
		<author><name>AMaksimovic</name></author>
	</entry>
	<entry>
		<id>https://elvis.hcw.ac.at/wiki/index.php?title=Setting_Up_Ubertooth_on_macOS_for_Bluetooth_Hacking&amp;diff=16673</id>
		<title>Setting Up Ubertooth on macOS for Bluetooth Hacking</title>
		<link rel="alternate" type="text/html" href="https://elvis.hcw.ac.at/wiki/index.php?title=Setting_Up_Ubertooth_on_macOS_for_Bluetooth_Hacking&amp;diff=16673"/>
		<updated>2024-12-05T00:27:54Z</updated>

		<summary type="html">&lt;p&gt;AMaksimovic: /* Used Hardware */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Summary == &lt;br /&gt;
&lt;br /&gt;
This is a step-by-step guide on how to sniff Bluetooth Low Energy (BLE) packets between a Polar Vantage Smartwatch and a phone using the Ubertooth One. It will go into detail on the setup on a MacBook Air with MacOS using a python environment for the libraries that are used for the setup. Additionally every step of the actual sniff will be outlined. This guide is based on the seminar paper &amp;quot;Smartwatch Hacking Attack&amp;quot; that was written within the FH-course &amp;quot;Selected IT-Security Chapters&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
== Requirements ==&lt;br /&gt;
&lt;br /&gt;
* Hardware tools: Ubertooth One: Firmware version: 2020-12-R1 (API:1.07)&lt;br /&gt;
* Unix-based Operating System: macOS (macOS Sequoia 15.1.1), on a MacBook Air with an Apple M1 chip.&lt;br /&gt;
* Virtual Environment: Python Environment: Python 3.12&lt;br /&gt;
* Packages: libusb, wget, cmake, pkg-config, setuptools, pyqt5, numpy&lt;br /&gt;
* Libraries: libbtbb, bleak&lt;br /&gt;
* Software Tools: Crackle&lt;br /&gt;
&lt;br /&gt;
For the setup this guide was used and adjusted to the given scenario. [[Ubertooth - Build Guide - https://ubertooth.readthedocs.io/en/latest/build_guide.html]].&lt;br /&gt;
&lt;br /&gt;
== Description ==&lt;br /&gt;
&lt;br /&gt;
=== Step 1 - Install homebrew ===&lt;br /&gt;
&lt;br /&gt;
Enter these commands in the shell&lt;br /&gt;
&lt;br /&gt;
 /bin/bash -c &amp;quot;$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)&amp;quot;&lt;br /&gt;
 eval &amp;quot;$(/opt/homebrew/bin/brew shellenv)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
=== Step 2 - Install Python Environment ===&lt;br /&gt;
&lt;br /&gt;
Enter these commands in the shell&lt;br /&gt;
&lt;br /&gt;
 python3.12 -m venv myenv&lt;br /&gt;
 source myenv/bin/activate&lt;br /&gt;
&lt;br /&gt;
=== Step 3 - Install libusb, wget, cmake, pkg-config ===&lt;br /&gt;
&lt;br /&gt;
Enter these commands in the shell&lt;br /&gt;
&lt;br /&gt;
 brew install libusb wget cmake pkg-config&lt;br /&gt;
&lt;br /&gt;
=== Step 4 - Install the Bluetooth baseband library ===&lt;br /&gt;
&lt;br /&gt;
Enter these commands in the shell&lt;br /&gt;
&lt;br /&gt;
 wget https://github.com/greatscottgadgets/libbtbb/archive/2020-12-R1.tar.gz -O libbtbb-2020-12-R1.tar.gz&lt;br /&gt;
 tar -xf libbtbb-2020-12-R1.tar.gz&lt;br /&gt;
 cd libbtbb-2020-12-R1&lt;br /&gt;
 mkdir build&lt;br /&gt;
 cd build&lt;br /&gt;
 cmake ..&lt;br /&gt;
 make&lt;br /&gt;
&lt;br /&gt;
If errors occur with installing distutils switch to setuptools instead.&lt;br /&gt;
&lt;br /&gt;
 pip install setuptools&lt;br /&gt;
&lt;br /&gt;
After installing the setuptools also change the &amp;quot;from distutils import setup&amp;quot; line in the the libbtbb-2020-12-R1/build/python/pcaptools/setup.py file to this:&lt;br /&gt;
&lt;br /&gt;
 from setuptools import setup&lt;br /&gt;
&lt;br /&gt;
Also update the version in that same file to this:&lt;br /&gt;
&lt;br /&gt;
 version = &#039;2020.12.R1&#039;&lt;br /&gt;
&lt;br /&gt;
If necessary set the pythonpath in case you have different python versions:&lt;br /&gt;
 &lt;br /&gt;
 export PYTHONPATH=/Users/&amp;lt;username&amp;gt;/myenv/lib/python3.12/site-packages:$PYTHONPATH&lt;br /&gt;
&lt;br /&gt;
Then retry:&lt;br /&gt;
&lt;br /&gt;
 make&lt;br /&gt;
&lt;br /&gt;
 sudo make install&lt;br /&gt;
&lt;br /&gt;
=== Step 5 - Install the Ubertooth repository ===&lt;br /&gt;
&lt;br /&gt;
Enter these commands in the shell&lt;br /&gt;
&lt;br /&gt;
 wget https://github.com/greatscottgadgets/ubertooth/releases/download/2020-12-R1/ubertooth-2020-12-R1.tar.xz&lt;br /&gt;
 tar -xf ubertooth-2020-12-R1.tar.xz&lt;br /&gt;
 cd ubertooth-2020-12-R1/host&lt;br /&gt;
 mkdir build&lt;br /&gt;
 cd build&lt;br /&gt;
 cmake ..&lt;br /&gt;
 make&lt;br /&gt;
&lt;br /&gt;
If libusb module not found errors occur go to ubertooth-2020-12-R1/host/CMakeLists.txt an add your libusb-path manually:&lt;br /&gt;
&lt;br /&gt;
 include_directories(/opt/homebrew/include)&lt;br /&gt;
 link_directories(/opt/homebrew/lib)&lt;br /&gt;
&lt;br /&gt;
Additionally again change the &amp;quot;from distutils import setup&amp;quot; line in the the ubertooth-2020-12-R1/host/build/python/specan_ui/setup.py file to this:&lt;br /&gt;
&lt;br /&gt;
 from setuptools import setup&lt;br /&gt;
&lt;br /&gt;
Also update the version in that same file to this:&lt;br /&gt;
&lt;br /&gt;
 version = &#039;2020.12.R1&#039;&lt;br /&gt;
&lt;br /&gt;
Then retry:&lt;br /&gt;
&lt;br /&gt;
 make&lt;br /&gt;
&lt;br /&gt;
 sudo make install&lt;br /&gt;
&lt;br /&gt;
If you get errors regarding the environment variables showing that your library wasnt found you need to set the library path via the MacOs&#039;s dynamic linker.&lt;br /&gt;
&lt;br /&gt;
 export DYLD_LIBRARY_PATH=&amp;quot;/usr/local/lib:$DYLD_LIBRARY_PATH&amp;quot;&lt;br /&gt;
&lt;br /&gt;
or make it persistent in shell configurations: &lt;br /&gt;
&lt;br /&gt;
 ~/.zshrc&lt;br /&gt;
&lt;br /&gt;
Afterwards confirm the ubertooth library is working correctly:&lt;br /&gt;
&lt;br /&gt;
 ubertooth-util&lt;br /&gt;
&lt;br /&gt;
=== Step 6 - Test Ubertooth One commands ===&lt;br /&gt;
&lt;br /&gt;
Test these commands:&lt;br /&gt;
&lt;br /&gt;
 ubertooth-util -H&lt;br /&gt;
 ubertooth-util -v&lt;br /&gt;
 ubertooth-util -p&lt;br /&gt;
 ubertooth-util -s&lt;br /&gt;
&lt;br /&gt;
Update Ubertooth firmware in ubertooth-2020-12-R1/ubertooth-one-firmware-bin:&lt;br /&gt;
&lt;br /&gt;
 sudo ubertooth-dfu -d bluetooth_rxtx.dfu -r&lt;br /&gt;
&lt;br /&gt;
In case the libubertooth library is not loading check if the paths are correct.&lt;br /&gt;
&lt;br /&gt;
In ubertooth-2020-12-R1/host the following command leads to getting a list of sniffed Bluetooth packets with their Lower Address Parts (LAP):&lt;br /&gt;
&lt;br /&gt;
 ubertooth-rx&lt;br /&gt;
&lt;br /&gt;
For collecting Upper Address Parts (UAP) from the captured packets add -z:&lt;br /&gt;
&lt;br /&gt;
 ubertooth-rx -z&lt;br /&gt;
&lt;br /&gt;
Let it run for a while and look at the output. It will be summarized as Survey Results at the end of the output. There you can see the significant part of Bluetooth addresses of devices that were scanned. &lt;br /&gt;
&lt;br /&gt;
=== Step 7 - Use BTLE to follow the connection of the Bluetooth device you found. (Replace with device Bluetooth Address) ===&lt;br /&gt;
&lt;br /&gt;
 ubertooth-btle -f B0:67:B5:CF:E5:10 -r test.pcap&lt;br /&gt;
&lt;br /&gt;
Or create a pipe for viewing the captures directly in Wireshark:&lt;br /&gt;
&lt;br /&gt;
 mkfifo /tmp/pipe&lt;br /&gt;
 ubertooth-btle -f B0:67:B5:CF:E5:10 -c /tmp/pipe&lt;br /&gt;
&lt;br /&gt;
Find packages that involve the Polar Smartwatch&lt;br /&gt;
&lt;br /&gt;
 systime=1728247529 freq=2402 addr=8e89bed6 delta_t=34.320 ms rssi=-60&lt;br /&gt;
 20 1b c9 28 84 1a 9e a0 02 01 06 03 02 ee fe 0d ff 6b 00 72 08 00 00 00 00 00 00 00 00 47 e9 1f &lt;br /&gt;
 Advertising / AA 8e89bed6 (valid)/ 27 bytes&lt;br /&gt;
     Channel Index: 37&lt;br /&gt;
     Type:  ADV_IND&lt;br /&gt;
     AdvA:  a0:9e:1a:84:28:c9 (public)&lt;br /&gt;
     AdvData: 02 01 06 03 02 ee fe 0d ff 6b 00 72 08 00 00 00 00 00 00 00 00&lt;br /&gt;
         Type 01 (Flags)&lt;br /&gt;
            00000110&lt;br /&gt;
                LE General Discoverable Mode&lt;br /&gt;
                BR/EDR Not Supported&lt;br /&gt;
         Type 02 (16-bit Service UUIDs, more available)&lt;br /&gt;
            feee&lt;br /&gt;
         Type ff (Manufacturer Specific Data)&lt;br /&gt;
            Company: Polar Electro OY&lt;br /&gt;
            Data: 72 08 00 00 00 00 00 00 00 00&lt;br /&gt;
     Data:  c9 28 84 1a 9e a0 02 01 06 03 02 ee fe 0d ff 6b 00 72 08 00 00 00 00 00 00 00 00&lt;br /&gt;
     CRC:   47 e9 1f&lt;br /&gt;
&lt;br /&gt;
=== Step 8 - Use Crackle to crack packages ===&lt;br /&gt;
&lt;br /&gt;
Enter these commands:&lt;br /&gt;
&lt;br /&gt;
 git clone https://github.com/mikeryan/crackle.git&lt;br /&gt;
 cd crackle&lt;br /&gt;
 make&lt;br /&gt;
&lt;br /&gt;
Now try cracking your pcap.file&lt;br /&gt;
&lt;br /&gt;
 ./crackle -i &amp;lt;your_file.pcap&amp;gt; -o &amp;lt;your_new_output_file.pcap&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this case it wasnt possible to crack any packages from the smartwatch.&lt;br /&gt;
&lt;br /&gt;
=== Step 9 - Install bleak library ===&lt;br /&gt;
&lt;br /&gt;
 pip install bleak&lt;br /&gt;
&lt;br /&gt;
=== Step 10 - Write python script for reading device UUID ===&lt;br /&gt;
&lt;br /&gt;
Enter these commands in the shell&lt;br /&gt;
&lt;br /&gt;
 mkdir BLE-scripts&lt;br /&gt;
 cd BLE-scripts&lt;br /&gt;
 nano ble_scan.py&lt;br /&gt;
&lt;br /&gt;
Write simple script to read device UUID using BleakScaner.discover() method:&lt;br /&gt;
 &lt;br /&gt;
 import asyncio&lt;br /&gt;
 from bleak import BleakScanner&lt;br /&gt;
 async def scan():&lt;br /&gt;
     devices = await BleakScanner.discover()&lt;br /&gt;
     for d in devices:&lt;br /&gt;
         print(d)&lt;br /&gt;
 asyncio.run(scan())&lt;br /&gt;
&lt;br /&gt;
Run a scan:&lt;br /&gt;
&lt;br /&gt;
 python3 BLE-scripts/ble_scan.py&lt;br /&gt;
&lt;br /&gt;
Here the device UUID of the Polar smartwatch was found:&lt;br /&gt;
&lt;br /&gt;
 C6C36C4A-7F8F-52B2-2BD7-C4F6690424E7: Polar Vantage M 8428C92D&lt;br /&gt;
&lt;br /&gt;
=== Step 11 - Check GATT services  ===&lt;br /&gt;
&lt;br /&gt;
With the gathered device UUID check for the devices services:&lt;br /&gt;
&lt;br /&gt;
 nano BLE-scripts/ble_services.py&lt;br /&gt;
&lt;br /&gt;
 import asyncio&lt;br /&gt;
 from bleak import BleakClient&lt;br /&gt;
 device_uuid = &amp;quot;C6C36C4A-7F8F-52B2-2BD7-C4F6690424E7&amp;quot;&lt;br /&gt;
 async def connect_to_device(device_uuid):&lt;br /&gt;
     async with BleakClient(device_uuid) as client:&lt;br /&gt;
         connected = client.is_connected&lt;br /&gt;
         print(f&amp;quot;Connected: {connected}&amp;quot;)&lt;br /&gt;
         services = client.services&lt;br /&gt;
         if services is None:&lt;br /&gt;
             await client.get_services()&lt;br /&gt;
         for service in services:&lt;br /&gt;
             print(f&amp;quot;Service: {service}&amp;quot;)&lt;br /&gt;
 loop = asyncio.get_event_loop()&lt;br /&gt;
 loop.run_until_complete(connect_to_device(device_uuid))&lt;br /&gt;
&lt;br /&gt;
Run a services scan:&lt;br /&gt;
&lt;br /&gt;
 python3 BLE-scripts/ble_services.py&lt;br /&gt;
&lt;br /&gt;
Now the service UUIDs that were found are going to be listed like this:&lt;br /&gt;
&lt;br /&gt;
 Service: 0000180a-0000-1000-8000-00805f9b34fb (Handle: 14): Device Information&lt;br /&gt;
 Service: 0000feee-0000-1000-8000-00805f9b34fb (Handle: 29): Polar Electro Oy&lt;br /&gt;
 Service: 0000180d-0000-1000-8000-00805f9b34fb (Handle: 38): Heart Rate&lt;br /&gt;
 Service: 0000180f-0000-1000-8000-00805f9b34fb (Handle: 42): Battery Service&lt;br /&gt;
&lt;br /&gt;
=== Step 12 - Get characteristics UUIDs  ===&lt;br /&gt;
&lt;br /&gt;
 nano BLE-scripts/ble_characteristics.py&lt;br /&gt;
&lt;br /&gt;
 import asyncio&lt;br /&gt;
 from bleak import BleakClient&lt;br /&gt;
 device_uuid = &amp;quot;C6C36C4A-7F8F-52B2-2BD7-C4F6690424E7&amp;quot;&lt;br /&gt;
 async def connect_to_device(device_uuid):&lt;br /&gt;
     async with BleakClient(device_uuid) as client:&lt;br /&gt;
         connected = client.is_connected&lt;br /&gt;
         print(f&amp;quot;Connected: {connected}&amp;quot;)&lt;br /&gt;
         services = client.services&lt;br /&gt;
         if services is None:&lt;br /&gt;
             await client.get_services()&lt;br /&gt;
         for service in services:&lt;br /&gt;
             print(f&amp;quot;Service: {service.uuid} (Handle: {service.handle}): {service.description}&amp;quot;)&lt;br /&gt;
             for characteristic in service.characteristics:&lt;br /&gt;
                 print(f&amp;quot;  Characteristic: {characteristic.uuid} (Handle: {characteristic.handle}) - Properties: {cha$&lt;br /&gt;
 loop = asyncio.get_event_loop()&lt;br /&gt;
 loop.run_until_complete(connect_to_device(device_uuid))&lt;br /&gt;
&lt;br /&gt;
Now run the script:&lt;br /&gt;
&lt;br /&gt;
 python3 BLE-scripts/ble_characteristics.py&lt;br /&gt;
&lt;br /&gt;
Expected output:&lt;br /&gt;
&lt;br /&gt;
 Service: 0000180a-0000-1000-8000-00805f9b34fb (Handle: 14): Device Information&lt;br /&gt;
  Characteristic: 00002a29-0000-1000-8000-00805f9b34fb (Handle: 15) - Properties: [&#039;read&#039;]&lt;br /&gt;
  Characteristic: 00002a24-0000-1000-8000-00805f9b34fb (Handle: 17) - Properties: [&#039;read&#039;]&lt;br /&gt;
  Characteristic: 00002a25-0000-1000-8000-00805f9b34fb (Handle: 19) - Properties: [&#039;read&#039;]&lt;br /&gt;
  Characteristic: 00002a27-0000-1000-8000-00805f9b34fb (Handle: 21) - Properties: [&#039;read&#039;]&lt;br /&gt;
  Characteristic: 00002a26-0000-1000-8000-00805f9b34fb (Handle: 23) - Properties: [&#039;read&#039;]&lt;br /&gt;
  Characteristic: 00002a28-0000-1000-8000-00805f9b34fb (Handle: 25) - Properties: [&#039;read&#039;]&lt;br /&gt;
  Characteristic: 00002a23-0000-1000-8000-00805f9b34fb (Handle: 27) - Properties: [&#039;read&#039;]&lt;br /&gt;
 Service: 0000feee-0000-1000-8000-00805f9b34fb (Handle: 29): Polar Electro Oy&lt;br /&gt;
  Characteristic: fb005c51-02e7-f387-1cad-8acd2d8df0c8 (Handle: 30) - Properties: [&#039;write-without-response&#039;, &#039;write&#039;, &#039;notify&#039;]&lt;br /&gt;
  Characteristic: fb005c52-02e7-f387-1cad-8acd2d8df0c8 (Handle: 33) - Properties: [&#039;notify&#039;]&lt;br /&gt;
  Characteristic: fb005c53-02e7-f387-1cad-8acd2d8df0c8 (Handle: 36) - Properties: [&#039;write-without-response&#039;, &#039;write&#039;]&lt;br /&gt;
 Service: 0000180d-0000-1000-8000-00805f9b34fb (Handle: 38): Heart Rate&lt;br /&gt;
  Characteristic: 00002a37-0000-1000-8000-00805f9b34fb (Handle: 39) - Properties: [&#039;notify&#039;]&lt;br /&gt;
 Service: 0000180f-0000-1000-8000-00805f9b34fb (Handle: 42): Battery Service&lt;br /&gt;
  Characteristic: 00002a19-0000-1000-8000-00805f9b34fb (Handle: 43) - Properties: [&#039;read&#039;, &#039;notify&#039;]&lt;br /&gt;
&lt;br /&gt;
=== Step 13 - Read data ===&lt;br /&gt;
&lt;br /&gt;
Now add a script for reading the actual data. Make sure to use the characteristics UUIDs you have found out.&lt;br /&gt;
&lt;br /&gt;
 nano BLE-scripts/ble_read.py&lt;br /&gt;
&lt;br /&gt;
 import asyncio&lt;br /&gt;
 from bleak import BleakClient&lt;br /&gt;
 device_uuid = &amp;quot;C6C36C4A-7F8F-52B2-2BD7-C4F6690424E7&amp;quot;&lt;br /&gt;
 HEART_RATE_CHAR_UUID = &amp;quot;00002a37-0000-1000-8000-00805f9b34fb&amp;quot;&lt;br /&gt;
 BATTERY_LEVEL_CHAR_UUID = &amp;quot;00002a19-0000-1000-8000-00805f9b34fb&amp;quot;&lt;br /&gt;
 async def connect_and_read_data(device_uuid):&lt;br /&gt;
     async with BleakClient(device_uuid) as client:&lt;br /&gt;
         connected = client.is_connected&lt;br /&gt;
         print(f&amp;quot;Connected: {connected}&amp;quot;)&lt;br /&gt;
         if connected:&lt;br /&gt;
             try:&lt;br /&gt;
                 heart_rate = await client.read_gatt_char(HEART_RATE_CHAR_UUID)&lt;br /&gt;
                 heart_rate = int(heart_rate_data[1])&lt;br /&gt;
                 print(f&amp;quot;Heart Rate: {heart_rate} bpm&amp;quot;)&lt;br /&gt;
             except Exception as e:&lt;br /&gt;
                 print(f&amp;quot;Failed to read heart rate: {e}&amp;quot;)&lt;br /&gt;
             try:&lt;br /&gt;
                 battery_level = await client.read_gatt_char(BATTERY_LEVEL_CHAR_UUID)&lt;br /&gt;
                 print(f&amp;quot;Battery Level: {int(battery_level[0])}%&amp;quot;)&lt;br /&gt;
             except Exception as e:&lt;br /&gt;
                 print(f&amp;quot;Failed to read battery level: {e}&amp;quot;)&lt;br /&gt;
 loop = asyncio.get_event_loop()&lt;br /&gt;
 loop.run_until_complete(connect_and_read_data(device_uuid))&lt;br /&gt;
&lt;br /&gt;
Run script:&lt;br /&gt;
&lt;br /&gt;
 python3 BLE-scripts/ble_read.py&lt;br /&gt;
&lt;br /&gt;
In the output the battery level was succesfully read and printed out. The heart rate couldn&#039;t be accessed because it only has the notify property and no option for reading:&lt;br /&gt;
&lt;br /&gt;
 Connected: True&lt;br /&gt;
 Failed to read heart rate: Failed to read characteristic 39: Error Domain=CBATTErrorDomain Code=2 &amp;quot;Reading is not permitted.&amp;quot; UserInfo={NSLocalizedDescription=Reading is not permitted.}&lt;br /&gt;
 Battery Level: 16%&lt;br /&gt;
&lt;br /&gt;
=== Step 14 - Subscribe to heart rate notifications ===&lt;br /&gt;
&lt;br /&gt;
 nano BLE-scripts/ble_subscribe.py&lt;br /&gt;
&lt;br /&gt;
 import asyncio&lt;br /&gt;
 from bleak import BleakClient&lt;br /&gt;
 device_uuid = &amp;quot;C6C36C4A-7F8F-52B2-2BD7-C4F6690424E7&amp;quot;&lt;br /&gt;
 HEART_RATE_CHAR_UUID = &amp;quot;00002a37-0000-1000-8000-00805f9b34fb&amp;quot;&lt;br /&gt;
 def heart_rate_handler(sender, data):&lt;br /&gt;
     heart_rate = int(data[1]) if len(data) &amp;gt; 1 else None&lt;br /&gt;
     print(f&amp;quot;Heart Rate from {sender}: {heart_rate} bpm&amp;quot;)&lt;br /&gt;
 async def connect_and_subscribe(device_uuid):&lt;br /&gt;
     async with BleakClient(device_uuid) as client:&lt;br /&gt;
         connected = client.is_connected&lt;br /&gt;
         print(f&amp;quot;Connected: {connected}&amp;quot;)&lt;br /&gt;
         if connected:&lt;br /&gt;
             try:&lt;br /&gt;
                 await client.start_notify(HEART_RATE_CHAR_UUID, heart_rate_handler)&lt;br /&gt;
                 print(&amp;quot;Subscribed to heart rate notifications.&amp;quot;)&lt;br /&gt;
                 await asyncio.sleep(60)&lt;br /&gt;
                 await client.stop_notify(HEART_RATE_CHAR_UUID)&lt;br /&gt;
                 print(&amp;quot;Stopped heart rate notifications.&amp;quot;)&lt;br /&gt;
             except Exception as e:&lt;br /&gt;
                 print(f&amp;quot;Failed to subscribe to heart rate notifications: {e}&amp;quot;)&lt;br /&gt;
 asyncio.run(connect_and_subscribe(device_uuid))&lt;br /&gt;
&lt;br /&gt;
 python3 BLE-scripts/ble_subscribe.py&lt;br /&gt;
&lt;br /&gt;
It was not possible to get the heart rate data even though the notify property was assigned. That is because typically battery status data is on a lower securiy level than heart rate data. This is the output of the failed try:&lt;br /&gt;
&lt;br /&gt;
 Connected: True&lt;br /&gt;
 Subscribed to heart rate notifications.&lt;br /&gt;
 Stopped heart rate notifications.&lt;br /&gt;
&lt;br /&gt;
== Used Hardware ==&lt;br /&gt;
&lt;br /&gt;
[[Ubertooth One, 2.4 GHz wireless development platform]]&lt;br /&gt;
&lt;br /&gt;
[[Polar Vantage M]]&lt;br /&gt;
&lt;br /&gt;
[[Apple iPhone 13 mini]]&lt;br /&gt;
&lt;br /&gt;
[[MacBook Air M1, 2020]]&lt;br /&gt;
&lt;br /&gt;
[[Samsung Galaxy J3]]&lt;br /&gt;
&lt;br /&gt;
== Courses ==&lt;br /&gt;
&lt;br /&gt;
* [[A course where this documentation was used]] (2017, 2018)&lt;br /&gt;
* [[Another one]] (2018)&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
* https://wikipedia.org&lt;br /&gt;
* https://google.com&lt;br /&gt;
&lt;br /&gt;
[[Category:Documentation]]&lt;/div&gt;</summary>
		<author><name>AMaksimovic</name></author>
	</entry>
	<entry>
		<id>https://elvis.hcw.ac.at/wiki/index.php?title=Setting_Up_Ubertooth_on_macOS_for_Bluetooth_Hacking&amp;diff=16672</id>
		<title>Setting Up Ubertooth on macOS for Bluetooth Hacking</title>
		<link rel="alternate" type="text/html" href="https://elvis.hcw.ac.at/wiki/index.php?title=Setting_Up_Ubertooth_on_macOS_for_Bluetooth_Hacking&amp;diff=16672"/>
		<updated>2024-12-05T00:27:24Z</updated>

		<summary type="html">&lt;p&gt;AMaksimovic: /* Used Hardware */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Summary == &lt;br /&gt;
&lt;br /&gt;
This is a step-by-step guide on how to sniff Bluetooth Low Energy (BLE) packets between a Polar Vantage Smartwatch and a phone using the Ubertooth One. It will go into detail on the setup on a MacBook Air with MacOS using a python environment for the libraries that are used for the setup. Additionally every step of the actual sniff will be outlined. This guide is based on the seminar paper &amp;quot;Smartwatch Hacking Attack&amp;quot; that was written within the FH-course &amp;quot;Selected IT-Security Chapters&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
== Requirements ==&lt;br /&gt;
&lt;br /&gt;
* Hardware tools: Ubertooth One: Firmware version: 2020-12-R1 (API:1.07)&lt;br /&gt;
* Unix-based Operating System: macOS (macOS Sequoia 15.1.1), on a MacBook Air with an Apple M1 chip.&lt;br /&gt;
* Virtual Environment: Python Environment: Python 3.12&lt;br /&gt;
* Packages: libusb, wget, cmake, pkg-config, setuptools, pyqt5, numpy&lt;br /&gt;
* Libraries: libbtbb, bleak&lt;br /&gt;
* Software Tools: Crackle&lt;br /&gt;
&lt;br /&gt;
For the setup this guide was used and adjusted to the given scenario. [[Ubertooth - Build Guide - https://ubertooth.readthedocs.io/en/latest/build_guide.html]].&lt;br /&gt;
&lt;br /&gt;
== Description ==&lt;br /&gt;
&lt;br /&gt;
=== Step 1 - Install homebrew ===&lt;br /&gt;
&lt;br /&gt;
Enter these commands in the shell&lt;br /&gt;
&lt;br /&gt;
 /bin/bash -c &amp;quot;$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)&amp;quot;&lt;br /&gt;
 eval &amp;quot;$(/opt/homebrew/bin/brew shellenv)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
=== Step 2 - Install Python Environment ===&lt;br /&gt;
&lt;br /&gt;
Enter these commands in the shell&lt;br /&gt;
&lt;br /&gt;
 python3.12 -m venv myenv&lt;br /&gt;
 source myenv/bin/activate&lt;br /&gt;
&lt;br /&gt;
=== Step 3 - Install libusb, wget, cmake, pkg-config ===&lt;br /&gt;
&lt;br /&gt;
Enter these commands in the shell&lt;br /&gt;
&lt;br /&gt;
 brew install libusb wget cmake pkg-config&lt;br /&gt;
&lt;br /&gt;
=== Step 4 - Install the Bluetooth baseband library ===&lt;br /&gt;
&lt;br /&gt;
Enter these commands in the shell&lt;br /&gt;
&lt;br /&gt;
 wget https://github.com/greatscottgadgets/libbtbb/archive/2020-12-R1.tar.gz -O libbtbb-2020-12-R1.tar.gz&lt;br /&gt;
 tar -xf libbtbb-2020-12-R1.tar.gz&lt;br /&gt;
 cd libbtbb-2020-12-R1&lt;br /&gt;
 mkdir build&lt;br /&gt;
 cd build&lt;br /&gt;
 cmake ..&lt;br /&gt;
 make&lt;br /&gt;
&lt;br /&gt;
If errors occur with installing distutils switch to setuptools instead.&lt;br /&gt;
&lt;br /&gt;
 pip install setuptools&lt;br /&gt;
&lt;br /&gt;
After installing the setuptools also change the &amp;quot;from distutils import setup&amp;quot; line in the the libbtbb-2020-12-R1/build/python/pcaptools/setup.py file to this:&lt;br /&gt;
&lt;br /&gt;
 from setuptools import setup&lt;br /&gt;
&lt;br /&gt;
Also update the version in that same file to this:&lt;br /&gt;
&lt;br /&gt;
 version = &#039;2020.12.R1&#039;&lt;br /&gt;
&lt;br /&gt;
If necessary set the pythonpath in case you have different python versions:&lt;br /&gt;
 &lt;br /&gt;
 export PYTHONPATH=/Users/&amp;lt;username&amp;gt;/myenv/lib/python3.12/site-packages:$PYTHONPATH&lt;br /&gt;
&lt;br /&gt;
Then retry:&lt;br /&gt;
&lt;br /&gt;
 make&lt;br /&gt;
&lt;br /&gt;
 sudo make install&lt;br /&gt;
&lt;br /&gt;
=== Step 5 - Install the Ubertooth repository ===&lt;br /&gt;
&lt;br /&gt;
Enter these commands in the shell&lt;br /&gt;
&lt;br /&gt;
 wget https://github.com/greatscottgadgets/ubertooth/releases/download/2020-12-R1/ubertooth-2020-12-R1.tar.xz&lt;br /&gt;
 tar -xf ubertooth-2020-12-R1.tar.xz&lt;br /&gt;
 cd ubertooth-2020-12-R1/host&lt;br /&gt;
 mkdir build&lt;br /&gt;
 cd build&lt;br /&gt;
 cmake ..&lt;br /&gt;
 make&lt;br /&gt;
&lt;br /&gt;
If libusb module not found errors occur go to ubertooth-2020-12-R1/host/CMakeLists.txt an add your libusb-path manually:&lt;br /&gt;
&lt;br /&gt;
 include_directories(/opt/homebrew/include)&lt;br /&gt;
 link_directories(/opt/homebrew/lib)&lt;br /&gt;
&lt;br /&gt;
Additionally again change the &amp;quot;from distutils import setup&amp;quot; line in the the ubertooth-2020-12-R1/host/build/python/specan_ui/setup.py file to this:&lt;br /&gt;
&lt;br /&gt;
 from setuptools import setup&lt;br /&gt;
&lt;br /&gt;
Also update the version in that same file to this:&lt;br /&gt;
&lt;br /&gt;
 version = &#039;2020.12.R1&#039;&lt;br /&gt;
&lt;br /&gt;
Then retry:&lt;br /&gt;
&lt;br /&gt;
 make&lt;br /&gt;
&lt;br /&gt;
 sudo make install&lt;br /&gt;
&lt;br /&gt;
If you get errors regarding the environment variables showing that your library wasnt found you need to set the library path via the MacOs&#039;s dynamic linker.&lt;br /&gt;
&lt;br /&gt;
 export DYLD_LIBRARY_PATH=&amp;quot;/usr/local/lib:$DYLD_LIBRARY_PATH&amp;quot;&lt;br /&gt;
&lt;br /&gt;
or make it persistent in shell configurations: &lt;br /&gt;
&lt;br /&gt;
 ~/.zshrc&lt;br /&gt;
&lt;br /&gt;
Afterwards confirm the ubertooth library is working correctly:&lt;br /&gt;
&lt;br /&gt;
 ubertooth-util&lt;br /&gt;
&lt;br /&gt;
=== Step 6 - Test Ubertooth One commands ===&lt;br /&gt;
&lt;br /&gt;
Test these commands:&lt;br /&gt;
&lt;br /&gt;
 ubertooth-util -H&lt;br /&gt;
 ubertooth-util -v&lt;br /&gt;
 ubertooth-util -p&lt;br /&gt;
 ubertooth-util -s&lt;br /&gt;
&lt;br /&gt;
Update Ubertooth firmware in ubertooth-2020-12-R1/ubertooth-one-firmware-bin:&lt;br /&gt;
&lt;br /&gt;
 sudo ubertooth-dfu -d bluetooth_rxtx.dfu -r&lt;br /&gt;
&lt;br /&gt;
In case the libubertooth library is not loading check if the paths are correct.&lt;br /&gt;
&lt;br /&gt;
In ubertooth-2020-12-R1/host the following command leads to getting a list of sniffed Bluetooth packets with their Lower Address Parts (LAP):&lt;br /&gt;
&lt;br /&gt;
 ubertooth-rx&lt;br /&gt;
&lt;br /&gt;
For collecting Upper Address Parts (UAP) from the captured packets add -z:&lt;br /&gt;
&lt;br /&gt;
 ubertooth-rx -z&lt;br /&gt;
&lt;br /&gt;
Let it run for a while and look at the output. It will be summarized as Survey Results at the end of the output. There you can see the significant part of Bluetooth addresses of devices that were scanned. &lt;br /&gt;
&lt;br /&gt;
=== Step 7 - Use BTLE to follow the connection of the Bluetooth device you found. (Replace with device Bluetooth Address) ===&lt;br /&gt;
&lt;br /&gt;
 ubertooth-btle -f B0:67:B5:CF:E5:10 -r test.pcap&lt;br /&gt;
&lt;br /&gt;
Or create a pipe for viewing the captures directly in Wireshark:&lt;br /&gt;
&lt;br /&gt;
 mkfifo /tmp/pipe&lt;br /&gt;
 ubertooth-btle -f B0:67:B5:CF:E5:10 -c /tmp/pipe&lt;br /&gt;
&lt;br /&gt;
Find packages that involve the Polar Smartwatch&lt;br /&gt;
&lt;br /&gt;
 systime=1728247529 freq=2402 addr=8e89bed6 delta_t=34.320 ms rssi=-60&lt;br /&gt;
 20 1b c9 28 84 1a 9e a0 02 01 06 03 02 ee fe 0d ff 6b 00 72 08 00 00 00 00 00 00 00 00 47 e9 1f &lt;br /&gt;
 Advertising / AA 8e89bed6 (valid)/ 27 bytes&lt;br /&gt;
     Channel Index: 37&lt;br /&gt;
     Type:  ADV_IND&lt;br /&gt;
     AdvA:  a0:9e:1a:84:28:c9 (public)&lt;br /&gt;
     AdvData: 02 01 06 03 02 ee fe 0d ff 6b 00 72 08 00 00 00 00 00 00 00 00&lt;br /&gt;
         Type 01 (Flags)&lt;br /&gt;
            00000110&lt;br /&gt;
                LE General Discoverable Mode&lt;br /&gt;
                BR/EDR Not Supported&lt;br /&gt;
         Type 02 (16-bit Service UUIDs, more available)&lt;br /&gt;
            feee&lt;br /&gt;
         Type ff (Manufacturer Specific Data)&lt;br /&gt;
            Company: Polar Electro OY&lt;br /&gt;
            Data: 72 08 00 00 00 00 00 00 00 00&lt;br /&gt;
     Data:  c9 28 84 1a 9e a0 02 01 06 03 02 ee fe 0d ff 6b 00 72 08 00 00 00 00 00 00 00 00&lt;br /&gt;
     CRC:   47 e9 1f&lt;br /&gt;
&lt;br /&gt;
=== Step 8 - Use Crackle to crack packages ===&lt;br /&gt;
&lt;br /&gt;
Enter these commands:&lt;br /&gt;
&lt;br /&gt;
 git clone https://github.com/mikeryan/crackle.git&lt;br /&gt;
 cd crackle&lt;br /&gt;
 make&lt;br /&gt;
&lt;br /&gt;
Now try cracking your pcap.file&lt;br /&gt;
&lt;br /&gt;
 ./crackle -i &amp;lt;your_file.pcap&amp;gt; -o &amp;lt;your_new_output_file.pcap&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this case it wasnt possible to crack any packages from the smartwatch.&lt;br /&gt;
&lt;br /&gt;
=== Step 9 - Install bleak library ===&lt;br /&gt;
&lt;br /&gt;
 pip install bleak&lt;br /&gt;
&lt;br /&gt;
=== Step 10 - Write python script for reading device UUID ===&lt;br /&gt;
&lt;br /&gt;
Enter these commands in the shell&lt;br /&gt;
&lt;br /&gt;
 mkdir BLE-scripts&lt;br /&gt;
 cd BLE-scripts&lt;br /&gt;
 nano ble_scan.py&lt;br /&gt;
&lt;br /&gt;
Write simple script to read device UUID using BleakScaner.discover() method:&lt;br /&gt;
 &lt;br /&gt;
 import asyncio&lt;br /&gt;
 from bleak import BleakScanner&lt;br /&gt;
 async def scan():&lt;br /&gt;
     devices = await BleakScanner.discover()&lt;br /&gt;
     for d in devices:&lt;br /&gt;
         print(d)&lt;br /&gt;
 asyncio.run(scan())&lt;br /&gt;
&lt;br /&gt;
Run a scan:&lt;br /&gt;
&lt;br /&gt;
 python3 BLE-scripts/ble_scan.py&lt;br /&gt;
&lt;br /&gt;
Here the device UUID of the Polar smartwatch was found:&lt;br /&gt;
&lt;br /&gt;
 C6C36C4A-7F8F-52B2-2BD7-C4F6690424E7: Polar Vantage M 8428C92D&lt;br /&gt;
&lt;br /&gt;
=== Step 11 - Check GATT services  ===&lt;br /&gt;
&lt;br /&gt;
With the gathered device UUID check for the devices services:&lt;br /&gt;
&lt;br /&gt;
 nano BLE-scripts/ble_services.py&lt;br /&gt;
&lt;br /&gt;
 import asyncio&lt;br /&gt;
 from bleak import BleakClient&lt;br /&gt;
 device_uuid = &amp;quot;C6C36C4A-7F8F-52B2-2BD7-C4F6690424E7&amp;quot;&lt;br /&gt;
 async def connect_to_device(device_uuid):&lt;br /&gt;
     async with BleakClient(device_uuid) as client:&lt;br /&gt;
         connected = client.is_connected&lt;br /&gt;
         print(f&amp;quot;Connected: {connected}&amp;quot;)&lt;br /&gt;
         services = client.services&lt;br /&gt;
         if services is None:&lt;br /&gt;
             await client.get_services()&lt;br /&gt;
         for service in services:&lt;br /&gt;
             print(f&amp;quot;Service: {service}&amp;quot;)&lt;br /&gt;
 loop = asyncio.get_event_loop()&lt;br /&gt;
 loop.run_until_complete(connect_to_device(device_uuid))&lt;br /&gt;
&lt;br /&gt;
Run a services scan:&lt;br /&gt;
&lt;br /&gt;
 python3 BLE-scripts/ble_services.py&lt;br /&gt;
&lt;br /&gt;
Now the service UUIDs that were found are going to be listed like this:&lt;br /&gt;
&lt;br /&gt;
 Service: 0000180a-0000-1000-8000-00805f9b34fb (Handle: 14): Device Information&lt;br /&gt;
 Service: 0000feee-0000-1000-8000-00805f9b34fb (Handle: 29): Polar Electro Oy&lt;br /&gt;
 Service: 0000180d-0000-1000-8000-00805f9b34fb (Handle: 38): Heart Rate&lt;br /&gt;
 Service: 0000180f-0000-1000-8000-00805f9b34fb (Handle: 42): Battery Service&lt;br /&gt;
&lt;br /&gt;
=== Step 12 - Get characteristics UUIDs  ===&lt;br /&gt;
&lt;br /&gt;
 nano BLE-scripts/ble_characteristics.py&lt;br /&gt;
&lt;br /&gt;
 import asyncio&lt;br /&gt;
 from bleak import BleakClient&lt;br /&gt;
 device_uuid = &amp;quot;C6C36C4A-7F8F-52B2-2BD7-C4F6690424E7&amp;quot;&lt;br /&gt;
 async def connect_to_device(device_uuid):&lt;br /&gt;
     async with BleakClient(device_uuid) as client:&lt;br /&gt;
         connected = client.is_connected&lt;br /&gt;
         print(f&amp;quot;Connected: {connected}&amp;quot;)&lt;br /&gt;
         services = client.services&lt;br /&gt;
         if services is None:&lt;br /&gt;
             await client.get_services()&lt;br /&gt;
         for service in services:&lt;br /&gt;
             print(f&amp;quot;Service: {service.uuid} (Handle: {service.handle}): {service.description}&amp;quot;)&lt;br /&gt;
             for characteristic in service.characteristics:&lt;br /&gt;
                 print(f&amp;quot;  Characteristic: {characteristic.uuid} (Handle: {characteristic.handle}) - Properties: {cha$&lt;br /&gt;
 loop = asyncio.get_event_loop()&lt;br /&gt;
 loop.run_until_complete(connect_to_device(device_uuid))&lt;br /&gt;
&lt;br /&gt;
Now run the script:&lt;br /&gt;
&lt;br /&gt;
 python3 BLE-scripts/ble_characteristics.py&lt;br /&gt;
&lt;br /&gt;
Expected output:&lt;br /&gt;
&lt;br /&gt;
 Service: 0000180a-0000-1000-8000-00805f9b34fb (Handle: 14): Device Information&lt;br /&gt;
  Characteristic: 00002a29-0000-1000-8000-00805f9b34fb (Handle: 15) - Properties: [&#039;read&#039;]&lt;br /&gt;
  Characteristic: 00002a24-0000-1000-8000-00805f9b34fb (Handle: 17) - Properties: [&#039;read&#039;]&lt;br /&gt;
  Characteristic: 00002a25-0000-1000-8000-00805f9b34fb (Handle: 19) - Properties: [&#039;read&#039;]&lt;br /&gt;
  Characteristic: 00002a27-0000-1000-8000-00805f9b34fb (Handle: 21) - Properties: [&#039;read&#039;]&lt;br /&gt;
  Characteristic: 00002a26-0000-1000-8000-00805f9b34fb (Handle: 23) - Properties: [&#039;read&#039;]&lt;br /&gt;
  Characteristic: 00002a28-0000-1000-8000-00805f9b34fb (Handle: 25) - Properties: [&#039;read&#039;]&lt;br /&gt;
  Characteristic: 00002a23-0000-1000-8000-00805f9b34fb (Handle: 27) - Properties: [&#039;read&#039;]&lt;br /&gt;
 Service: 0000feee-0000-1000-8000-00805f9b34fb (Handle: 29): Polar Electro Oy&lt;br /&gt;
  Characteristic: fb005c51-02e7-f387-1cad-8acd2d8df0c8 (Handle: 30) - Properties: [&#039;write-without-response&#039;, &#039;write&#039;, &#039;notify&#039;]&lt;br /&gt;
  Characteristic: fb005c52-02e7-f387-1cad-8acd2d8df0c8 (Handle: 33) - Properties: [&#039;notify&#039;]&lt;br /&gt;
  Characteristic: fb005c53-02e7-f387-1cad-8acd2d8df0c8 (Handle: 36) - Properties: [&#039;write-without-response&#039;, &#039;write&#039;]&lt;br /&gt;
 Service: 0000180d-0000-1000-8000-00805f9b34fb (Handle: 38): Heart Rate&lt;br /&gt;
  Characteristic: 00002a37-0000-1000-8000-00805f9b34fb (Handle: 39) - Properties: [&#039;notify&#039;]&lt;br /&gt;
 Service: 0000180f-0000-1000-8000-00805f9b34fb (Handle: 42): Battery Service&lt;br /&gt;
  Characteristic: 00002a19-0000-1000-8000-00805f9b34fb (Handle: 43) - Properties: [&#039;read&#039;, &#039;notify&#039;]&lt;br /&gt;
&lt;br /&gt;
=== Step 13 - Read data ===&lt;br /&gt;
&lt;br /&gt;
Now add a script for reading the actual data. Make sure to use the characteristics UUIDs you have found out.&lt;br /&gt;
&lt;br /&gt;
 nano BLE-scripts/ble_read.py&lt;br /&gt;
&lt;br /&gt;
 import asyncio&lt;br /&gt;
 from bleak import BleakClient&lt;br /&gt;
 device_uuid = &amp;quot;C6C36C4A-7F8F-52B2-2BD7-C4F6690424E7&amp;quot;&lt;br /&gt;
 HEART_RATE_CHAR_UUID = &amp;quot;00002a37-0000-1000-8000-00805f9b34fb&amp;quot;&lt;br /&gt;
 BATTERY_LEVEL_CHAR_UUID = &amp;quot;00002a19-0000-1000-8000-00805f9b34fb&amp;quot;&lt;br /&gt;
 async def connect_and_read_data(device_uuid):&lt;br /&gt;
     async with BleakClient(device_uuid) as client:&lt;br /&gt;
         connected = client.is_connected&lt;br /&gt;
         print(f&amp;quot;Connected: {connected}&amp;quot;)&lt;br /&gt;
         if connected:&lt;br /&gt;
             try:&lt;br /&gt;
                 heart_rate = await client.read_gatt_char(HEART_RATE_CHAR_UUID)&lt;br /&gt;
                 heart_rate = int(heart_rate_data[1])&lt;br /&gt;
                 print(f&amp;quot;Heart Rate: {heart_rate} bpm&amp;quot;)&lt;br /&gt;
             except Exception as e:&lt;br /&gt;
                 print(f&amp;quot;Failed to read heart rate: {e}&amp;quot;)&lt;br /&gt;
             try:&lt;br /&gt;
                 battery_level = await client.read_gatt_char(BATTERY_LEVEL_CHAR_UUID)&lt;br /&gt;
                 print(f&amp;quot;Battery Level: {int(battery_level[0])}%&amp;quot;)&lt;br /&gt;
             except Exception as e:&lt;br /&gt;
                 print(f&amp;quot;Failed to read battery level: {e}&amp;quot;)&lt;br /&gt;
 loop = asyncio.get_event_loop()&lt;br /&gt;
 loop.run_until_complete(connect_and_read_data(device_uuid))&lt;br /&gt;
&lt;br /&gt;
Run script:&lt;br /&gt;
&lt;br /&gt;
 python3 BLE-scripts/ble_read.py&lt;br /&gt;
&lt;br /&gt;
In the output the battery level was succesfully read and printed out. The heart rate couldn&#039;t be accessed because it only has the notify property and no option for reading:&lt;br /&gt;
&lt;br /&gt;
 Connected: True&lt;br /&gt;
 Failed to read heart rate: Failed to read characteristic 39: Error Domain=CBATTErrorDomain Code=2 &amp;quot;Reading is not permitted.&amp;quot; UserInfo={NSLocalizedDescription=Reading is not permitted.}&lt;br /&gt;
 Battery Level: 16%&lt;br /&gt;
&lt;br /&gt;
=== Step 14 - Subscribe to heart rate notifications ===&lt;br /&gt;
&lt;br /&gt;
 nano BLE-scripts/ble_subscribe.py&lt;br /&gt;
&lt;br /&gt;
 import asyncio&lt;br /&gt;
 from bleak import BleakClient&lt;br /&gt;
 device_uuid = &amp;quot;C6C36C4A-7F8F-52B2-2BD7-C4F6690424E7&amp;quot;&lt;br /&gt;
 HEART_RATE_CHAR_UUID = &amp;quot;00002a37-0000-1000-8000-00805f9b34fb&amp;quot;&lt;br /&gt;
 def heart_rate_handler(sender, data):&lt;br /&gt;
     heart_rate = int(data[1]) if len(data) &amp;gt; 1 else None&lt;br /&gt;
     print(f&amp;quot;Heart Rate from {sender}: {heart_rate} bpm&amp;quot;)&lt;br /&gt;
 async def connect_and_subscribe(device_uuid):&lt;br /&gt;
     async with BleakClient(device_uuid) as client:&lt;br /&gt;
         connected = client.is_connected&lt;br /&gt;
         print(f&amp;quot;Connected: {connected}&amp;quot;)&lt;br /&gt;
         if connected:&lt;br /&gt;
             try:&lt;br /&gt;
                 await client.start_notify(HEART_RATE_CHAR_UUID, heart_rate_handler)&lt;br /&gt;
                 print(&amp;quot;Subscribed to heart rate notifications.&amp;quot;)&lt;br /&gt;
                 await asyncio.sleep(60)&lt;br /&gt;
                 await client.stop_notify(HEART_RATE_CHAR_UUID)&lt;br /&gt;
                 print(&amp;quot;Stopped heart rate notifications.&amp;quot;)&lt;br /&gt;
             except Exception as e:&lt;br /&gt;
                 print(f&amp;quot;Failed to subscribe to heart rate notifications: {e}&amp;quot;)&lt;br /&gt;
 asyncio.run(connect_and_subscribe(device_uuid))&lt;br /&gt;
&lt;br /&gt;
 python3 BLE-scripts/ble_subscribe.py&lt;br /&gt;
&lt;br /&gt;
It was not possible to get the heart rate data even though the notify property was assigned. That is because typically battery status data is on a lower securiy level than heart rate data. This is the output of the failed try:&lt;br /&gt;
&lt;br /&gt;
 Connected: True&lt;br /&gt;
 Subscribed to heart rate notifications.&lt;br /&gt;
 Stopped heart rate notifications.&lt;br /&gt;
&lt;br /&gt;
== Used Hardware ==&lt;br /&gt;
&lt;br /&gt;
[[Ubertooth One, 2.4 GHz wireless development platform]]&lt;br /&gt;
[[Polar Vantage M]]&lt;br /&gt;
[[Apple iPhone 13 mini]]&lt;br /&gt;
[[MacBook Air M1, 2020]]&lt;br /&gt;
[[Samsung Galaxy J3]]&lt;br /&gt;
&lt;br /&gt;
== Courses ==&lt;br /&gt;
&lt;br /&gt;
* [[A course where this documentation was used]] (2017, 2018)&lt;br /&gt;
* [[Another one]] (2018)&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
* https://wikipedia.org&lt;br /&gt;
* https://google.com&lt;br /&gt;
&lt;br /&gt;
[[Category:Documentation]]&lt;/div&gt;</summary>
		<author><name>AMaksimovic</name></author>
	</entry>
	<entry>
		<id>https://elvis.hcw.ac.at/wiki/index.php?title=Setting_Up_Ubertooth_on_macOS_for_Bluetooth_Hacking&amp;diff=16671</id>
		<title>Setting Up Ubertooth on macOS for Bluetooth Hacking</title>
		<link rel="alternate" type="text/html" href="https://elvis.hcw.ac.at/wiki/index.php?title=Setting_Up_Ubertooth_on_macOS_for_Bluetooth_Hacking&amp;diff=16671"/>
		<updated>2024-12-05T00:27:09Z</updated>

		<summary type="html">&lt;p&gt;AMaksimovic: /* Requirements */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Summary == &lt;br /&gt;
&lt;br /&gt;
This is a step-by-step guide on how to sniff Bluetooth Low Energy (BLE) packets between a Polar Vantage Smartwatch and a phone using the Ubertooth One. It will go into detail on the setup on a MacBook Air with MacOS using a python environment for the libraries that are used for the setup. Additionally every step of the actual sniff will be outlined. This guide is based on the seminar paper &amp;quot;Smartwatch Hacking Attack&amp;quot; that was written within the FH-course &amp;quot;Selected IT-Security Chapters&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
== Requirements ==&lt;br /&gt;
&lt;br /&gt;
* Hardware tools: Ubertooth One: Firmware version: 2020-12-R1 (API:1.07)&lt;br /&gt;
* Unix-based Operating System: macOS (macOS Sequoia 15.1.1), on a MacBook Air with an Apple M1 chip.&lt;br /&gt;
* Virtual Environment: Python Environment: Python 3.12&lt;br /&gt;
* Packages: libusb, wget, cmake, pkg-config, setuptools, pyqt5, numpy&lt;br /&gt;
* Libraries: libbtbb, bleak&lt;br /&gt;
* Software Tools: Crackle&lt;br /&gt;
&lt;br /&gt;
For the setup this guide was used and adjusted to the given scenario. [[Ubertooth - Build Guide - https://ubertooth.readthedocs.io/en/latest/build_guide.html]].&lt;br /&gt;
&lt;br /&gt;
== Description ==&lt;br /&gt;
&lt;br /&gt;
=== Step 1 - Install homebrew ===&lt;br /&gt;
&lt;br /&gt;
Enter these commands in the shell&lt;br /&gt;
&lt;br /&gt;
 /bin/bash -c &amp;quot;$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)&amp;quot;&lt;br /&gt;
 eval &amp;quot;$(/opt/homebrew/bin/brew shellenv)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
=== Step 2 - Install Python Environment ===&lt;br /&gt;
&lt;br /&gt;
Enter these commands in the shell&lt;br /&gt;
&lt;br /&gt;
 python3.12 -m venv myenv&lt;br /&gt;
 source myenv/bin/activate&lt;br /&gt;
&lt;br /&gt;
=== Step 3 - Install libusb, wget, cmake, pkg-config ===&lt;br /&gt;
&lt;br /&gt;
Enter these commands in the shell&lt;br /&gt;
&lt;br /&gt;
 brew install libusb wget cmake pkg-config&lt;br /&gt;
&lt;br /&gt;
=== Step 4 - Install the Bluetooth baseband library ===&lt;br /&gt;
&lt;br /&gt;
Enter these commands in the shell&lt;br /&gt;
&lt;br /&gt;
 wget https://github.com/greatscottgadgets/libbtbb/archive/2020-12-R1.tar.gz -O libbtbb-2020-12-R1.tar.gz&lt;br /&gt;
 tar -xf libbtbb-2020-12-R1.tar.gz&lt;br /&gt;
 cd libbtbb-2020-12-R1&lt;br /&gt;
 mkdir build&lt;br /&gt;
 cd build&lt;br /&gt;
 cmake ..&lt;br /&gt;
 make&lt;br /&gt;
&lt;br /&gt;
If errors occur with installing distutils switch to setuptools instead.&lt;br /&gt;
&lt;br /&gt;
 pip install setuptools&lt;br /&gt;
&lt;br /&gt;
After installing the setuptools also change the &amp;quot;from distutils import setup&amp;quot; line in the the libbtbb-2020-12-R1/build/python/pcaptools/setup.py file to this:&lt;br /&gt;
&lt;br /&gt;
 from setuptools import setup&lt;br /&gt;
&lt;br /&gt;
Also update the version in that same file to this:&lt;br /&gt;
&lt;br /&gt;
 version = &#039;2020.12.R1&#039;&lt;br /&gt;
&lt;br /&gt;
If necessary set the pythonpath in case you have different python versions:&lt;br /&gt;
 &lt;br /&gt;
 export PYTHONPATH=/Users/&amp;lt;username&amp;gt;/myenv/lib/python3.12/site-packages:$PYTHONPATH&lt;br /&gt;
&lt;br /&gt;
Then retry:&lt;br /&gt;
&lt;br /&gt;
 make&lt;br /&gt;
&lt;br /&gt;
 sudo make install&lt;br /&gt;
&lt;br /&gt;
=== Step 5 - Install the Ubertooth repository ===&lt;br /&gt;
&lt;br /&gt;
Enter these commands in the shell&lt;br /&gt;
&lt;br /&gt;
 wget https://github.com/greatscottgadgets/ubertooth/releases/download/2020-12-R1/ubertooth-2020-12-R1.tar.xz&lt;br /&gt;
 tar -xf ubertooth-2020-12-R1.tar.xz&lt;br /&gt;
 cd ubertooth-2020-12-R1/host&lt;br /&gt;
 mkdir build&lt;br /&gt;
 cd build&lt;br /&gt;
 cmake ..&lt;br /&gt;
 make&lt;br /&gt;
&lt;br /&gt;
If libusb module not found errors occur go to ubertooth-2020-12-R1/host/CMakeLists.txt an add your libusb-path manually:&lt;br /&gt;
&lt;br /&gt;
 include_directories(/opt/homebrew/include)&lt;br /&gt;
 link_directories(/opt/homebrew/lib)&lt;br /&gt;
&lt;br /&gt;
Additionally again change the &amp;quot;from distutils import setup&amp;quot; line in the the ubertooth-2020-12-R1/host/build/python/specan_ui/setup.py file to this:&lt;br /&gt;
&lt;br /&gt;
 from setuptools import setup&lt;br /&gt;
&lt;br /&gt;
Also update the version in that same file to this:&lt;br /&gt;
&lt;br /&gt;
 version = &#039;2020.12.R1&#039;&lt;br /&gt;
&lt;br /&gt;
Then retry:&lt;br /&gt;
&lt;br /&gt;
 make&lt;br /&gt;
&lt;br /&gt;
 sudo make install&lt;br /&gt;
&lt;br /&gt;
If you get errors regarding the environment variables showing that your library wasnt found you need to set the library path via the MacOs&#039;s dynamic linker.&lt;br /&gt;
&lt;br /&gt;
 export DYLD_LIBRARY_PATH=&amp;quot;/usr/local/lib:$DYLD_LIBRARY_PATH&amp;quot;&lt;br /&gt;
&lt;br /&gt;
or make it persistent in shell configurations: &lt;br /&gt;
&lt;br /&gt;
 ~/.zshrc&lt;br /&gt;
&lt;br /&gt;
Afterwards confirm the ubertooth library is working correctly:&lt;br /&gt;
&lt;br /&gt;
 ubertooth-util&lt;br /&gt;
&lt;br /&gt;
=== Step 6 - Test Ubertooth One commands ===&lt;br /&gt;
&lt;br /&gt;
Test these commands:&lt;br /&gt;
&lt;br /&gt;
 ubertooth-util -H&lt;br /&gt;
 ubertooth-util -v&lt;br /&gt;
 ubertooth-util -p&lt;br /&gt;
 ubertooth-util -s&lt;br /&gt;
&lt;br /&gt;
Update Ubertooth firmware in ubertooth-2020-12-R1/ubertooth-one-firmware-bin:&lt;br /&gt;
&lt;br /&gt;
 sudo ubertooth-dfu -d bluetooth_rxtx.dfu -r&lt;br /&gt;
&lt;br /&gt;
In case the libubertooth library is not loading check if the paths are correct.&lt;br /&gt;
&lt;br /&gt;
In ubertooth-2020-12-R1/host the following command leads to getting a list of sniffed Bluetooth packets with their Lower Address Parts (LAP):&lt;br /&gt;
&lt;br /&gt;
 ubertooth-rx&lt;br /&gt;
&lt;br /&gt;
For collecting Upper Address Parts (UAP) from the captured packets add -z:&lt;br /&gt;
&lt;br /&gt;
 ubertooth-rx -z&lt;br /&gt;
&lt;br /&gt;
Let it run for a while and look at the output. It will be summarized as Survey Results at the end of the output. There you can see the significant part of Bluetooth addresses of devices that were scanned. &lt;br /&gt;
&lt;br /&gt;
=== Step 7 - Use BTLE to follow the connection of the Bluetooth device you found. (Replace with device Bluetooth Address) ===&lt;br /&gt;
&lt;br /&gt;
 ubertooth-btle -f B0:67:B5:CF:E5:10 -r test.pcap&lt;br /&gt;
&lt;br /&gt;
Or create a pipe for viewing the captures directly in Wireshark:&lt;br /&gt;
&lt;br /&gt;
 mkfifo /tmp/pipe&lt;br /&gt;
 ubertooth-btle -f B0:67:B5:CF:E5:10 -c /tmp/pipe&lt;br /&gt;
&lt;br /&gt;
Find packages that involve the Polar Smartwatch&lt;br /&gt;
&lt;br /&gt;
 systime=1728247529 freq=2402 addr=8e89bed6 delta_t=34.320 ms rssi=-60&lt;br /&gt;
 20 1b c9 28 84 1a 9e a0 02 01 06 03 02 ee fe 0d ff 6b 00 72 08 00 00 00 00 00 00 00 00 47 e9 1f &lt;br /&gt;
 Advertising / AA 8e89bed6 (valid)/ 27 bytes&lt;br /&gt;
     Channel Index: 37&lt;br /&gt;
     Type:  ADV_IND&lt;br /&gt;
     AdvA:  a0:9e:1a:84:28:c9 (public)&lt;br /&gt;
     AdvData: 02 01 06 03 02 ee fe 0d ff 6b 00 72 08 00 00 00 00 00 00 00 00&lt;br /&gt;
         Type 01 (Flags)&lt;br /&gt;
            00000110&lt;br /&gt;
                LE General Discoverable Mode&lt;br /&gt;
                BR/EDR Not Supported&lt;br /&gt;
         Type 02 (16-bit Service UUIDs, more available)&lt;br /&gt;
            feee&lt;br /&gt;
         Type ff (Manufacturer Specific Data)&lt;br /&gt;
            Company: Polar Electro OY&lt;br /&gt;
            Data: 72 08 00 00 00 00 00 00 00 00&lt;br /&gt;
     Data:  c9 28 84 1a 9e a0 02 01 06 03 02 ee fe 0d ff 6b 00 72 08 00 00 00 00 00 00 00 00&lt;br /&gt;
     CRC:   47 e9 1f&lt;br /&gt;
&lt;br /&gt;
=== Step 8 - Use Crackle to crack packages ===&lt;br /&gt;
&lt;br /&gt;
Enter these commands:&lt;br /&gt;
&lt;br /&gt;
 git clone https://github.com/mikeryan/crackle.git&lt;br /&gt;
 cd crackle&lt;br /&gt;
 make&lt;br /&gt;
&lt;br /&gt;
Now try cracking your pcap.file&lt;br /&gt;
&lt;br /&gt;
 ./crackle -i &amp;lt;your_file.pcap&amp;gt; -o &amp;lt;your_new_output_file.pcap&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this case it wasnt possible to crack any packages from the smartwatch.&lt;br /&gt;
&lt;br /&gt;
=== Step 9 - Install bleak library ===&lt;br /&gt;
&lt;br /&gt;
 pip install bleak&lt;br /&gt;
&lt;br /&gt;
=== Step 10 - Write python script for reading device UUID ===&lt;br /&gt;
&lt;br /&gt;
Enter these commands in the shell&lt;br /&gt;
&lt;br /&gt;
 mkdir BLE-scripts&lt;br /&gt;
 cd BLE-scripts&lt;br /&gt;
 nano ble_scan.py&lt;br /&gt;
&lt;br /&gt;
Write simple script to read device UUID using BleakScaner.discover() method:&lt;br /&gt;
 &lt;br /&gt;
 import asyncio&lt;br /&gt;
 from bleak import BleakScanner&lt;br /&gt;
 async def scan():&lt;br /&gt;
     devices = await BleakScanner.discover()&lt;br /&gt;
     for d in devices:&lt;br /&gt;
         print(d)&lt;br /&gt;
 asyncio.run(scan())&lt;br /&gt;
&lt;br /&gt;
Run a scan:&lt;br /&gt;
&lt;br /&gt;
 python3 BLE-scripts/ble_scan.py&lt;br /&gt;
&lt;br /&gt;
Here the device UUID of the Polar smartwatch was found:&lt;br /&gt;
&lt;br /&gt;
 C6C36C4A-7F8F-52B2-2BD7-C4F6690424E7: Polar Vantage M 8428C92D&lt;br /&gt;
&lt;br /&gt;
=== Step 11 - Check GATT services  ===&lt;br /&gt;
&lt;br /&gt;
With the gathered device UUID check for the devices services:&lt;br /&gt;
&lt;br /&gt;
 nano BLE-scripts/ble_services.py&lt;br /&gt;
&lt;br /&gt;
 import asyncio&lt;br /&gt;
 from bleak import BleakClient&lt;br /&gt;
 device_uuid = &amp;quot;C6C36C4A-7F8F-52B2-2BD7-C4F6690424E7&amp;quot;&lt;br /&gt;
 async def connect_to_device(device_uuid):&lt;br /&gt;
     async with BleakClient(device_uuid) as client:&lt;br /&gt;
         connected = client.is_connected&lt;br /&gt;
         print(f&amp;quot;Connected: {connected}&amp;quot;)&lt;br /&gt;
         services = client.services&lt;br /&gt;
         if services is None:&lt;br /&gt;
             await client.get_services()&lt;br /&gt;
         for service in services:&lt;br /&gt;
             print(f&amp;quot;Service: {service}&amp;quot;)&lt;br /&gt;
 loop = asyncio.get_event_loop()&lt;br /&gt;
 loop.run_until_complete(connect_to_device(device_uuid))&lt;br /&gt;
&lt;br /&gt;
Run a services scan:&lt;br /&gt;
&lt;br /&gt;
 python3 BLE-scripts/ble_services.py&lt;br /&gt;
&lt;br /&gt;
Now the service UUIDs that were found are going to be listed like this:&lt;br /&gt;
&lt;br /&gt;
 Service: 0000180a-0000-1000-8000-00805f9b34fb (Handle: 14): Device Information&lt;br /&gt;
 Service: 0000feee-0000-1000-8000-00805f9b34fb (Handle: 29): Polar Electro Oy&lt;br /&gt;
 Service: 0000180d-0000-1000-8000-00805f9b34fb (Handle: 38): Heart Rate&lt;br /&gt;
 Service: 0000180f-0000-1000-8000-00805f9b34fb (Handle: 42): Battery Service&lt;br /&gt;
&lt;br /&gt;
=== Step 12 - Get characteristics UUIDs  ===&lt;br /&gt;
&lt;br /&gt;
 nano BLE-scripts/ble_characteristics.py&lt;br /&gt;
&lt;br /&gt;
 import asyncio&lt;br /&gt;
 from bleak import BleakClient&lt;br /&gt;
 device_uuid = &amp;quot;C6C36C4A-7F8F-52B2-2BD7-C4F6690424E7&amp;quot;&lt;br /&gt;
 async def connect_to_device(device_uuid):&lt;br /&gt;
     async with BleakClient(device_uuid) as client:&lt;br /&gt;
         connected = client.is_connected&lt;br /&gt;
         print(f&amp;quot;Connected: {connected}&amp;quot;)&lt;br /&gt;
         services = client.services&lt;br /&gt;
         if services is None:&lt;br /&gt;
             await client.get_services()&lt;br /&gt;
         for service in services:&lt;br /&gt;
             print(f&amp;quot;Service: {service.uuid} (Handle: {service.handle}): {service.description}&amp;quot;)&lt;br /&gt;
             for characteristic in service.characteristics:&lt;br /&gt;
                 print(f&amp;quot;  Characteristic: {characteristic.uuid} (Handle: {characteristic.handle}) - Properties: {cha$&lt;br /&gt;
 loop = asyncio.get_event_loop()&lt;br /&gt;
 loop.run_until_complete(connect_to_device(device_uuid))&lt;br /&gt;
&lt;br /&gt;
Now run the script:&lt;br /&gt;
&lt;br /&gt;
 python3 BLE-scripts/ble_characteristics.py&lt;br /&gt;
&lt;br /&gt;
Expected output:&lt;br /&gt;
&lt;br /&gt;
 Service: 0000180a-0000-1000-8000-00805f9b34fb (Handle: 14): Device Information&lt;br /&gt;
  Characteristic: 00002a29-0000-1000-8000-00805f9b34fb (Handle: 15) - Properties: [&#039;read&#039;]&lt;br /&gt;
  Characteristic: 00002a24-0000-1000-8000-00805f9b34fb (Handle: 17) - Properties: [&#039;read&#039;]&lt;br /&gt;
  Characteristic: 00002a25-0000-1000-8000-00805f9b34fb (Handle: 19) - Properties: [&#039;read&#039;]&lt;br /&gt;
  Characteristic: 00002a27-0000-1000-8000-00805f9b34fb (Handle: 21) - Properties: [&#039;read&#039;]&lt;br /&gt;
  Characteristic: 00002a26-0000-1000-8000-00805f9b34fb (Handle: 23) - Properties: [&#039;read&#039;]&lt;br /&gt;
  Characteristic: 00002a28-0000-1000-8000-00805f9b34fb (Handle: 25) - Properties: [&#039;read&#039;]&lt;br /&gt;
  Characteristic: 00002a23-0000-1000-8000-00805f9b34fb (Handle: 27) - Properties: [&#039;read&#039;]&lt;br /&gt;
 Service: 0000feee-0000-1000-8000-00805f9b34fb (Handle: 29): Polar Electro Oy&lt;br /&gt;
  Characteristic: fb005c51-02e7-f387-1cad-8acd2d8df0c8 (Handle: 30) - Properties: [&#039;write-without-response&#039;, &#039;write&#039;, &#039;notify&#039;]&lt;br /&gt;
  Characteristic: fb005c52-02e7-f387-1cad-8acd2d8df0c8 (Handle: 33) - Properties: [&#039;notify&#039;]&lt;br /&gt;
  Characteristic: fb005c53-02e7-f387-1cad-8acd2d8df0c8 (Handle: 36) - Properties: [&#039;write-without-response&#039;, &#039;write&#039;]&lt;br /&gt;
 Service: 0000180d-0000-1000-8000-00805f9b34fb (Handle: 38): Heart Rate&lt;br /&gt;
  Characteristic: 00002a37-0000-1000-8000-00805f9b34fb (Handle: 39) - Properties: [&#039;notify&#039;]&lt;br /&gt;
 Service: 0000180f-0000-1000-8000-00805f9b34fb (Handle: 42): Battery Service&lt;br /&gt;
  Characteristic: 00002a19-0000-1000-8000-00805f9b34fb (Handle: 43) - Properties: [&#039;read&#039;, &#039;notify&#039;]&lt;br /&gt;
&lt;br /&gt;
=== Step 13 - Read data ===&lt;br /&gt;
&lt;br /&gt;
Now add a script for reading the actual data. Make sure to use the characteristics UUIDs you have found out.&lt;br /&gt;
&lt;br /&gt;
 nano BLE-scripts/ble_read.py&lt;br /&gt;
&lt;br /&gt;
 import asyncio&lt;br /&gt;
 from bleak import BleakClient&lt;br /&gt;
 device_uuid = &amp;quot;C6C36C4A-7F8F-52B2-2BD7-C4F6690424E7&amp;quot;&lt;br /&gt;
 HEART_RATE_CHAR_UUID = &amp;quot;00002a37-0000-1000-8000-00805f9b34fb&amp;quot;&lt;br /&gt;
 BATTERY_LEVEL_CHAR_UUID = &amp;quot;00002a19-0000-1000-8000-00805f9b34fb&amp;quot;&lt;br /&gt;
 async def connect_and_read_data(device_uuid):&lt;br /&gt;
     async with BleakClient(device_uuid) as client:&lt;br /&gt;
         connected = client.is_connected&lt;br /&gt;
         print(f&amp;quot;Connected: {connected}&amp;quot;)&lt;br /&gt;
         if connected:&lt;br /&gt;
             try:&lt;br /&gt;
                 heart_rate = await client.read_gatt_char(HEART_RATE_CHAR_UUID)&lt;br /&gt;
                 heart_rate = int(heart_rate_data[1])&lt;br /&gt;
                 print(f&amp;quot;Heart Rate: {heart_rate} bpm&amp;quot;)&lt;br /&gt;
             except Exception as e:&lt;br /&gt;
                 print(f&amp;quot;Failed to read heart rate: {e}&amp;quot;)&lt;br /&gt;
             try:&lt;br /&gt;
                 battery_level = await client.read_gatt_char(BATTERY_LEVEL_CHAR_UUID)&lt;br /&gt;
                 print(f&amp;quot;Battery Level: {int(battery_level[0])}%&amp;quot;)&lt;br /&gt;
             except Exception as e:&lt;br /&gt;
                 print(f&amp;quot;Failed to read battery level: {e}&amp;quot;)&lt;br /&gt;
 loop = asyncio.get_event_loop()&lt;br /&gt;
 loop.run_until_complete(connect_and_read_data(device_uuid))&lt;br /&gt;
&lt;br /&gt;
Run script:&lt;br /&gt;
&lt;br /&gt;
 python3 BLE-scripts/ble_read.py&lt;br /&gt;
&lt;br /&gt;
In the output the battery level was succesfully read and printed out. The heart rate couldn&#039;t be accessed because it only has the notify property and no option for reading:&lt;br /&gt;
&lt;br /&gt;
 Connected: True&lt;br /&gt;
 Failed to read heart rate: Failed to read characteristic 39: Error Domain=CBATTErrorDomain Code=2 &amp;quot;Reading is not permitted.&amp;quot; UserInfo={NSLocalizedDescription=Reading is not permitted.}&lt;br /&gt;
 Battery Level: 16%&lt;br /&gt;
&lt;br /&gt;
=== Step 14 - Subscribe to heart rate notifications ===&lt;br /&gt;
&lt;br /&gt;
 nano BLE-scripts/ble_subscribe.py&lt;br /&gt;
&lt;br /&gt;
 import asyncio&lt;br /&gt;
 from bleak import BleakClient&lt;br /&gt;
 device_uuid = &amp;quot;C6C36C4A-7F8F-52B2-2BD7-C4F6690424E7&amp;quot;&lt;br /&gt;
 HEART_RATE_CHAR_UUID = &amp;quot;00002a37-0000-1000-8000-00805f9b34fb&amp;quot;&lt;br /&gt;
 def heart_rate_handler(sender, data):&lt;br /&gt;
     heart_rate = int(data[1]) if len(data) &amp;gt; 1 else None&lt;br /&gt;
     print(f&amp;quot;Heart Rate from {sender}: {heart_rate} bpm&amp;quot;)&lt;br /&gt;
 async def connect_and_subscribe(device_uuid):&lt;br /&gt;
     async with BleakClient(device_uuid) as client:&lt;br /&gt;
         connected = client.is_connected&lt;br /&gt;
         print(f&amp;quot;Connected: {connected}&amp;quot;)&lt;br /&gt;
         if connected:&lt;br /&gt;
             try:&lt;br /&gt;
                 await client.start_notify(HEART_RATE_CHAR_UUID, heart_rate_handler)&lt;br /&gt;
                 print(&amp;quot;Subscribed to heart rate notifications.&amp;quot;)&lt;br /&gt;
                 await asyncio.sleep(60)&lt;br /&gt;
                 await client.stop_notify(HEART_RATE_CHAR_UUID)&lt;br /&gt;
                 print(&amp;quot;Stopped heart rate notifications.&amp;quot;)&lt;br /&gt;
             except Exception as e:&lt;br /&gt;
                 print(f&amp;quot;Failed to subscribe to heart rate notifications: {e}&amp;quot;)&lt;br /&gt;
 asyncio.run(connect_and_subscribe(device_uuid))&lt;br /&gt;
&lt;br /&gt;
 python3 BLE-scripts/ble_subscribe.py&lt;br /&gt;
&lt;br /&gt;
It was not possible to get the heart rate data even though the notify property was assigned. That is because typically battery status data is on a lower securiy level than heart rate data. This is the output of the failed try:&lt;br /&gt;
&lt;br /&gt;
 Connected: True&lt;br /&gt;
 Subscribed to heart rate notifications.&lt;br /&gt;
 Stopped heart rate notifications.&lt;br /&gt;
&lt;br /&gt;
== Used Hardware ==&lt;br /&gt;
&lt;br /&gt;
[[Ubertooth One, 2.4 GHz wireless development platform]]&lt;br /&gt;
[[Polar Vantage M]]&lt;br /&gt;
[[Apple iPhone 13 mini]]&lt;br /&gt;
[[MacBook Air M1, 2020]]&lt;br /&gt;
[[Samsung ]]&lt;br /&gt;
&lt;br /&gt;
== Courses ==&lt;br /&gt;
&lt;br /&gt;
* [[A course where this documentation was used]] (2017, 2018)&lt;br /&gt;
* [[Another one]] (2018)&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
* https://wikipedia.org&lt;br /&gt;
* https://google.com&lt;br /&gt;
&lt;br /&gt;
[[Category:Documentation]]&lt;/div&gt;</summary>
		<author><name>AMaksimovic</name></author>
	</entry>
	<entry>
		<id>https://elvis.hcw.ac.at/wiki/index.php?title=Setting_Up_Ubertooth_on_macOS_for_Bluetooth_Hacking&amp;diff=16670</id>
		<title>Setting Up Ubertooth on macOS for Bluetooth Hacking</title>
		<link rel="alternate" type="text/html" href="https://elvis.hcw.ac.at/wiki/index.php?title=Setting_Up_Ubertooth_on_macOS_for_Bluetooth_Hacking&amp;diff=16670"/>
		<updated>2024-12-05T00:26:34Z</updated>

		<summary type="html">&lt;p&gt;AMaksimovic: /* Used Hardware */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Summary == &lt;br /&gt;
&lt;br /&gt;
This is a step-by-step guide on how to sniff Bluetooth Low Energy (BLE) packets between a Polar Vantage Smartwatch and a phone using the Ubertooth One. It will go into detail on the setup on a MacBook Air with MacOS using a python environment for the libraries that are used for the setup. Additionally every step of the actual sniff will be outlined. This guide is based on the seminar paper &amp;quot;Smartwatch Hacking Attack&amp;quot; that was written within the FH-course &amp;quot;Selected IT-Security Chapters&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
== Requirements ==&lt;br /&gt;
&lt;br /&gt;
* Hardware tools: Ubertooth One: Firmware version: 2020-12-R1 (API:1.07)&lt;br /&gt;
* Smartwatch: Polar Vantage M&lt;br /&gt;
* Phone: Samsung Galaxy J3&lt;br /&gt;
* Unix-based Operating System: macOS (macOS Sequoia 15.1.1), on a MacBook Air with an Apple M1 chip.&lt;br /&gt;
* Virtual Environment: Python Environment: Python 3.12&lt;br /&gt;
* Packages: libusb, wget, cmake, pkg-config, setuptools, pyqt5, numpy&lt;br /&gt;
* Libraries: libbtbb, bleak&lt;br /&gt;
* Software Tools: Crackle&lt;br /&gt;
&lt;br /&gt;
For the setup this guide was used and adjusted to the given scenario. [[Ubertooth - Build Guide - https://ubertooth.readthedocs.io/en/latest/build_guide.html]].&lt;br /&gt;
&lt;br /&gt;
== Description ==&lt;br /&gt;
&lt;br /&gt;
=== Step 1 - Install homebrew ===&lt;br /&gt;
&lt;br /&gt;
Enter these commands in the shell&lt;br /&gt;
&lt;br /&gt;
 /bin/bash -c &amp;quot;$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)&amp;quot;&lt;br /&gt;
 eval &amp;quot;$(/opt/homebrew/bin/brew shellenv)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
=== Step 2 - Install Python Environment ===&lt;br /&gt;
&lt;br /&gt;
Enter these commands in the shell&lt;br /&gt;
&lt;br /&gt;
 python3.12 -m venv myenv&lt;br /&gt;
 source myenv/bin/activate&lt;br /&gt;
&lt;br /&gt;
=== Step 3 - Install libusb, wget, cmake, pkg-config ===&lt;br /&gt;
&lt;br /&gt;
Enter these commands in the shell&lt;br /&gt;
&lt;br /&gt;
 brew install libusb wget cmake pkg-config&lt;br /&gt;
&lt;br /&gt;
=== Step 4 - Install the Bluetooth baseband library ===&lt;br /&gt;
&lt;br /&gt;
Enter these commands in the shell&lt;br /&gt;
&lt;br /&gt;
 wget https://github.com/greatscottgadgets/libbtbb/archive/2020-12-R1.tar.gz -O libbtbb-2020-12-R1.tar.gz&lt;br /&gt;
 tar -xf libbtbb-2020-12-R1.tar.gz&lt;br /&gt;
 cd libbtbb-2020-12-R1&lt;br /&gt;
 mkdir build&lt;br /&gt;
 cd build&lt;br /&gt;
 cmake ..&lt;br /&gt;
 make&lt;br /&gt;
&lt;br /&gt;
If errors occur with installing distutils switch to setuptools instead.&lt;br /&gt;
&lt;br /&gt;
 pip install setuptools&lt;br /&gt;
&lt;br /&gt;
After installing the setuptools also change the &amp;quot;from distutils import setup&amp;quot; line in the the libbtbb-2020-12-R1/build/python/pcaptools/setup.py file to this:&lt;br /&gt;
&lt;br /&gt;
 from setuptools import setup&lt;br /&gt;
&lt;br /&gt;
Also update the version in that same file to this:&lt;br /&gt;
&lt;br /&gt;
 version = &#039;2020.12.R1&#039;&lt;br /&gt;
&lt;br /&gt;
If necessary set the pythonpath in case you have different python versions:&lt;br /&gt;
 &lt;br /&gt;
 export PYTHONPATH=/Users/&amp;lt;username&amp;gt;/myenv/lib/python3.12/site-packages:$PYTHONPATH&lt;br /&gt;
&lt;br /&gt;
Then retry:&lt;br /&gt;
&lt;br /&gt;
 make&lt;br /&gt;
&lt;br /&gt;
 sudo make install&lt;br /&gt;
&lt;br /&gt;
=== Step 5 - Install the Ubertooth repository ===&lt;br /&gt;
&lt;br /&gt;
Enter these commands in the shell&lt;br /&gt;
&lt;br /&gt;
 wget https://github.com/greatscottgadgets/ubertooth/releases/download/2020-12-R1/ubertooth-2020-12-R1.tar.xz&lt;br /&gt;
 tar -xf ubertooth-2020-12-R1.tar.xz&lt;br /&gt;
 cd ubertooth-2020-12-R1/host&lt;br /&gt;
 mkdir build&lt;br /&gt;
 cd build&lt;br /&gt;
 cmake ..&lt;br /&gt;
 make&lt;br /&gt;
&lt;br /&gt;
If libusb module not found errors occur go to ubertooth-2020-12-R1/host/CMakeLists.txt an add your libusb-path manually:&lt;br /&gt;
&lt;br /&gt;
 include_directories(/opt/homebrew/include)&lt;br /&gt;
 link_directories(/opt/homebrew/lib)&lt;br /&gt;
&lt;br /&gt;
Additionally again change the &amp;quot;from distutils import setup&amp;quot; line in the the ubertooth-2020-12-R1/host/build/python/specan_ui/setup.py file to this:&lt;br /&gt;
&lt;br /&gt;
 from setuptools import setup&lt;br /&gt;
&lt;br /&gt;
Also update the version in that same file to this:&lt;br /&gt;
&lt;br /&gt;
 version = &#039;2020.12.R1&#039;&lt;br /&gt;
&lt;br /&gt;
Then retry:&lt;br /&gt;
&lt;br /&gt;
 make&lt;br /&gt;
&lt;br /&gt;
 sudo make install&lt;br /&gt;
&lt;br /&gt;
If you get errors regarding the environment variables showing that your library wasnt found you need to set the library path via the MacOs&#039;s dynamic linker.&lt;br /&gt;
&lt;br /&gt;
 export DYLD_LIBRARY_PATH=&amp;quot;/usr/local/lib:$DYLD_LIBRARY_PATH&amp;quot;&lt;br /&gt;
&lt;br /&gt;
or make it persistent in shell configurations: &lt;br /&gt;
&lt;br /&gt;
 ~/.zshrc&lt;br /&gt;
&lt;br /&gt;
Afterwards confirm the ubertooth library is working correctly:&lt;br /&gt;
&lt;br /&gt;
 ubertooth-util&lt;br /&gt;
&lt;br /&gt;
=== Step 6 - Test Ubertooth One commands ===&lt;br /&gt;
&lt;br /&gt;
Test these commands:&lt;br /&gt;
&lt;br /&gt;
 ubertooth-util -H&lt;br /&gt;
 ubertooth-util -v&lt;br /&gt;
 ubertooth-util -p&lt;br /&gt;
 ubertooth-util -s&lt;br /&gt;
&lt;br /&gt;
Update Ubertooth firmware in ubertooth-2020-12-R1/ubertooth-one-firmware-bin:&lt;br /&gt;
&lt;br /&gt;
 sudo ubertooth-dfu -d bluetooth_rxtx.dfu -r&lt;br /&gt;
&lt;br /&gt;
In case the libubertooth library is not loading check if the paths are correct.&lt;br /&gt;
&lt;br /&gt;
In ubertooth-2020-12-R1/host the following command leads to getting a list of sniffed Bluetooth packets with their Lower Address Parts (LAP):&lt;br /&gt;
&lt;br /&gt;
 ubertooth-rx&lt;br /&gt;
&lt;br /&gt;
For collecting Upper Address Parts (UAP) from the captured packets add -z:&lt;br /&gt;
&lt;br /&gt;
 ubertooth-rx -z&lt;br /&gt;
&lt;br /&gt;
Let it run for a while and look at the output. It will be summarized as Survey Results at the end of the output. There you can see the significant part of Bluetooth addresses of devices that were scanned. &lt;br /&gt;
&lt;br /&gt;
=== Step 7 - Use BTLE to follow the connection of the Bluetooth device you found. (Replace with device Bluetooth Address) ===&lt;br /&gt;
&lt;br /&gt;
 ubertooth-btle -f B0:67:B5:CF:E5:10 -r test.pcap&lt;br /&gt;
&lt;br /&gt;
Or create a pipe for viewing the captures directly in Wireshark:&lt;br /&gt;
&lt;br /&gt;
 mkfifo /tmp/pipe&lt;br /&gt;
 ubertooth-btle -f B0:67:B5:CF:E5:10 -c /tmp/pipe&lt;br /&gt;
&lt;br /&gt;
Find packages that involve the Polar Smartwatch&lt;br /&gt;
&lt;br /&gt;
 systime=1728247529 freq=2402 addr=8e89bed6 delta_t=34.320 ms rssi=-60&lt;br /&gt;
 20 1b c9 28 84 1a 9e a0 02 01 06 03 02 ee fe 0d ff 6b 00 72 08 00 00 00 00 00 00 00 00 47 e9 1f &lt;br /&gt;
 Advertising / AA 8e89bed6 (valid)/ 27 bytes&lt;br /&gt;
     Channel Index: 37&lt;br /&gt;
     Type:  ADV_IND&lt;br /&gt;
     AdvA:  a0:9e:1a:84:28:c9 (public)&lt;br /&gt;
     AdvData: 02 01 06 03 02 ee fe 0d ff 6b 00 72 08 00 00 00 00 00 00 00 00&lt;br /&gt;
         Type 01 (Flags)&lt;br /&gt;
            00000110&lt;br /&gt;
                LE General Discoverable Mode&lt;br /&gt;
                BR/EDR Not Supported&lt;br /&gt;
         Type 02 (16-bit Service UUIDs, more available)&lt;br /&gt;
            feee&lt;br /&gt;
         Type ff (Manufacturer Specific Data)&lt;br /&gt;
            Company: Polar Electro OY&lt;br /&gt;
            Data: 72 08 00 00 00 00 00 00 00 00&lt;br /&gt;
     Data:  c9 28 84 1a 9e a0 02 01 06 03 02 ee fe 0d ff 6b 00 72 08 00 00 00 00 00 00 00 00&lt;br /&gt;
     CRC:   47 e9 1f&lt;br /&gt;
&lt;br /&gt;
=== Step 8 - Use Crackle to crack packages ===&lt;br /&gt;
&lt;br /&gt;
Enter these commands:&lt;br /&gt;
&lt;br /&gt;
 git clone https://github.com/mikeryan/crackle.git&lt;br /&gt;
 cd crackle&lt;br /&gt;
 make&lt;br /&gt;
&lt;br /&gt;
Now try cracking your pcap.file&lt;br /&gt;
&lt;br /&gt;
 ./crackle -i &amp;lt;your_file.pcap&amp;gt; -o &amp;lt;your_new_output_file.pcap&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this case it wasnt possible to crack any packages from the smartwatch.&lt;br /&gt;
&lt;br /&gt;
=== Step 9 - Install bleak library ===&lt;br /&gt;
&lt;br /&gt;
 pip install bleak&lt;br /&gt;
&lt;br /&gt;
=== Step 10 - Write python script for reading device UUID ===&lt;br /&gt;
&lt;br /&gt;
Enter these commands in the shell&lt;br /&gt;
&lt;br /&gt;
 mkdir BLE-scripts&lt;br /&gt;
 cd BLE-scripts&lt;br /&gt;
 nano ble_scan.py&lt;br /&gt;
&lt;br /&gt;
Write simple script to read device UUID using BleakScaner.discover() method:&lt;br /&gt;
 &lt;br /&gt;
 import asyncio&lt;br /&gt;
 from bleak import BleakScanner&lt;br /&gt;
 async def scan():&lt;br /&gt;
     devices = await BleakScanner.discover()&lt;br /&gt;
     for d in devices:&lt;br /&gt;
         print(d)&lt;br /&gt;
 asyncio.run(scan())&lt;br /&gt;
&lt;br /&gt;
Run a scan:&lt;br /&gt;
&lt;br /&gt;
 python3 BLE-scripts/ble_scan.py&lt;br /&gt;
&lt;br /&gt;
Here the device UUID of the Polar smartwatch was found:&lt;br /&gt;
&lt;br /&gt;
 C6C36C4A-7F8F-52B2-2BD7-C4F6690424E7: Polar Vantage M 8428C92D&lt;br /&gt;
&lt;br /&gt;
=== Step 11 - Check GATT services  ===&lt;br /&gt;
&lt;br /&gt;
With the gathered device UUID check for the devices services:&lt;br /&gt;
&lt;br /&gt;
 nano BLE-scripts/ble_services.py&lt;br /&gt;
&lt;br /&gt;
 import asyncio&lt;br /&gt;
 from bleak import BleakClient&lt;br /&gt;
 device_uuid = &amp;quot;C6C36C4A-7F8F-52B2-2BD7-C4F6690424E7&amp;quot;&lt;br /&gt;
 async def connect_to_device(device_uuid):&lt;br /&gt;
     async with BleakClient(device_uuid) as client:&lt;br /&gt;
         connected = client.is_connected&lt;br /&gt;
         print(f&amp;quot;Connected: {connected}&amp;quot;)&lt;br /&gt;
         services = client.services&lt;br /&gt;
         if services is None:&lt;br /&gt;
             await client.get_services()&lt;br /&gt;
         for service in services:&lt;br /&gt;
             print(f&amp;quot;Service: {service}&amp;quot;)&lt;br /&gt;
 loop = asyncio.get_event_loop()&lt;br /&gt;
 loop.run_until_complete(connect_to_device(device_uuid))&lt;br /&gt;
&lt;br /&gt;
Run a services scan:&lt;br /&gt;
&lt;br /&gt;
 python3 BLE-scripts/ble_services.py&lt;br /&gt;
&lt;br /&gt;
Now the service UUIDs that were found are going to be listed like this:&lt;br /&gt;
&lt;br /&gt;
 Service: 0000180a-0000-1000-8000-00805f9b34fb (Handle: 14): Device Information&lt;br /&gt;
 Service: 0000feee-0000-1000-8000-00805f9b34fb (Handle: 29): Polar Electro Oy&lt;br /&gt;
 Service: 0000180d-0000-1000-8000-00805f9b34fb (Handle: 38): Heart Rate&lt;br /&gt;
 Service: 0000180f-0000-1000-8000-00805f9b34fb (Handle: 42): Battery Service&lt;br /&gt;
&lt;br /&gt;
=== Step 12 - Get characteristics UUIDs  ===&lt;br /&gt;
&lt;br /&gt;
 nano BLE-scripts/ble_characteristics.py&lt;br /&gt;
&lt;br /&gt;
 import asyncio&lt;br /&gt;
 from bleak import BleakClient&lt;br /&gt;
 device_uuid = &amp;quot;C6C36C4A-7F8F-52B2-2BD7-C4F6690424E7&amp;quot;&lt;br /&gt;
 async def connect_to_device(device_uuid):&lt;br /&gt;
     async with BleakClient(device_uuid) as client:&lt;br /&gt;
         connected = client.is_connected&lt;br /&gt;
         print(f&amp;quot;Connected: {connected}&amp;quot;)&lt;br /&gt;
         services = client.services&lt;br /&gt;
         if services is None:&lt;br /&gt;
             await client.get_services()&lt;br /&gt;
         for service in services:&lt;br /&gt;
             print(f&amp;quot;Service: {service.uuid} (Handle: {service.handle}): {service.description}&amp;quot;)&lt;br /&gt;
             for characteristic in service.characteristics:&lt;br /&gt;
                 print(f&amp;quot;  Characteristic: {characteristic.uuid} (Handle: {characteristic.handle}) - Properties: {cha$&lt;br /&gt;
 loop = asyncio.get_event_loop()&lt;br /&gt;
 loop.run_until_complete(connect_to_device(device_uuid))&lt;br /&gt;
&lt;br /&gt;
Now run the script:&lt;br /&gt;
&lt;br /&gt;
 python3 BLE-scripts/ble_characteristics.py&lt;br /&gt;
&lt;br /&gt;
Expected output:&lt;br /&gt;
&lt;br /&gt;
 Service: 0000180a-0000-1000-8000-00805f9b34fb (Handle: 14): Device Information&lt;br /&gt;
  Characteristic: 00002a29-0000-1000-8000-00805f9b34fb (Handle: 15) - Properties: [&#039;read&#039;]&lt;br /&gt;
  Characteristic: 00002a24-0000-1000-8000-00805f9b34fb (Handle: 17) - Properties: [&#039;read&#039;]&lt;br /&gt;
  Characteristic: 00002a25-0000-1000-8000-00805f9b34fb (Handle: 19) - Properties: [&#039;read&#039;]&lt;br /&gt;
  Characteristic: 00002a27-0000-1000-8000-00805f9b34fb (Handle: 21) - Properties: [&#039;read&#039;]&lt;br /&gt;
  Characteristic: 00002a26-0000-1000-8000-00805f9b34fb (Handle: 23) - Properties: [&#039;read&#039;]&lt;br /&gt;
  Characteristic: 00002a28-0000-1000-8000-00805f9b34fb (Handle: 25) - Properties: [&#039;read&#039;]&lt;br /&gt;
  Characteristic: 00002a23-0000-1000-8000-00805f9b34fb (Handle: 27) - Properties: [&#039;read&#039;]&lt;br /&gt;
 Service: 0000feee-0000-1000-8000-00805f9b34fb (Handle: 29): Polar Electro Oy&lt;br /&gt;
  Characteristic: fb005c51-02e7-f387-1cad-8acd2d8df0c8 (Handle: 30) - Properties: [&#039;write-without-response&#039;, &#039;write&#039;, &#039;notify&#039;]&lt;br /&gt;
  Characteristic: fb005c52-02e7-f387-1cad-8acd2d8df0c8 (Handle: 33) - Properties: [&#039;notify&#039;]&lt;br /&gt;
  Characteristic: fb005c53-02e7-f387-1cad-8acd2d8df0c8 (Handle: 36) - Properties: [&#039;write-without-response&#039;, &#039;write&#039;]&lt;br /&gt;
 Service: 0000180d-0000-1000-8000-00805f9b34fb (Handle: 38): Heart Rate&lt;br /&gt;
  Characteristic: 00002a37-0000-1000-8000-00805f9b34fb (Handle: 39) - Properties: [&#039;notify&#039;]&lt;br /&gt;
 Service: 0000180f-0000-1000-8000-00805f9b34fb (Handle: 42): Battery Service&lt;br /&gt;
  Characteristic: 00002a19-0000-1000-8000-00805f9b34fb (Handle: 43) - Properties: [&#039;read&#039;, &#039;notify&#039;]&lt;br /&gt;
&lt;br /&gt;
=== Step 13 - Read data ===&lt;br /&gt;
&lt;br /&gt;
Now add a script for reading the actual data. Make sure to use the characteristics UUIDs you have found out.&lt;br /&gt;
&lt;br /&gt;
 nano BLE-scripts/ble_read.py&lt;br /&gt;
&lt;br /&gt;
 import asyncio&lt;br /&gt;
 from bleak import BleakClient&lt;br /&gt;
 device_uuid = &amp;quot;C6C36C4A-7F8F-52B2-2BD7-C4F6690424E7&amp;quot;&lt;br /&gt;
 HEART_RATE_CHAR_UUID = &amp;quot;00002a37-0000-1000-8000-00805f9b34fb&amp;quot;&lt;br /&gt;
 BATTERY_LEVEL_CHAR_UUID = &amp;quot;00002a19-0000-1000-8000-00805f9b34fb&amp;quot;&lt;br /&gt;
 async def connect_and_read_data(device_uuid):&lt;br /&gt;
     async with BleakClient(device_uuid) as client:&lt;br /&gt;
         connected = client.is_connected&lt;br /&gt;
         print(f&amp;quot;Connected: {connected}&amp;quot;)&lt;br /&gt;
         if connected:&lt;br /&gt;
             try:&lt;br /&gt;
                 heart_rate = await client.read_gatt_char(HEART_RATE_CHAR_UUID)&lt;br /&gt;
                 heart_rate = int(heart_rate_data[1])&lt;br /&gt;
                 print(f&amp;quot;Heart Rate: {heart_rate} bpm&amp;quot;)&lt;br /&gt;
             except Exception as e:&lt;br /&gt;
                 print(f&amp;quot;Failed to read heart rate: {e}&amp;quot;)&lt;br /&gt;
             try:&lt;br /&gt;
                 battery_level = await client.read_gatt_char(BATTERY_LEVEL_CHAR_UUID)&lt;br /&gt;
                 print(f&amp;quot;Battery Level: {int(battery_level[0])}%&amp;quot;)&lt;br /&gt;
             except Exception as e:&lt;br /&gt;
                 print(f&amp;quot;Failed to read battery level: {e}&amp;quot;)&lt;br /&gt;
 loop = asyncio.get_event_loop()&lt;br /&gt;
 loop.run_until_complete(connect_and_read_data(device_uuid))&lt;br /&gt;
&lt;br /&gt;
Run script:&lt;br /&gt;
&lt;br /&gt;
 python3 BLE-scripts/ble_read.py&lt;br /&gt;
&lt;br /&gt;
In the output the battery level was succesfully read and printed out. The heart rate couldn&#039;t be accessed because it only has the notify property and no option for reading:&lt;br /&gt;
&lt;br /&gt;
 Connected: True&lt;br /&gt;
 Failed to read heart rate: Failed to read characteristic 39: Error Domain=CBATTErrorDomain Code=2 &amp;quot;Reading is not permitted.&amp;quot; UserInfo={NSLocalizedDescription=Reading is not permitted.}&lt;br /&gt;
 Battery Level: 16%&lt;br /&gt;
&lt;br /&gt;
=== Step 14 - Subscribe to heart rate notifications ===&lt;br /&gt;
&lt;br /&gt;
 nano BLE-scripts/ble_subscribe.py&lt;br /&gt;
&lt;br /&gt;
 import asyncio&lt;br /&gt;
 from bleak import BleakClient&lt;br /&gt;
 device_uuid = &amp;quot;C6C36C4A-7F8F-52B2-2BD7-C4F6690424E7&amp;quot;&lt;br /&gt;
 HEART_RATE_CHAR_UUID = &amp;quot;00002a37-0000-1000-8000-00805f9b34fb&amp;quot;&lt;br /&gt;
 def heart_rate_handler(sender, data):&lt;br /&gt;
     heart_rate = int(data[1]) if len(data) &amp;gt; 1 else None&lt;br /&gt;
     print(f&amp;quot;Heart Rate from {sender}: {heart_rate} bpm&amp;quot;)&lt;br /&gt;
 async def connect_and_subscribe(device_uuid):&lt;br /&gt;
     async with BleakClient(device_uuid) as client:&lt;br /&gt;
         connected = client.is_connected&lt;br /&gt;
         print(f&amp;quot;Connected: {connected}&amp;quot;)&lt;br /&gt;
         if connected:&lt;br /&gt;
             try:&lt;br /&gt;
                 await client.start_notify(HEART_RATE_CHAR_UUID, heart_rate_handler)&lt;br /&gt;
                 print(&amp;quot;Subscribed to heart rate notifications.&amp;quot;)&lt;br /&gt;
                 await asyncio.sleep(60)&lt;br /&gt;
                 await client.stop_notify(HEART_RATE_CHAR_UUID)&lt;br /&gt;
                 print(&amp;quot;Stopped heart rate notifications.&amp;quot;)&lt;br /&gt;
             except Exception as e:&lt;br /&gt;
                 print(f&amp;quot;Failed to subscribe to heart rate notifications: {e}&amp;quot;)&lt;br /&gt;
 asyncio.run(connect_and_subscribe(device_uuid))&lt;br /&gt;
&lt;br /&gt;
 python3 BLE-scripts/ble_subscribe.py&lt;br /&gt;
&lt;br /&gt;
It was not possible to get the heart rate data even though the notify property was assigned. That is because typically battery status data is on a lower securiy level than heart rate data. This is the output of the failed try:&lt;br /&gt;
&lt;br /&gt;
 Connected: True&lt;br /&gt;
 Subscribed to heart rate notifications.&lt;br /&gt;
 Stopped heart rate notifications.&lt;br /&gt;
&lt;br /&gt;
== Used Hardware ==&lt;br /&gt;
&lt;br /&gt;
[[Ubertooth One, 2.4 GHz wireless development platform]]&lt;br /&gt;
[[Polar Vantage M]]&lt;br /&gt;
[[Apple iPhone 13 mini]]&lt;br /&gt;
[[MacBook Air M1, 2020]]&lt;br /&gt;
[[Samsung ]]&lt;br /&gt;
&lt;br /&gt;
== Courses ==&lt;br /&gt;
&lt;br /&gt;
* [[A course where this documentation was used]] (2017, 2018)&lt;br /&gt;
* [[Another one]] (2018)&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
* https://wikipedia.org&lt;br /&gt;
* https://google.com&lt;br /&gt;
&lt;br /&gt;
[[Category:Documentation]]&lt;/div&gt;</summary>
		<author><name>AMaksimovic</name></author>
	</entry>
</feed>