/bluetooth-multiboot-tools

Utility to read and convert Bluetooth pairing key configurations between different OS formats

Primary LanguagePythonMIT LicenseMIT

bluetooth-multiboot-tools

Utility to read and convert Bluetooth pairing key configurations between different OS formats.

Copyright © 2018 Yuriy Guts

Dependencies

btconvert.py requires only vanilla Python 3.6 or above. No third-party packages need to be installed.

Preparing Input Files

Linux

  1. Copy the contents of '/var/lib/bluetooth' folder:
sudo rsync -IPavz /var/lib/bluetooth/* <source_dir>
sudo chown -R `whoami` <source_dir>

Windows

  1. Install SysInternals tools.
  2. Open Administrator Command Line.
  3. Export the registry keys responsible for Bluetooth device configuration. Note: use full directory paths!
psexec -s -i reg export HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\BTHPORT\Parameters\Devices <source_dir_full_path>\BluetoothDevices.reg
psexec -s -i reg export HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\BTHPORT\Parameters\Keys <source_dir_full_path>\BluetoothKeys.reg
  1. To import the registry keys generated by btexport.py, use:
psexec -s -i reg import <output_dir_full_path>\BluetoothDevices.reg
psexec -s -i reg import <output_dir_full_path>\BluetoothKeys.reg

macOS

  1. Copy the binary .plist file with device info:
sudo cp /Library/Preferences/com.apple.Bluetooth.plist <source_dir>
  1. Copy the binary .plist file with keys:
sudo cp /private/var/root/Library/Preferences/com.apple.bluetoothd.plist <source_dir>

Usage

btconvert.py [-h] --source-format FMT --destination-format FMT source_dir destination_dir

positional arguments:

  source_dir            Path to the directory containing Bluetooth configuration files
                        to convert. The format of the files depends on the source OS.
  destination_dir       Path to the directory where the converted output will
                        be written. The format of the files depends on the destination OS.

optional arguments:

-h, --help            show this help message and exit
  --source-format FMT   Source operating system (linux, windows, macos)
  --destination-format FMT
                        Destination operating system (linux, windows, macos)

Example

Exporting Bluetooth config files on Linux and converting them to Windows Registry files:

sudo rsync -IPavz /var/lib/bluetooth/* ~/bt-linux
sudo chown -R `whoami` ~/bt-linux
python btconvert.py --source-format linux --destination-format windows ~/bt-linux ~/bt-windows