Diabetes: test the FreeStyle Libre glucose sensor as a Bluetooth Low Energy device, even directly from an Apple Watch.

Overview



Since the FreeStyle Libre 2 / 3 glucose sensors are Bluetooth Low Energy devices, I am trying to leverage their capabilities to implement something new compared to the traditional apps:

  • a universal SwiftUI application for iPhone, iPad and Mac Catalyst;
  • an independent Apple Watch app connecting directly via Bluetooth;
  • scanning the Libre directly via NFC and exploring its internals;
  • using both online servers and offline methods for calibrating just like the temperature-based vendor algorithm;
  • showing for comparison the HealthKit and Nightscout data shared with other apps;
  • varying the reading interval instead of the usual 5-minute one;
  • a detailed log to check the traffic from/to the BLE devices and remote servers.

Still too early to decide the final design (but I really like already the evil logo 😈 ), here there are some recent screenshots I tweeted:



  

Hello Libre 3



The project started as a single script for the iPad Swift Playgrounds to test the workings of the several troublesome BLE devices I bought, mainly the Bubble and the MiaoMiao. It was then quickly converted to an app when the Libre 2 came out at last by using a standard Xcode template: it should compile fine without external dependencies just after changing the Bundle Identifier in the General panel of the Targets settings and the Team in the Signing and Capabilities tab of Xcode -- Spike and xDrip4iO5 users know already very well what that means... ;-)

I am targeting only the latest betas of Xcode and iOS. The new async / await and actors introduced in Swift 5.5 and iOS 15 probably would require a total rewrite of DiaBLE's foundations, as well as the enhanced Gen2 protocols adopted by the recent Libre 2 Sense/US/CA/AU which haven't been reversed yet.

Please refer to the TODOs list for the up-to-date status of all the current limitations and known bugs of this prototype.

Note: the exploitation which allows to reset and reactivate a Libre 1 is well known to the Vendor and was unveiled already during BlackAlps 2019 and in PoC||GTFO 0x20.


Credits: @bubbledevteam, @captainbeeheart, @cryptax, @dabear, @ivalkou, @keencave, LibreMonitor, Loop, Marek Macner, Nightguard, @travisgoodspeed, WoofWoof, xDrip+, xDrip4iO5.

Disclaimer: the decrypting keys I am publishing are not related to user accounts and can be dumped from the sensor memory by using DiaBLE itself. The online servers I am using probably are tracking your personal data but all the traffic sent/received by DiaBLE is clearly shown in its logs. The reversed code I am pasting has been retrieved from other GitHub repos or reproduced simply by using open-source tools like jadx-gui.
You might also like...
Blocks Based Bluetooth LE Connectivity framework for iOS/watchOS/tvOS/OSX. Quickly configure centrals & peripherals, perform read/write operations, and respond characteristic updates.
Blocks Based Bluetooth LE Connectivity framework for iOS/watchOS/tvOS/OSX. Quickly configure centrals & peripherals, perform read/write operations, and respond characteristic updates.

ExtendaBLE Introduction ExtendaBLE provides a very flexible syntax for defining centrals and peripherals with ease. Following a blocks based builder a

Bluetooth mesh messaging SDK for apps

Berkanan SDK Berkanan SDK enables Bluetooth mesh messaging between nearby apps. It's the framework used by Berkanan Messenger (Product Hunt, TechCrunc

Fluetooth - Flutter library for sending bytes to Bluetooth devices on Android/iOS

A Flutter library for sending bytes to Bluetooth devices. Available on Android a

The Bluetooth LE library for iOS and Mac. 100% Swift.
The Bluetooth LE library for iOS and Mac. 100% Swift.

iOS-BLE-Library An in-development Bluetooth Low Energy Library by Nordic Semiconductor to interact with the , which is not complicated, but requires w

CombineCoreBluetooth is a library that bridges Apple's CoreBluetooth framework and Apple's Combine framework

CombineCoreBluetooth is a library that bridges Apple's CoreBluetooth framework and Apple's Combine framework, making it possible to subscribe to perform bluetooth operations while subscribing to a publisher of the results of those operations, instead of relying on implementing delegates and manually filtering for the results you need.

A simple framework that brings Apple devices together - like a family
A simple framework that brings Apple devices together - like a family

Apple Family A simple framework that brings Apple devices together - like a family. It will automatically use bluetooth, wifi, or USB to connect and c

Functional wrapper for Apple's MultipeerConnectivity framework.

A functional wrapper for the MultipeerConnectivity framework. PeerConnectivity is meant to have a lightweight easy to use syntax, be extensible and fl

AZPeerToPeerConnectivity is a wrapper on top of Apple iOS Multipeer Connectivity framework. It provides an easier way to create and manage sessions. Easy to integrate
AZPeerToPeerConnectivity is a wrapper on top of Apple iOS Multipeer Connectivity framework. It provides an easier way to create and manage sessions. Easy to integrate

AZPeerToPeerConnection Controller Features Multipeer Connectivity Connection via Bluetooth or Wifi No need write all session, browser, services delega

The purpose of this repository is to serve as an example for writing a SwiftUI IOS app for connecting to an HM-10 over Bluetooth Low Energy
The purpose of this repository is to serve as an example for writing a SwiftUI IOS app for connecting to an HM-10 over Bluetooth Low Energy

The purpose of this repository is to serve as an example for writing a SwiftUI IOS app for connecting to an HM-10 over Bluetooth Low Energy. The example provided also sends the IOS devices location over BLE to the HM-10, when the button is pressed. An example Arduino program is provided that allows the user to receive messages from the IOS device on the HM-10.

MetaWear-Swift-Combine-SDK - Build iOS and macOS apps controlling MetaWear Bluetooth Low Energy wearables without C++ or CoreBluetooth expertise
LibreSDK - Open FreeStyle Libre

LibreSDK - Open FreeStyle Libre Since there are a dozen of repositories floating around on github trying to decode the contents of a FreeStyle Libre.

App programmed in Swift/SwiftUI for using Libre 1/2 blood glucose sensors.
App programmed in Swift/SwiftUI for using Libre 1/2 blood glucose sensors.

Glucose Direct App Warning, This project is highly experimental. Please use this app with caution and extreme care. Do not mindlessly make decisions b

An extremely high-performance, lightweight, and energy-efficient pure Swift async web image loader with memory and disk caching for iOS and  Watch.

KFSwiftImageLoader KFSwiftImageLoader is an extremely high-performance, lightweight, and energy-efficient pure Swift async web image loader with memor

Super lightweight library that helps you to localize strings, even directly in storyboards!
Super lightweight library that helps you to localize strings, even directly in storyboards!

Translatio Example To run the example project, clone the repo, and run pod install from the Example directory first. Requirements iOS 9 or higher. Swi

The easiest way to use Bluetooth (BLE )in ios,even bady can use.
The easiest way to use Bluetooth (BLE )in ios,even bady can use.

The easiest way to use Bluetooth (BLE )in ios,even bady can use.

MiniVendingMachine - SwiftUI demo Apple Watch app to open a mini vending machine via bluetooth

Mini Vending Machine Use Apple Watch to open vending machine cells. Note: This a

BLE (Bluetooth LE) for U🎁 Bleu is the best in the Bluetooth library.
BLE (Bluetooth LE) for U🎁 Bleu is the best in the Bluetooth library.

Bleu Bleu is a Bluetooth library. Bleu is the easiest way to operate CoreBluetooth. Bleu is possible to operate by replacing Bluetooth 's Peripheral a

Inspect the iOS 15 App Activity Data directly on device.
Inspect the iOS 15 App Activity Data directly on device.

AppActivityViewer About AppActivityViewer helps to inspect the iOS 15 App Activity Data easily on device. Choose App Activity at share sheet after cli

Terminal Watch Face for Apple Watch
Terminal Watch Face for Apple Watch

Terminal Watch Face for Apple Watch

Comments
  • Unable to run on a local device

    Unable to run on a local device

    I'm trying to compile and run the code for iPhone XS MAX but I get these error messages image

    There were no problems running on a simulator but I want to open the app on the local device to test the NFC communication.

    opened by NovaBG03 2
  • Garmin integration/Question about libre 3 BLE connection

    Garmin integration/Question about libre 3 BLE connection

    Hello, since I'm not a regular user of gcm my knowledge might be lacking. I would like to develop an Garmin IQ app to connect to a libre2/3 sensor and stream data over BLE to it (like supersuppiens sensors), would something like it be possible?

    Sorry for being bit of topic, but I would appreciate any help on guidance for the reverse engineering.

    opened by purpl3F0x 1
  • No such module 'Charts'

    No such module 'Charts'

    Hi again,

    I am trying to build your restructured version of this git repository. But I cannot build the project because of a missing import (e.g. in OnlineView.swift).

    import Charts // error --> No such module 'Charts'
    

    And I have some other errors in Nightscout.swift, Health.swift, etc. with the following error message.

    Variable binding in a condition requires an initializer
    

    It seems that you are using a different XCode Version or Swift Version than me. I am not sure what I do worng. I am using XCode 13.4.1 and Swift 5 in project. I changed nothing in your code, only the bundle identifier and the signing team. All this errors occur in the DiaBLE Watch Extension code.

    Do you know where the problem could be?

    wontfix 
    opened by jet-lee-m 1
Owner
Guido Soranzio
Guido Soranzio
MiniVendingMachine - SwiftUI demo Apple Watch app to open a mini vending machine via bluetooth

Mini Vending Machine Use Apple Watch to open vending machine cells. Note: This a

CGH 3 Apr 8, 2022
BLE (Bluetooth LE) for U🎁 Bleu is the best in the Bluetooth library.

Bleu Bleu is a Bluetooth library. Bleu is the easiest way to operate CoreBluetooth. Bleu is possible to operate by replacing Bluetooth 's Peripheral a

1amageek 484 Dec 29, 2022
Build your own 'AirTags' 🏷 today! Framework for tracking personal Bluetooth devices via Apple's massive Find My network.

OpenHaystack is a framework for tracking personal Bluetooth devices via Apple's massive Find My network.

Secure Mobile Networking Lab 5.8k Jan 9, 2023
A very simple library to discover and retrieve data from nearby devices (even if the peer app works at background).

Discovery: A simple library to discover and retrieve data from nearby devices. Discovery is a very simple but useful library for discovering nearby de

Ömer Faruk Gül 412 Dec 19, 2022
iOS Bluetooth LE framework

Features A futures interface replacing protocol implementations. Timeout for Peripheral connection, Service scan, Service + Characteristic discovery a

Troy Stribling 696 Dec 25, 2022
Bluejay is a simple Swift framework for building reliable Bluetooth LE apps.

Bluejay is a simple Swift framework for building reliable Bluetooth LE apps. Bluejay's primary goals are: Simplify talking to a single Bluetooth LE pe

Steamclock Software 1k Dec 13, 2022
RxBluetoothKit is a Bluetooth library that makes interaction with BLE devices much more pleasant.

RxBluetoothKit is a Bluetooth library that makes interaction with BLE devices much more pleasant. It's backed by RxSwift and CoreBluetooth and it prov

Polidea 1.3k Jan 6, 2023
Omnipod Bluetooth PumpManager For Loop

OmniBLE Omnipod Bluetooth PumpManager For Loop Status This module is at the very beginning stages of development and does not even compile yet. DO NOT

Randall Knutson 20 Apr 21, 2022
Simple, block-based, lightweight library over CoreBluetooth. Will clean up your Core Bluetooth related code.

LGBluetooth Simple, block-based, lightweight library over CoreBluetooth. Steps to start using Drag and Drop it into your project Import "LGBluetooth.h

null 170 Sep 19, 2022
Bluetooth mapping in Swift

Bluetonium is part of the E-sites iOS Suite. Bluetonium is a Swift Library that makes it easy to communicate with Bluetooth devices. Features ?? Servi

E-sites 165 Nov 20, 2022