Yowsup: Nothing working, allways "Connection Closed"

Created on 12 Sep 2017  ·  21Comments  ·  Source: tgalal/yowsup

Hi:
I'm facing issues with yowsup. Registration works fine with the latest md5 classes. With S40 I allways get "old version" error.
But after registration nothing works. No matter what demo I try, echo or commandline, I allways get this Error with -d:

DEBUG:yowsup.layers.network.layer:Connecting to e11.whatsapp.net:443
DEBUG:yowsup.layers.logger.layer:tx:

DEBUG:yowsup.layers.logger.layer:tx:

DEBUG:yowsup.layers.logger.layer:rx:

DEBUG:yowsup.layers.logger.layer:rx:

K���NC;�ͨ�-�@ټ
HEX:4b87f29b4e433bdfcda81a832ddd40ef808dd9bc

DEBUG:yowsup.layers.logger.layer:tx:

�!�24�;
��J�o<�i8�I�0��rVW�M�?.3�+���Ob�z��Y���e���>S��)�i0��l�D�6(t$��
HEX:fb21b232349a1f3b0cf8da4ad66f3c926938a549f03094c8725657f54d993f2e33b82bded6c64f621>dde7ab700e659a9abd165e194dd0153f3dc2990006930d8e86cf3448a362800017411241ee78a

DEBUG:yowsup.layers.network.layer:Disconnected, reason: Connection Closed
general: Disconnected: Connection Closed

No matter what I do, its allways the same.

Most helpful comment

Same issue as @ravesingh1983 here

All 21 comments

try again

Can you register success now ?

Am getting the same error. Using the Android profile.
Am able to register. Previously having the old_version error.

Any recommendations ?

DEBUG:yowsup.layers.network.layer:Connecting to e5.whatsapp.net:443
DEBUG:yowsup.layers.logger.layer:tx:

DEBUG:yowsup.layers.logger.layer:tx:

DEBUG:yowsup.layers.logger.layer:rx:

DEBUG:yowsup.layers.logger.layer:rx:

HEX:eee7eeb90fbbc4ac530c8471910a96ceb53c2b31

DEBUG:yowsup.layers.logger.layer:tx:

–HEX:966487792805f460fab36986d978cb17384d7a67b34f8ae117e4f015107f6a7524c88e0691e437a966ae187b225fe290b84bdcc9a1870bdf558bb6789fbf153f8249a8b3650efbe325c9999f

DEBUG:yowsup.layers.network.layer:Disconnected, reason: Connection Closed
general: Disconnected: Connection Closed

I recommend you to use a WhatsApp web API like this : https://github.com/zvovov/whatsapp-web. Even if yowsup will work some time, you will get banned soon as WhatsApp even whatches how long you type before you write a message.
The project mentioned above worked for me with chrome but not headless. I think this will work with Firefox headless, don't know about chrome headless.

Solved the issue. Switch back to s40 env by commenting off the Android and it's now working under s40

How could you register with s40 ? Or did you register with Android ? Could you please paste your s40 file here ? I could not register with s40.

I did the following

Register

  1. To register mod the file ~yowsup-master/yowsup/env/__init__.py to comment off env_s40 env
    from .env import YowsupEnv
    from .env_android import AndroidYowsupEnv

from .env_s40 import S40YowsupEnv

  1. Change the ~/yowsup-master/yowsup/env/env_android.py
    _MD5_CLASSES = "ox998VW0nBTueMVfjuZkmQ=="
    _VERSION = "2.17.212"

Register the phone
When you try to connect you will get the above Connection close.

To CONNECT

Mod the ~yowsup-master/yowsup/env/__init__.py to comment off Android and turn on S40
from .env import YowsupEnv

from .env_android import AndroidYowsupEnv

from .env_s40 import S40YowsupEnv

Try to connect again.
[yowsup-master]$ ./yowsup-cli demos -c yowsup.config -y
yowsup-cli v2.0.15
yowsup v2.5.2

Copyright (c) 2012-2016 Tarek Galal
http://www.openwhatsapp.org

This software is provided free of charge. Copying and redistribution is
encouraged.

If you appreciate this software and you would like to support future
development please consider donating:
http://openwhatsapp.org/yowsup/donate

Yowsup Cli client

Type /help for available commands

Auth: Logged in!
[connected]:

Hope that helps

Thanks for your help, I will try it later. But I'm afraid of getting banned, because I read somewhere it's very likely if you register with a different device than you connect. That makes sense to me, because I think it's not possible to register with an Android and connect with a s40 with the real WhatsApp app.

You will getting banned. If you register with s40 and then you connect
with android. You are dead my friend!

Saludos,
Pablo

On Wed, Sep 13, 2017 at 6:33 AM, v1nc notifications@github.com wrote:

Thanks for your help, I will try it later. But I'm afraid of getting
banned, because I read somewhere it's very likely if you register with a
different device than you connect. That makes sense to me, because I think
it's not possible to register with an Android and connect with a s40 with
the real WhatsApp app.


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
https://github.com/tgalal/yowsup/issues/2249#issuecomment-329113190, or mute
the thread
https://github.com/notifications/unsubscribe-auth/AEymzUQSX9Px8_s5m0gj266EeMIBiBk1ks5sh6F-gaJpZM4PUxO4
.

@v1nc i also afraid of getting banned too if register using s40 and connect using android. Can you connect using android?

```

DEBUG:yowsup.layers.logger.layer:rx:

DEBUG:yowsup.layers.logger.layer:rx:

¢TVH,•Pm½‡­
‡“”
HEX3:b'a2541c105648152c9095506dbd0487ad0a879394'

DEBUG:yowsup.layers.logger.layer:tx:

²˜wòjpÍ)KLzð¨`×Ó¦Ârě¿Eá{9º"Ç\«üHªÖðj1½'ì¨E{­0Ìc¢wmØÔúF•]ßVÊkÑ(ör
HEX3:b'b29877f26a70cd294b4c7af01da860d7c393a6c272c49bbf45e17b39ba22c75cabfc48aad6f0066a31bd27eca8457bad1a30cc63c2a204776d13d8d4fa465b08134f08955ddf56ca6bd128f672'

DEBUG:yowsup.layers.network.layer:Disconnected, reason: Connection Closed```

I am also facing same issue.

I am able to register. But when i try to send text message i get Connection Closed.

Any help is appreciated

yowsup-cli demos -d -c configfile --yowsup --env android

yowsup-cli demos -l 91XXXXXXXXX:XVVa/243edDiZUyWnXe8GH46oBE= -E android -s 91XXXXXXX "Hello" --debug
DEBUG:yowsup.env.env:Current env changed to android
yowsup-cli v2.0.15
yowsup v2.5.2

Copyright (c) 2012-2016 Tarek Galal
http://www.openwhatsapp.org

This software is provided free of charge. Copying and redistribution is
encouraged.

If you appreciate this software and you would like to support future
development please consider donating:
http://openwhatsapp.org/yowsup/donate

DEBUG:yowsup.stacks.yowstack:Initializing stack
DEBUG:yowsup.stacks.yowstack:Constructed Network Layer
DEBUG:yowsup.stacks.yowstack:Constructed Stanza Regulator Layer
DEBUG:yowsup.stacks.yowstack:Constructed Crypt Layer
DEBUG:yowsup.stacks.yowstack:Constructed Coder Layer
DEBUG:yowsup.stacks.yowstack:Constructed Logger Layer
DEBUG:yowsup.stacks.yowstack:Constructed
DEBUG:yowsup.stacks.yowstack:Constructed Axolotl Layer -
DEBUG:yowsup.stacks.yowstack:Constructed Authentication Layer - Messages Layer - Receipt Layer - Ack Layer - Presence Layer - Ib Layer - Iq Layer - notification Ib Layer - Iq Layer - Chatstate Layer - call Layer - Groups Iq Layer - Media Layer - Privacy Layer - Profiles Layer
DEBUG:yowsup.stacks.yowstack:Constructed Interface Layer
DEBUG:yowsup.layers.network.layer:Connecting to e12.whatsapp.net:443
DEBUG:yowsup.layers.logger.layer:tx:

DEBUG:yowsup.layers.logger.layer:tx:

DEBUG:yowsup.layers.logger.layer:rx:

DEBUG:yowsup.layers.logger.layer:rx:

’
6ޜÛö¶ ªgëû¢’è_A
HEX3:b'920c36de9cdbf6b620aa67ebfba29201e8195f41'

DEBUG:yowsup.layers.logger.layer:tx:

av”]^¸Á‰9œ”çîO,ô »d‰ƒù…Sà“›ÄR–
¼m¦ÌŒôäsMn°ÜùC­mCÙø|‚,6|úL%yÀzÛpèYr·¤œíà´
HEX3:b'156176945d065eb8c100118913399c9404e7eeb719084f112cf4a0bb648983f98553e0939bc452960cbc6da6cc8cf4e4734d6eb0dcc3b94301ad6d43d904f87c822c1c367c8dfa4c2579c07adb70e85972b7a49c18ede0b4'

DEBUG:yowsup.layers.network.layer:Disconnected, reason: Connection Closed

Whatsapp Android version uses a protocol not implemented implemented by yowsup. Yowsup current release uses protocol wa1.6 but iphone and android sw use protocol version wa2.0.

So what is the other option or I am blocked now ??

You can use s40 env.

O.k

Some Background
But i was not able to get registration code using env as s40 as I was getting old version error. So I found I have to move to andriod.
After moving to andriod i was able to register but as told previously stuck at sending message.

Now coming back to your suggestion .....

So you are telling only to use env as s40 for yowsup-cli demos -d -c configfile --yowsup --env s40 ??

Is doing registration as andriod and sending message as s40 will work ??

I am stuck at this for past 1 week

BTW here is my emv.s40 and env_android.py. Let me know if you think something wrong as well.

Thanks in Advance.

from .env import YowsupEnv
import hashlib
class S40YowsupEnv(YowsupEnv):
_VERSION = "2.17.254"
_OS_NAME= "S40"
_OS_VERSION = "14.26"
_DEVICE_NAME = "302"
_MANUFACTURER = "Nokia"
_TOKEN_STRING = "PdA2DJyKoUrwLw1Bg6EIhzh502dF9noR9uFCllGk1478194306452{phone}"
_AXOLOTL = True

def getVersion(self):
    return self.__class__._VERSION

def getOSName(self):
    return self.__class__._OS_NAME

def getOSVersion(self):
    return self.__class__._OS_VERSION

def getDeviceName(self):
    return self.__class__._DEVICE_NAME

def getManufacturer(self):
    return self.__class__._MANUFACTURER

def isAxolotlEnabled(self):
    return self.__class__._AXOLOTL

def getToken(self, phoneNumber):
    return hashlib.md5(self.__class__._TOKEN_STRING.format(phone = phoneNumber).encode()).hexdigest()

def getUserAgent(self):
    return self.__class__._USERAGENT_STRING.format(
        WHATSAPP_VERSION = self.getVersion(),
        OS_NAME = self.getOSName() + "Version",
        OS_VERSION = self.getOSVersion(),
        DEVICE_NAME = self.getDeviceName(),
        MANUFACTURER = self.getManufacturer()
    )

~
~

Here is my env_andriod.py

from .env import YowsupEnv
import base64
import hashlib

class AndroidYowsupEnv(YowsupEnv):
_SIGNATURE = "MIIDMjCCAvCgAwIBAgIETCU2pDALBgcqhkjOOAQDBQAwfDELMAkGA1UEBhMCVVMxEzARBgNVBAgTCkNhbGlmb3JuaWExFDASBgNV" \
"BAcTC1NhbnRhIENsYXJhMRYwFAYDVQQKEw1XaGF0c0FwcCBJbmMuMRQwEgYDVQQLEwtFbmdpbmVlcmluZzEUMBIGA1UEAxMLQnJ" \
"pYW4gQWN0b24wHhcNMTAwNjI1MjMwNzE2WhcNNDQwMjE1MjMwNzE2WjB8MQswCQYDVQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5" \
"pYTEUMBIGA1UEBxMLU2FudGEgQ2xhcmExFjAUBgNVBAoTDVdoYXRzQXBwIEluYy4xFDASBgNVBAsTC0VuZ2luZWVyaW5nMRQwEg" \
"YDVQQDEwtCcmlhbiBBY3RvbjCCAbgwggEsBgcqhkjOOAQBMIIBHwKBgQD9f1OBHXUSKVLfSpwu7OTn9hG3UjzvRADDHj+AtlEm" \
"aUVdQCJR+1k9jVj6v8X1ujD2y5tVbNeBO4AdNG/yZmC3a5lQpaSfn+gEexAiwk+7qdf+t8Yb+DtX58aophUPBPuD9tPFHsMCN" \
"VQTWhaRMvZ1864rYdcq7/IiAxmd0UgBxwIVAJdgUI8VIwvMspK5gqLrhAvwWBz1AoGBAPfhoIXWmz3ey7yrXDa4V7l5lK+7+jr" \
"qgvlXTAs9B4JnUVlXjrrUWU/mcQcQgYC0SRZxI+hMKBYTt88JMozIpuE8FnqLVHyNKOCjrh4rs6Z1kW6jfwv6ITVi8ftiegEkO" \
"8yk8b6oUZCJqIPf4VrlnwaSi2ZegHtVJWQBTDv+z0kqA4GFAAKBgQDRGYtLgWh7zyRtQainJfCpiaUbzjJuhMgo4fVWZIvXHaS" \
"HBU1t5w//S0lDK2hiqkj8KpMWGywVov9eZxZy37V26dEqr/c2m5qZ0E+ynSu7sqUD7kGx/zeIcGT0H+KAVgkGNQCo5Uc0koLRW" \
"YHNtYoIvt5R3X6YZylbPftF/8ayWTALBgcqhkjOOAQDBQADLwAwLAIUAKYCp0d6z4QQdyN74JDfQ2WCyi8CFDUM4CaNB+ceVXd" \
"KtOrNTQcc0e+t"

_MD5_CLASSES = "CjY5SdmYqLNshJBVVy653A=="
_KEY = "eQV5aq/Cg63Gsq1sshN9T3gh+UUp0wIw0xgHYT1bnCjEqOJQKCRrWxdAe2yvsDeCJL+Y4G3PRD2HUF7oUgiGo8vGlNJOaux26k+A2F3hj8A="

_VERSION = "2.17.254"
_OS_NAME = "Android"
_OS_VERSION = "6.0.1"
_DEVICE_NAME = "Lenovo K6 NOTE"
_MANUFACTURER = "Lenovo"
_BUILD_VERSION = "JLS36C"
_AXOLOTL = True

def getVersion(self):
    return self.__class__._VERSION

def getOSName(self):
    return self.__class__._OS_NAME

def getOSVersion(self):
    return self.__class__._OS_VERSION

def getDeviceName(self):
    return self.__class__._DEVICE_NAME

def getBuildVersion(self):
    return self.__class__._BUILD_VERSION

def getManufacturer(self):
    return self.__class__._MANUFACTURER

def isAxolotlEnabled(self):
    return self.__class__._AXOLOTL

def getToken(self, phoneNumber):

"env_android.py" 72L, 3059C

Same issue as @ravesingh1983 here

@jamesoon Hi! Could you provide S40 setting for successful log in? Mine is not working *( Always connection closed.

_VERSION = "2.16.12"
_OS_NAME= "S40"
_OS_VERSION = "14.26"
_DEVICE_NAME = "302"
_MANUFACTURER = "Nokia"
_TOKEN_STRING = "PdA2DJyKoUrwLw1Bg6EIhzh502dF9noR9uFCllGk1478194306452{phone}"
_AXOLOTL = True

Same issue.
I'm able to get sms and register the number with android, but i can not send messages.
I spend more than one week to understand where is the issue without result.

`

I have the same problem
I use alway a fresh number for the test i can make a rgestration but i cant send anything

Disconnected: Connection Closed

Facing the same issue as stated above in the thread, able to register using -E android, but unable to send message using -E s40, this is the error that I get, when trying to send a message, the default env is s40 -

(C:\Users\iball\Anaconda3) C:\Users\iball\python_whatsapp_library\yowsup>python
yowsup-cli demos -c config.txt -s 919XXXXXXXXX "hello world" -d
Traceback (most recent call last):
  File "yowsup-cli", line 368, in <module>
    if not parser.process():
  File "yowsup-cli", line 272, in process
    self.startSendClient()
  File "yowsup-cli", line 324, in startSendClient
    stack.start()
  File "C:\Users\iball\python_whatsapp_library\yowsup\yowsup\demos\sendclient\st
ack.py", line 33, in start
    print("Authentication Error: %s" % e.message)
AttributeError: 'AuthError' object has no attribute 'message'

I do this way:
Passed the registration using android env. (Change DEFAULT constant in the file /yowsup/env/env.py to "android').
After success registration changed env back to "s40". And it works for me.

If someone knows better solution, please let us know.

Was this page helpful?
0 / 5 - 0 ratings