OpenXbox / xbox-smartglass-core-python

SmartGlass Core protocol python library
https://pypi.python.org/pypi/xbox-smartglass-core
MIT License
73 stars 13 forks source link

TypeError: from_buffer() cannot return the address of the raw string within a bytes or unicode or bytearray object #16

Closed carlberg74 closed 4 years ago

carlberg74 commented 5 years ago

Hi, Why do I always get error such as this;

user@ubuntu1604:~$ xbox-poweroff --all
INFO:authentication:Loaded token <class 'xbox.webapi.authentication.token.AccessToken'> from file
INFO:authentication:Loaded token <class 'xbox.webapi.authentication.token.RefreshToken'> from file
INFO:authentication:Loaded token <class 'xbox.webapi.authentication.token.UserToken'> from file
INFO:authentication:Loaded token <class 'xbox.webapi.authentication.token.XSTSToken'> from file
Traceback (most recent call last):
  File "/usr/local/bin/xbox-poweroff", line 10, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.5/dist-packages/xbox/sg/scripts/poweroff.py", line 63, in main
    state = c.connect(userhash, token)
  File "/usr/local/lib/python3.5/dist-packages/xbox/sg/console.py", line 284, in connect
    xsts_token=xsts_token)
  File "/usr/local/lib/python3.5/dist-packages/xbox/sg/protocol.py", line 452, in connect
    self.send_message(m)
  File "/usr/local/lib/python3.5/dist-packages/xbox/sg/protocol.py", line 137, in send_message
    data = packer.pack(msg, self.crypto)
  File "/usr/local/lib/python3.5/dist-packages/xbox/sg/packer.py", line 117, in pack
    packed_protected = crypto.encrypt(iv, packed_protected)
  File "/usr/local/lib/python3.5/dist-packages/xbox/sg/crypto.py", line 274, in encrypt
    return Crypto._encrypt(self._encrypt_key, iv, plaintext)
  File "/usr/local/lib/python3.5/dist-packages/xbox/sg/crypto.py", line 323, in _encrypt
    return Crypto._crypt(key=key, iv=iv, encrypt=True, data=data)
  File "/usr/local/lib/python3.5/dist-packages/xbox/sg/crypto.py", line 341, in _crypt
    return cryptor.update(data) + cryptor.finalize()
  File "/usr/local/lib/python3.5/dist-packages/cryptography/hazmat/primitives/ciphers/base.py", line 149, in update
    return self._ctx.update(data)
  File "/usr/local/lib/python3.5/dist-packages/cryptography/hazmat/backends/openssl/ciphers.py", line 120, in update
    n = self.update_into(data, buf)
  File "/usr/local/lib/python3.5/dist-packages/cryptography/hazmat/backends/openssl/ciphers.py", line 131, in update_into
    "unsigned char *", self._backend._ffi.from_buffer(buf)
**TypeError: from_buffer() cannot return the address of the raw string within a bytes or unicode or bytearray object**

I am able to authenticate and discover, but when I try something else I always get that error. I have check dependencies and versions, and it all seem correct. What am I missing.

Running Version: 1.1.7

carlberg74 commented 5 years ago

xbox-poweron with liveid seem to work, but no other commands.. xbox-poweroff --all or with liveid gives same error. ..all commands that tries to use connect on xbox-client fails due to crypto.py line 323.

carlberg74 commented 5 years ago

No one else has this problem? Running ubuntu 16.04..

tuxuser commented 4 years ago

Can you give a status update? It should be fixed by now as I suspect it was related to a quirk with cryptographyin combination with python 3.5.

See https://github.com/pyca/cryptography/commit/0517d1ae49061f486e2e4d279d70b6b61361de2f#commitcomment-29616242

tuxuser commented 4 years ago

Closing due to inactivity.