Extract the ID from a BLE device using the PsExec tool from Microsoft (#37792)

This commit is contained in:
c0ffeeca7 2025-03-14 11:11:46 +01:00 committed by GitHub
commit ee0c7f8165
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -56,6 +56,18 @@ Alternatively, the IRK of an Android phone and/or secondary device can be obtain
8. Select one of the frames and expand the "Bluetooth Security Manager Protocol." The hex dump will show either the sending or receiving device IRK.
9. Reverse the value displayed. For example, if it is `763af6c7f7d94ad6c262158e2320544e`, the IRK to use would be: `4e5420238e1562c2d64ad9f7c7f63a76`.
### On Windows - for any devices that will connect to a computer
1. Get the PsExec tool from Microsoft. It's available in the [Sysinternals Suite](https://learn.microsoft.com/en-us/sysinternals/downloads/psexec). Download and extract the `PsExec.exe` or `PsExec64.exe`.
2. Open Command Prompt as Administrator: Press the Windows key, type `cmd`, right-click on **Command Prompt**, and select **Run as administrator**.
3. Run PsExec: Navigate to the folder where PsExec is located and run `psexec -i -s cmd` or `psexec64 -i -s cmd`. This command will open a new command prompt window with SYSTEM rights.
4. Verify SYSTEM Rights: In the new command prompt window, type `whoami` to confirm that you have SYSTEM rights.
5. Open Registry Editor with SYSTEM Rights: In the new command prompt window, type `regedit` to open the Registry Editor with SYSTEM rights.
6. Locate the IRK: Navigate to `HKLM\SYSTEM\CurrentControlSet\Services\BTHPORT\Parameters\Keys`. There is one subfolder that probably holds the computer's Bluetooth radio's MAC address, look inside it for the folder corresponding to the MAC address of your Bluetooth device.
7. Right-click the key(folder) and select export. Save the `.reg` file somewhere.
8. Open the `.reg` file in Notepad. To open the **Replace** window, press Ctrl+H. **Find what:** "," and **Replace with** "". Select **Replace All**. This removes all commas from the hex value.
9. Copy the IRK value (only the part after `hex:`) and it can be used as-is. No reversing of byte order needs to be done.
## ESPresense
If you already use Identity Resolving Key tracking with ESPresence then you already have a hex-encoded version of your Identity Resolving Key. Home Assistant can use the key in this format directly.