Skip to content
This repository has been archived by the owner on Jun 27, 2022. It is now read-only.

TypeError: Incorrect padding on connect attempt when password incorrect #50

Open
drook opened this issue Feb 17, 2016 · 8 comments
Open
Labels

Comments

@drook
Copy link

drook commented Feb 17, 2016

I'm trying to run transwhat as a spectrum2 backend. I've set up spectrum2 (it's running ICQtransport for two weeks now) and launched transwhat. I got my password from WART, registered to transport, and I'm getting the error below when trying to log in. I took a tcpdump capture, the connection is made successfully to the e1.whatsapp.net:443, and it's closing by the remote, so it looks like the data is transmitting fine.

Environment:

OS:
FreeBSD 10-STABLE

Python:

Backend debug log:

Python 2.7.11 (default, Jan 28 2016, 12:50:28) 
[GCC 4.2.1 Compatible FreeBSD Clang 3.4.1 (tags/RELEASE_34/dot1-final 208032)] on freebsd10
2016-02-17 16:46:55,185 DEBUG WhatsAppBackend: Backend started
2016-02-17 16:46:55,221 DEBUG WhatsAppBackend: handleLoginRequest(user=emz@jabber.norma.perm.ru, legacyName=79028324213)
2016-02-17 16:46:55,221 DEBUG yowsup.stacks.yowstack: Initializing stack
2016-02-17 16:46:55,221 DEBUG yowsup.stacks.yowstack: Constructed Network Layer
2016-02-17 16:46:55,222 DEBUG yowsup.stacks.yowstack: Constructed Stanza Regulator Layer
2016-02-17 16:46:55,222 DEBUG yowsup.stacks.yowstack: Constructed Crypt Layer
2016-02-17 16:46:55,222 DEBUG yowsup.stacks.yowstack: Constructed Coder Layer
2016-02-17 16:46:55,222 DEBUG yowsup.stacks.yowstack: Constructed Axolotl Layer
2016-02-17 16:46:55,222 DEBUG yowsup.stacks.yowstack: Constructed Authentication Layer - Messages Layer - Receipt Layer - Ack Layer - Media Layer - Ib Layer - Iq Layer - notification Ib Layer - Iq Layer - Chatstate Layer - call Layer - Privacy Layer - Profiles Layer - Groups Iq Layer - Presence Layer
2016-02-17 16:46:55,222 DEBUG yowsup.stacks.yowstack: Constructed Interface Layer
2016-02-17 16:46:55,222 INFO Session: Created: 79028324213
2016-02-17 16:46:55,223 INFO Session: emz@jabber.norma.perm.ru attempting login
2016-02-17 16:46:55,223 DEBUG yowsup.layers.network.layer: Connecting to e1.whatsapp.net:443
2016-02-17 16:46:55,320 DEBUG WhatsAppBackend: handleBuddies(buddies=)
2016-02-17 16:46:55,673 ERROR transwhat: Traceback (most recent call last):
  File "/usr/local/transwhat/transwhat.py", line 94, in <module>
    asyncore.loop(timeout=1.0, count=10, use_poll = True)
  File "/usr/local/lib/python2.7/asyncore.py", line 220, in loop
    poll_fun(timeout, map)
  File "/usr/local/lib/python2.7/asyncore.py", line 201, in poll2
    readwrite(obj, flags)
  File "/usr/local/lib/python2.7/asyncore.py", line 123, in readwrite
    obj.handle_error()2016-02-17 16:46:55,185 DEBUG WhatsAppBackend: Backend started
2016-02-17 16:46:55,221 DEBUG WhatsAppBackend: handleLoginRequest(user=emz@jabber.norma.perm.ru, legacyName=79028324213)
2016-02-17 16:46:55,221 DEBUG yowsup.stacks.yowstack: Initializing stack
2016-02-17 16:46:55,221 DEBUG yowsup.stacks.yowstack: Constructed Network Layer
2016-02-17 16:46:55,222 DEBUG yowsup.stacks.yowstack: Constructed Stanza Regulator Layer
2016-02-17 16:46:55,222 DEBUG yowsup.stacks.yowstack: Constructed Crypt Layer
2016-02-17 16:46:55,222 DEBUG yowsup.stacks.yowstack: Constructed Coder Layer
2016-02-17 16:46:55,222 DEBUG yowsup.stacks.yowstack: Constructed Axolotl Layer
2016-02-17 16:46:55,222 DEBUG yowsup.stacks.yowstack: Constructed Authentication Layer - Messages Layer - Receipt Layer - Ack Layer - Media Layer - Ib Layer - Iq Layer - notification Ib Layer - Iq Layer - Chatstate Layer - call Layer - Privacy Layer - Profiles Layer - Groups Iq Layer - Presence Layer
2016-02-17 16:46:55,222 DEBUG yowsup.stacks.yowstack: Constructed Interface Layer
2016-02-17 16:46:55,222 INFO Session: Created: 79028324213
2016-02-17 16:46:55,223 INFO Session: emz@jabber.norma.perm.ru attempting login
2016-02-17 16:46:55,223 DEBUG yowsup.layers.network.layer: Connecting to e1.whatsapp.net:443
2016-02-17 16:46:55,320 DEBUG WhatsAppBackend: handleBuddies(buddies=)
2016-02-17 16:46:55,673 ERROR transwhat: Traceback (most recent call last):
  File "/usr/local/transwhat/transwhat.py", line 94, in <module>
    asyncore.loop(timeout=1.0, count=10, use_poll = True)
  File "/usr/local/lib/python2.7/asyncore.py", line 220, in loop
    poll_fun(timeout, map)
  File "/usr/local/lib/python2.7/asyncore.py", line 201, in poll2
    readwrite(obj, flags)
  File "/usr/local/lib/python2.7/asyncore.py", line 123, in readwrite
    obj.handle_error()
  File "/usr/local/lib/python2.7/asyncore.py", line 110, in readwrite
    obj.handle_write_event()
  File "/usr/local/lib/python2.7/asyncore.py", line 467, in handle_write_event
    self.handle_connect_event()
  File "/usr/local/lib/python2.7/asyncore.py", line 455, in handle_connect_event
    self.handle_connect()
  File "/usr/local/lib/python2.7/site-packages/yowsup/layers/network/layer.py", line 68, in handle_connect
    self.emitEvent(YowLayerEvent(YowNetworkLayer.EVENT_STATE_CONNECTED))
  File "/usr/local/lib/python2.7/site-packages/yowsup/layers/__init__.py", line 72, in emitEvent
    self.__upper.emitEvent(yowLayerEvent)
  File "/usr/local/lib/python2.7/site-packages/yowsup/layers/__init__.py", line 72, in emitEvent
    self.__upper.emitEvent(yowLayerEvent)
  File "/usr/local/lib/python2.7/site-packages/yowsup/layers/__init__.py", line 72, in emitEvent
    self.__upper.emitEvent(yowLayerEvent)
  File "/usr/local/lib/python2.7/site-packages/yowsup/layers/__init__.py", line 72, in emitEvent
    self.__upper.emitEvent(yowLayerEvent)
  File "/usr/local/lib/python2.7/site-packages/yowsup/layers/__init__.py", line 66, in emitEvent
    if self.__upper and not self.__upper.onEvent(yowLayerEvent):
  File "/usr/local/lib/python2.7/site-packages/yowsup/layers/__init__.py", line 187, in onEvent
    stopEvent = stopEvent or s.onEvent(yowLayerEvent)
  File "/usr/local/lib/python2.7/site-packages/yowsup/layers/auth/layer_authentication.py", line 53, in onEvent
    self.login()
  File "/usr/local/lib/python2.7/site-packages/yowsup/layers/auth/layer_authentication.py", line 57, in login
    self.credentials = self._credentials or self.__getCredentials()
  File "/usr/local/lib/python2.7/site-packages/yowsup/layers/auth/layer_authentication.py", line 37, in __getCredentials
    password = base64.b64decode(pb64)
  File "/usr/local/lib/python2.7/base64.py", line 77, in b64decode
    raise TypeError(msg)
TypeError: Incorrect padding
  File "/usr/local/lib/python2.7/asyncore.py", line 110, in readwrite
    obj.handle_write_event()
  File "/usr/local/lib/python2.7/asyncore.py", line 467, in handle_write_event
    self.handle_connect_event()
  File "/usr/local/lib/python2.7/asyncore.py", line 455, in handle_connect_event
    self.handle_connect()
  File "/usr/local/lib/python2.7/site-packages/yowsup/layers/network/layer.py", line 68, in handle_connect
    self.emitEvent(YowLayerEvent(YowNetworkLayer.EVENT_STATE_CONNECTED))
  File "/usr/local/lib/python2.7/site-packages/yowsup/layers/__init__.py", line 72, in emitEvent
    self.__upper.emitEvent(yowLayerEvent)
  File "/usr/local/lib/python2.7/site-packages/yowsup/layers/__init__.py", line 72, in emitEvent
    self.__upper.emitEvent(yowLayerEvent)
  File "/usr/local/lib/python2.7/site-packages/yowsup/layers/__init__.py", line 72, in emitEvent
    self.__upper.emitEvent(yowLayerEvent)
  File "/usr/local/lib/python2.7/site-packages/yowsup/layers/__init__.py", line 72, in emitEvent
    self.__upper.emitEvent(yowLayerEvent)
  File "/usr/local/lib/python2.7/site-packages/yowsup/layers/__init__.py", line 66, in emitEvent
    if self.__upper and not self.__upper.onEvent(yowLayerEvent):
  File "/usr/local/lib/python2.7/site-packages/yowsup/layers/__init__.py", line 187, in onEvent
    stopEvent = stopEvent or s.onEvent(yowLayerEvent)
  File "/usr/local/lib/python2.7/site-packages/yowsup/layers/auth/layer_authentication.py", line 53, in onEvent
    self.login()
  File "/usr/local/lib/python2.7/site-packages/yowsup/layers/auth/layer_authentication.py", line 57, in login
    self.credentials = self._credentials or self.__getCredentials()
  File "/usr/local/lib/python2.7/site-packages/yowsup/layers/auth/layer_authentication.py", line 37, in __getCredentials
    password = base64.b64decode(pb64)
  File "/usr/local/lib/python2.7/base64.py", line 77, in b64decode
    raise TypeError(msg)
TypeError: Incorrect padding
@vitalyster
Copy link
Contributor

tgalal/yowsup#947

@drook
Copy link
Author

drook commented Feb 17, 2016

Oh... sorry then. You're right, I was missing = at the end. Sorry for bothering.

@drook drook closed this as completed Feb 17, 2016
@drook
Copy link
Author

drook commented Feb 17, 2016

By the way it looks like it's impossible to use XMPP gateway with running Whatsapp client on the phone: they start to interfere transwaht.py is gettin "Unauthorized" errors, and after rerequesting the code for a small number of retries (3) with WART I got ten(!) calls from Woodside, CA, United States. Didn't even want to be involved in a conversation of any kind with techsuppport. So, in case somebody will step on it, beware. Looks like it's suited only for mimicing a client from non-Andriod/non-IOS phone (although it's a great thing).

