Advertisement
diyfuturism

DIYfuturism.com - Xiaomi Mi Robot Token Converter

Nov 27th, 2017
333
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.72 KB | None | 0 0
  1. # XIAOMI MI ROBOT -> HOME ASSISTANT TOKEN CONVERTER (PYTHON)
  2. #
  3. # Convert the Xiaomi Mi Robot 96 character iOS token to the 32 character token required
  4. # AES-ECB decrypt a 96 character iOS token -> valid 32 character token
  5. #
  6. # Thanks:
  7. # https://community.home-assistant.io/t/xiaomi-gateway-integration/8213/3052
  8. #
  9. # More info on using this:
  10. # http://www.diyfuturism.com/index.php/2017/11/28/config-setting-up-the-xiaomi-mi-robot-vacuum-in-home-assistant/
  11.  
  12. from Crypto.Cipher import AES
  13. import binascii
  14. keystring = '00000000000000000000000000000000'
  15. iostoken = '96charactertokenfromsqlite'
  16. key = bytes.fromhex(keystring)
  17. cipher = AES.new(key, AES.MODE_ECB)
  18. token = cipher.decrypt(bytes.fromhex(iostoken[:64]))
  19. print(token)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement