digitalbirdo / BT-LinkkeySync

Scripts to synchronize bluetooth link keys from mac OSX to windows
MIT License
112 stars 32 forks source link

what I did wrong? #22

Open roddy20 opened 3 years ago

roddy20 commented 3 years ago

`git clone https://github.com/digitalbirdo/BT-LinkkeySync Cloning into 'BT-LinkkeySync'... remote: Enumerating objects: 42, done. remote: Total 42 (delta 0), reused 0 (delta 0), pack-reused 42 Unpacking objects: 100% (42/42), done. Mac-Pro-Rodion:src rodion$ cd BT-LinkkeySync/ Mac-Pro-Rodion:BT-LinkkeySync rodion$ chmod +x BT-LinkkeySync.py Mac-Pro-Rodion:BT-LinkkeySync rodion$ sudo ./BT-LinkkeySync.py Password:

BT-Linkkeysync by DigitalBird

get Bluetooth Link Keys from macOS and store it to blued.plist convert exported list from binary to xml parse the converted plist Convert the Link Keys and store them to btkeys.reg Bluetooth 2.0: 1 Links keys found Traceback (most recent call last): File "./BT-LinkkeySync.py", line 52, in f.write('\r\n"'+device.replace("-","")+'"=hex:'+ convertToWinRep(pl["LinkKeys"][adapter][device].data.hex())) AttributeError: 'str' object has no attribute 'hex' `

roddy20 commented 3 years ago

btkeys.reg.zip blued.plist.zip Here are files

roddy20 commented 3 years ago

it works much better from Windows to macOS setup all the devices in Windows export reg `Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Services\BTHPORT\Parameters\Keys\001a7dda7113] "d49a207f0a02"=hex:9b,40,75,a7,66,77,d1,cd,26,28,05,d4,59,2a,98,02`

convert to blued.plist

{ LinkKeys = { "00-1a-7d-da-71-13" = { "d4-9a-20-7f-0a-02" = <02982a59 d4052826 cdd17766 a775409b>; }; }; }

and copy to its place

roddy20 commented 3 years ago

the calculator from 9b,40,75,a7,66,77,d1,cd,26,28,05,d4,59,2a,98,02 to 02982a59 d4052826 cdd17766 a775409b #!/bin/sh read s; s=$(echo $s | tr -d ','); for i in {15..0}; do result=$result${s:$(( i * 2 )):2}; done; echo ${result};

roddy20 commented 3 years ago

from Windows BTKeys.reg to Mac blued.plist `cd "$(dirname "$0")" /usr/libexec/PlistBuddy -c "Add LinkKeys dict" /tmp/temp.plist input=BTKeys.reg while IFS= read -r line do if [[ "$line" == 'HKEY_LOCAL_MACHINE' ]] then s=$(echo ${line:78:12} | sed 's/.{2}/&-/g') s=${s%?} t=$s /usr/libexec/PlistBuddy -c "Add LinkKeys:$t dict" /tmp/temp.plist fi

if [[ "$line" == '=' ]] then s=$(echo ${line:1:12} | sed 's/.{2}/&-/g') s=${s%?} key=$s s=$(echo ${line:19:47} | tr -d ',') value=$s

echo $key $value echo $value | xxd -r -p > /tmp/bin /usr/libexec/PlistBuddy -c "Import LinkKeys:$t:$key /tmp/bin" /tmp/temp.plist plutil -convert binary1 /tmp/temp.plist fi

done < "$input"

cp /tmp/temp.plist ./`

michalriha1 commented 3 years ago

`git clone https://github.com/digitalbirdo/BT-LinkkeySync

Cloning into 'BT-LinkkeySync'... remote: Enumerating objects: 42, done. remote: Total 42 (delta 0), reused 0 (delta 0), pack-reused 42 Unpacking objects: 100% (42/42), done. Mac-Pro-Rodion:src rodion$ cd BT-LinkkeySync/ Mac-Pro-Rodion:BT-LinkkeySync rodion$ chmod +x BT-LinkkeySync.py Mac-Pro-Rodion:BT-LinkkeySync rodion$ sudo ./BT-LinkkeySync.py Password:

BT-Linkkeysync by DigitalBird

get Bluetooth Link Keys from macOS and store it to blued.plist convert exported list from binary to xml parse the converted plist Convert the Link Keys and store them to btkeys.reg Bluetooth 2.0: 1 Links keys found Traceback (most recent call last): File "./BT-LinkkeySync.py", line 52, in f.write('\r\n"'+device.replace("-","")+'"=hex:'+ convertToWinRep(pl["LinkKeys"][adapter][device].data.hex())) AttributeError: 'str' object has no attribute 'hex' `

run it with python3

roddy20 commented 3 years ago

run it with python3

thanks I already did the entire script in bash, no python required :) https://github.com/digitalbirdo/BT-LinkkeySync/issues/18

roddy20 commented 3 years ago

run it with python3

python3 BT-LinkkeySync.py

BT-Linkkeysync by DigitalBird

get Bluetooth Link Keys from macOS and store it to blued.plist Password: convert exported list from binary to xml parse the converted plist Traceback (most recent call last): File "/Volumes/Untitled/BT-LinkkeySync-master/BT-LinkkeySync.py", line 27, in pl = readPlist("./blued.plist") NameError: name 'readPlist' is not defined Mac-Pro-Rodion:BT-LinkkeySync-master rodion$ the same. deleted as useless

dimka4996 commented 3 years ago

@roddy20 of you're Russian or speak Russian please write me on telegram, username the same with GitHub, need help with your script, can't import