@vitalyster
Copy link
Contributor

To use yowsup-based clients(transports) you need to extract password from the phone and use it with transport, requesting new password with WART disable other clients

@drook
Copy link
Author

drook commented Feb 17, 2016

Yes, but there are limited number of ways to do so: from 4 of the links in the Usage article three are dead: method described in the last one is marked as "doesn't work anymore", third one is 404, second one is wiped out by the author, so only first one remains, and it does look very similar to WART, so i thought....

@moyamo
Copy link
Collaborator

moyamo commented Feb 17, 2016

As far as I know, whatsapp only allows one connection per account. Thus you cannot use the official whatsapp client and transwhat simultaneously. You can, however, connect to transwhat in gateway mode using multiple XMPP resources e.g. You run an XMPP client on your cellphone and your laptop and they both connect with the same account to a transwhat server.

@moyamo moyamo added the bug label Feb 17, 2016
@moyamo moyamo changed the title TypeError: Incorrect padding on connect attempt TypeError: Incorrect padding on connect attempt when password incorrect Feb 17, 2016
@moyamo moyamo reopened this Feb 17, 2016
@vitalyster
Copy link
Contributor

@moyamo btw, this error appear when password not encoded properly, also there is a different problem - when password incorrect (but encoded ok) - transwhat is just crashed :)

@moyamo
Copy link
Collaborator

moyamo commented Feb 17, 2016

I think this is related to #44

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants