vpeter

Untitled

Sep 21st, 2020 (edited)
803
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/bin/sh
  2.  
  3. mkdir -p /storage/downloads
  4. cd /storage/downloads
  5.  
  6. ANDROID_DATA_FOLDER=$(mktemp -d /media/android_data.tmp.XXXXXX) || exit 1
  7.  
  8. mount -o ro /dev/data $ANDROID_DATA_FOLDER
  9. rm -f bt_config.conf
  10. cp $ANDROID_DATA_FOLDER/misc/bluedroid/bt_config.conf bt_config.conf
  11. umount $ANDROID_DATA_FOLDER || exit 1
  12. rmdir $ANDROID_DATA_FOLDER || exit 1
  13.  
  14.  
  15. LongTermKey=$(cat bt_config.conf | awk '/LE_KEY_LENC/ {print "Key=" toupper($3)}')
  16. LocalSignatureKey=$(cat bt_config.conf | awk '/LE_KEY_LCSRK/ {print "Key=" substr(toupper($3),9,32)}')
  17. RemoteSignatureKey=$(cat bt_config.conf | awk '/LE_KEY_PCSRK/ {print "Key=" substr(toupper($3),9,32)}')
  18.  
  19. echo "LongTermKey:        $LongTermKey"
  20. echo "LocalSignatureKey:  $LocalSignatureKey"
  21. echo "RemoteSignatureKey: $RemoteSignatureKey"
  22.  
  23.  
  24. [ ! -f info_orig ] && cp /storage/.cache/bluetooth/D4\:12\:43\:01\:E6\:37/F4\:4E\:FD\:00\:03\:D6/info info_orig
  25. rm -f info
  26. #cp /storage/.cache/bluetooth/D4\:12\:43\:01\:E6\:37/F4\:4E\:FD\:00\:03\:D6/info info
  27. cp info_orig info
  28.  
  29. sed -i "/\[LongTermKey\]/!b;n;c$LongTermKey" info
  30. sed -i "/\[LocalSignatureKey\]/!b;n;c$LocalSignatureKey" info
  31. sed -i "/\[RemoteSignatureKey\]/!b;n;c$RemoteSignatureKey" info
  32.  
  33. # fix EncSize for LongTermKey
  34. # remove ediv at [*key*]
  35. sed -i '/^\[LongTermKey\]$/,/^\[/ s/^EncSize=16/EncSize=20/' info
  36. sed -i '/^\[LongTermKey\]$/,/^\[/ s/^EDiv=.*/delete_this_line/' info
  37. sed -i '/^\[LongTermKey\]$/,/^\[/ s/^Rand=.*/delete_this_line/' info
  38.  
  39. sed -i '/delete_this_line/d' info
  40.  
  41. echo copying file and restarting bt
  42.  
  43. cp info /storage/.cache/bluetooth/D4\:12\:43\:01\:E6\:37/F4\:4E\:FD\:00\:03\:D6/info
  44. systemctl restart bluetooth.service
  45.  
  46. exit 0
  47.  
RAW Paste Data