Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Random error: error: [Errno 111] Connection refused #2992

Open
JoelSaldanaMontoya opened this issue Jun 15, 2020 · 41 comments
Open

Random error: error: [Errno 111] Connection refused #2992

JoelSaldanaMontoya opened this issue Jun 15, 2020 · 41 comments
Assignees

Comments

@JoelSaldanaMontoya
Copy link

I am presenting this error frequently and randomly.

Yowsup Cli client

Type /help for available commands

I 2020-06-15 08:35:08,539 yowsup.layers.network.layer - Connecting to e2.whatsapp.net:443
E 2020-06-15 08:35:08,675 yowsup.layers.network.dispatcher.dispatcher_asyncore - Traceback (most recent call last):
File "/usr/lib/python2.7/asyncore.py", line 83, in read
obj.handle_read_event()
File "/usr/lib/python2.7/asyncore.py", line 446, in handle_read_event
self.handle_connect_event()
File "/usr/lib/python2.7/asyncore.py", line 454, in handle_connect_event
raise socket.error(err, _strerror(err))
error: [Errno 111] Connection refused

general: Disconnected:
offline:

it is happening randomly with all the whatsapp servers eX.whatsapp.net, registered at: /yowsup/common/constants.py

Please, does the same happen to someone?

@simenca
Copy link

simenca commented Jun 15, 2020

same issue here

@antoniovalenzuela
Copy link

I forced all WSP hosts to one IP 34.194.255.230
All queue messages were sent.

I don't understand why it happens with some servers

@JoelSaldanaMontoya
Copy link
Author

I forced all WSP hosts to one IP 34.194.255.230
All queue messages were sent.

I don't understand why it happens with some servers

I'm going to test your solution, I imagine that due to the volume of messages to a single server they could block us.
You let me know if you notice any changes.

Thank you.

@antoniovalenzuela
Copy link

Few messages (40) are sent from a bash every 10 seconds.

@antoniovalenzuela
Copy link

34.192.181.12
34.193.38.112
34.194.71.217

Traceback (most recent call last):
File "/usr/lib/python3.7/asyncore.py", line 83, in read
obj.handle_read_event()
File "/usr/lib/python3.7/asyncore.py", line 419, in handle_read_event
self.handle_connect_event()
File "/usr/lib/python3.7/asyncore.py", line 427, in handle_connect_event
raise OSError(err, _strerror(err))

@JoelSaldanaMontoya
Copy link
Author

34.192.181.12
34.193.38.112
34.194.71.217

Traceback (most recent call last):
File "/usr/lib/python3.7/asyncore.py", line 83, in read
obj.handle_read_event()
File "/usr/lib/python3.7/asyncore.py", line 419, in handle_read_event
self.handle_connect_event()
File "/usr/lib/python3.7/asyncore.py", line 427, in handle_connect_event
raise OSError(err, _strerror(err))

Antonio, can you share a traceroute from your server to the IP 34.193.38.112 ?

@antoniovalenzuela
Copy link

Connectivity problem
Last hop:
25 52.93.28.166 (52.93.28.166) 240.341 ms * 52.93.28.138 (52.93.28.138) 127.406 ms

Three ISP testing (two local and one international)

Telnet :443 Connection refused
34.192.181.12
34.193.38.112
34.194.71.217

34.194.255.230 OK!

Joel, estás en facebook?

@antoniovalenzuela
Copy link

I will use the addresses updated in June 2019

I tried randomly and I have login

https://developers.facebook.com/docs/whatsapp/guides/network-requirements/?locale=es_ES

@JoelSaldanaMontoya
Copy link
Author

Almost 7 days ago there was an update on the routing information for segment 34.192.0.0/12 on Amazon. There the WhatsApp servers are.
The time coincides with the beginning of the problem. I believe that it may be asymmetric traffic in international providers by spreading this segment of amazon.

@CyberSinister
Copy link

Soo. Sorry, kind of a noob. There's no fix yet, right?

@antoniovalenzuela
Copy link

Soo. Sorry, kind of a noob. There's no fix yet, right?

Select and test other IP addresses. In my case I made a custom list

https://developers.facebook.com/docs/whatsapp/guides/network-requirements/?locale=es_ES

@mostepunk
Copy link

Select and test other IP addresses. In my case I made a custom list

Please help us. What should I do with this list of addresses?
I'm noob too :)

@antoniovalenzuela
Copy link

I share the selected IPs. Sending works pretty fast.

Table hosts linux
157.240.28.55 e1.whatsapp.net e15.whatsapp.net
34.194.255.230 e2.whatsapp.net e16.whatsapp.net
31.13.66.51 e3.whatsapp.net
31.13.71.50 e4.whatsapp.net
31.13.72.48 e5.whatsapp.net
31.13.79.54 e6.whatsapp.net
31.13.85.49 e7.whatsapp.net
31.13.65.50 e8.whatsapp.net
31.13.87.48 e9.whatsapp.net
108.168.254.65 e10.whatsapp.net
31.13.66.51 e11.whatsapp.net
31.13.70.50 e12.whatsapp.net
31.13.83.51 e13.whatsapp.net
31.13.92.48 e14.whatsapp.net

Or modify the hosts on file /yowsup/common/constants.py

@myckhel
Copy link

myckhel commented Jun 16, 2020

Getting this error on e12
[offline]:I 2020-06-16 17:32:30,895 yowsup.layers.network.layer - Connecting to e12.whatsapp.net:443
I 2020-06-16 17:32:31,607 yowsup.axolotl.manager - Loaded 812 unsent prekeys
E 2020-06-16 17:32:31,656 yowsup.layers.network.dispatcher.dispatcher_asyncore - Traceback (most recent call last):
File "/usr/local/Cellar/python/3.7.7/Frameworks/Python.framework/Versions/3.7/lib/python3.7/asyncore.py", line 91, in write
obj.handle_write_event()
File "/usr/local/Cellar/python/3.7.7/Frameworks/Python.framework/Versions/3.7/lib/python3.7/asyncore.py", line 440, in handle_write_event
self.handle_connect_event()
File "/usr/local/Cellar/python/3.7.7/Frameworks/Python.framework/Versions/3.7/lib/python3.7/asyncore.py", line 428, in handle_connect_event
self.handle_connect()
File "/usr/local/lib/python3.7/site-packages/yowsup-3.2.3-py3.7.egg/yowsup/layers/network/dispatcher/dispatcher_asyncore.py", line 34, in handle_connect
self.connectionCallbacks.onConnected()
File "/usr/local/lib/python3.7/site-packages/yowsup-3.2.3-py3.7.egg/yowsup/layers/network/layer.py", line 54, in onConnected
self.emitEvent(YowLayerEvent(YowNetworkLayer.EVENT_STATE_CONNECTED))
File "/usr/local/lib/python3.7/site-packages/yowsup-3.2.3-py3.7.egg/yowsup/layers/init.py", line 94, in emitEvent
self.__upper.emitEvent(yowLayerEvent)
File "/usr/local/lib/python3.7/site-packages/yowsup-3.2.3-py3.7.egg/yowsup/layers/init.py", line 94, in emitEvent
self.__upper.emitEvent(yowLayerEvent)
File "/usr/local/lib/python3.7/site-packages/yowsup-3.2.3-py3.7.egg/yowsup/layers/init.py", line 94, in emitEvent
self.__upper.emitEvent(yowLayerEvent)
[Previous line repeated 3 more times]
File "/usr/local/lib/python3.7/site-packages/yowsup-3.2.3-py3.7.egg/yowsup/layers/init.py", line 88, in emitEvent
if self.__upper and not self.__upper.onEvent(yowLayerEvent):
File "/usr/local/lib/python3.7/site-packages/yowsup-3.2.3-py3.7.egg/yowsup/layers/init.py", line 212, in onEvent
stopEvent = stopEvent or s.onEvent(yowLayerEvent)
File "/usr/local/lib/python3.7/site-packages/yowsup-3.2.3-py3.7.egg/yowsup/layers/init.py", line 109, in onEvent
return self.event_callbackseventName
File "/usr/local/lib/python3.7/site-packages/yowsup-3.2.3-py3.7.egg/yowsup/layers/auth/layer_authentication.py", line 36, in on_connected
passive=self.getProp(self.PROP_PASSIVE, False)
File "/usr/local/lib/python3.7/site-packages/yowsup-3.2.3-py3.7.egg/yowsup/layers/init.py", line 202, in subBroadcastEvent
self.broadcastEvent(yowLayerEvent)
File "/usr/local/lib/python3.7/site-packages/yowsup-3.2.3-py3.7.egg/yowsup/layers/init.py", line 103, in broadcastEvent
self.__lower.broadcastEvent(yowLayerEvent)
File "/usr/local/lib/python3.7/site-packages/yowsup-3.2.3-py3.7.egg/yowsup/layers/init.py", line 103, in broadcastEvent
self.__lower.broadcastEvent(yowLayerEvent)
File "/usr/local/lib/python3.7/site-packages/yowsup-3.2.3-py3.7.egg/yowsup/layers/init.py", line 103, in broadcastEvent
self.__lower.broadcastEvent(yowLayerEvent)
[Previous line repeated 1 more time]
File "/usr/local/lib/python3.7/site-packages/yowsup-3.2.3-py3.7.egg/yowsup/layers/init.py", line 98, in broadcastEvent
if self.__lower and not self.__lower.onEvent(yowLayerEvent):
File "/usr/local/lib/python3.7/site-packages/yowsup-3.2.3-py3.7.egg/yowsup/layers/init.py", line 109, in onEvent
return self.event_callbackseventName
File "/usr/local/lib/python3.7/site-packages/yowsup-3.2.3-py3.7.egg/yowsup/layers/noise/layer.py", line 109, in on_auth
locale_country="US"
File "/usr/local/lib/python3.7/site-packages/consonance-0.1.3.post1-py3.7.egg/consonance/config/useragent.py", line 58, in init
app_version = AppVersionConfig(app_version)
File "/usr/local/lib/python3.7/site-packages/consonance-0.1.3.post1-py3.7.egg/consonance/config/appversion.py", line 15, in init
self._primary, self._secondary, self._tertiary = map(lambda v:int(v), dissected)
ValueError: too many values to unpack (expected 3)

general: Disconnected:
[offline]:

Getting connection refused on other domains

@antoniovalenzuela
Copy link

@myckhel you used fixed hosts?

@myckhel
Copy link

myckhel commented Jun 16, 2020

@myckhel you used fixed hosts?

yes

i commented all hosts except e12 from /yowsup/common/constants.py
since i discovered only that host did work for me.

@antoniovalenzuela
Copy link

antoniovalenzuela commented Jun 16, 2020

@antoniovalenzuela Can it depend on our server location whether it can work ? Have you ever look at which servers are used for our phones, maybe we can sniff https requests.

It is possible, they should have segmented accesses

Flow from Xiaomi Cel
image

e13 = 157.240.204.61
image

@antoniovalenzuela
Copy link

Which program is it ? Can you track your phone HTTPS activity ?

Ntopng
Hotspot network ----tun0-----> raspberry with ntopng -----eth0-----> Internet

Or wireshark sharing adhoc WiFi network

@Johnprogg
Copy link

Anyone can Provide Detailed Solution for this ?

@mostepunk
Copy link

Or modify the hosts on file /yowsup/common/constants.py

Should I install again, after changing this file

@mostepunk
Copy link

Anyone can Provide Detailed Solution for this ?

  • You should copy this text

  • to the end of your /etc/hosts

  • if Whatsapp will decide to change its IP adresses, you'll go to that link and copy other 16 ip adresses and test them

enjoy

somebody change in yowsup file /yowsup/common/constants.py but I don't know how to change it correct

@myckhel
Copy link

myckhel commented Jun 17, 2020

Or modify the hosts on file /yowsup/common/constants.py

Should I install again, after changing this file

You have to run the install again after changing the file.

@Johnprogg
Copy link

Anyone can Provide Detailed Solution for this ?

  • You should copy this text
  • to the end of your /etc/hosts
  • if Whatsapp will decide to change its IP adresses, you'll go to that link and copy other 16 ip adresses and test them

enjoy

somebody change in yowsup file /yowsup/common/constants.py but I don't know how to change it correct

Thank You Sir

@Johnprogg
Copy link

Anyone can Provide Detailed Solution for this ?

  • You should copy this text
  • to the end of your /etc/hosts
  • if Whatsapp will decide to change its IP adresses, you'll go to that link and copy other 16 ip adresses and test them

enjoy

somebody change in yowsup file /yowsup/common/constants.py but I don't know how to change it correct

Sir is this the right way to add IP's in Constants.py ?
("e1.whatsapp.net e15.whatsapp.net", 157.240.28.55),
("e2.whatsapp.net e16.whatsapp.net" ,34.194.255.230),
("e3.whatsapp.net", 31.13.66.51),
("e4.whatsapp.net", 31.13.71.50),
("e5.whatsapp.net", 31.13.72.48),
("e6.whatsapp.net", 31.13.79.54),
("e7.whatsapp.net", 31.13.85.49),
("e8.whatsapp.net", 31.13.65.50),
("e9.whatsapp.net", 31.13.87.48),
("65 e10.whatsapp.net", 108.168.254),
("e11.whatsapp.net", 31.13.66.51),
("e12.whatsapp.net", 31.13.70.50),
("e13.whatsapp.net", 31.13.83.51),
("e14.whatsapp.net", 31.13.92.48),
and whats the end of /etc/hosts that you are referring to @fanishe ?

@Johnprogg
Copy link

Getting this error does i am pasting IP's in the Wrong Way ?

I 2020-06-18 05:15:35,310 yowsup.layers.network.layer - Connecting to 65 e10.whatsapp.net:108.168.254
Exception in thread Thread-2:
Traceback (most recent call last):
File "/usr/lib/python2.7/threading.py", line 801, in __bootstrap_inner
self.run()
File "/usr/lib/python2.7/threading.py", line 754, in run
self.__target(*self.__args, **self.__kwargs)
File "/usr/local/lib/python2.7/dist-packages/yowsup-3.2.3-py2.7.egg/yowsup/demos/cli/layer.py", line 430, in
threading.Thread(target=lambda: self.getLayerInterface(YowNetworkLayer).connect()).start()
File "/usr/local/lib/python2.7/dist-packages/yowsup-3.2.3-py2.7.egg/yowsup/layers/network/layer_interface.py", line 4, in connect
self._layer.createConnection()
File "/usr/local/lib/python2.7/dist-packages/yowsup-3.2.3-py2.7.egg/yowsup/layers/network/layer.py", line 92, in createConnection
self._dispatcher.connect(endpoint)
File "/usr/local/lib/python2.7/dist-packages/yowsup-3.2.3-py2.7.egg/yowsup/layers/network/dispatcher/dispatcher_asyncore.py", line 27, in connect
asyncore.dispatcher_with_send.connect(self, host)
File "/usr/lib/python2.7/asyncore.py", line 347, in connect
err = self.socket.connect_ex(address)
File "/usr/lib/python2.7/socket.py", line 228, in meth
return getattr(self._sock,name)(*args)
TypeError: an integer is required

Please help @fanishe and @antoniovalenzuela

@mostepunk
Copy link

mostepunk commented Jun 18, 2020

@Johnprogg look at my /etc/hosts in linux
If you using windows this file lies at c:\windows\system32\drivers\etc\hosts

hosts

I just copy/paste this text

157.240.28.55 e1.whatsapp.net e15.whatsapp.net
34.194.255.230 e2.whatsapp.net e16.whatsapp.net
31.13.66.51 e3.whatsapp.net
31.13.71.50 e4.whatsapp.net
31.13.72.48 e5.whatsapp.net
31.13.79.54 e6.whatsapp.net
31.13.85.49 e7.whatsapp.net
31.13.65.50 e8.whatsapp.net
31.13.87.48 e9.whatsapp.net
108.168.254.65 e10.whatsapp.net
31.13.66.51 e11.whatsapp.net
31.13.70.50 e12.whatsapp.net
31.13.83.51 e13.whatsapp.net
31.13.92.48 e14.whatsapp.net

I didn't change my /yowsup/common/constants.py because I don't know how to make it correct. I think, that before you change this file, you made backup.

@Johnprogg
Copy link

Hey @fanishe I am Running it in Ubuntu, Btwn does any one knows how to change IP’s in Constants.py correctly?

@antoniovalenzuela
Copy link

Connecting to 65 e10.whatsapp.net:108.168.254

Port: 108.168.254 (is 443)

you modified the file constants.py? (I don't recommend changing that file, there are the hosts with port 443)

If you have problems I can help you with a remote connection.

@CyberSinister
Copy link

Have you ever tried with a new version of WhatsApp? For example, version 2.20.193.7 . I tried and it never connected, it may explain why we can not connect e type servers. Whatsapp could change something about connection.

Oh shit. I think that's why I wasn't connecting. I'm using the latest version of WhatsApp. Download it from the official site and updated the version and hash.

@myckhel
Copy link

myckhel commented Jun 18, 2020

Hey @fanishe I am Running it in Ubuntu, Btwn does any one knows how to change IP’s in Constants.py correctly?

for me i solved the connection refused issue by following @fanishe instruction

i ran sudo nano /etc/hosts and pasted
57.240.28.55 e1.whatsapp.net e15.whatsapp.net 34.194.255.230 e2.whatsapp.net e16.whatsapp.net 31.13.66.51 e3.whatsapp.net 31.13.71.50 e4.whatsapp.net 31.13.72.48 e5.whatsapp.net 31.13.79.54 e6.whatsapp.net 31.13.85.49 e7.whatsapp.net 31.13.65.50 e8.whatsapp.net 31.13.87.48 e9.whatsapp.net 108.168.254.65 e10.whatsapp.net 31.13.66.51 e11.whatsapp.net 31.13.70.50 e12.whatsapp.net 31.13.83.51 e13.whatsapp.net 31.13.92.48 e14.whatsapp.ne
at the bottom
saved and quit

and the connections worked fine.

@fevzican
Copy link

Have you ever tried with a new version of WhatsApp? For example, version 2.20.193.7 . I tried and it never connected, it may explain why we can not connect e type servers. Whatsapp could change something about connection.

There is fourth digit in version so cosonance library can not handle it, It was set 3 version code part. I fixed it with adding fourth part of Version Code on consonance.

@myckhel
Copy link

myckhel commented Jun 19, 2020

I think the number im using for the demo has been blocked
was getting 403 error when tried to login
and when i tried to request code
i got:
{"status":"fail","reason":"blocked","login":"xxxxxxxxx"}

Who else got same problem.

@antoniovalenzuela
Copy link

I think the number im using for the demo has been blocked
was getting 403 error when tried to login
and when i tried to request code
i got:
{"status":"fail","reason":"blocked","login":"xxxxxxxxx"}

Who else got same problem.

Try to activate WhatsApp from a phone and send the debug when the block information appears. The debug is received by [email protected] (they respond and enable it)

Justify the reasons (changing cell phones for example)

@LuKks
Copy link

LuKks commented Jun 23, 2020

/yowsup/common/constants.py

class YowConstants:
    DOMAIN       = "s.whatsapp.net"
    ENDPOINTS     = (
        ("157.240.28.55", 443),
        #("34.194.255.230", 443),
        ("31.13.66.51", 443),
        ("31.13.71.50", 443),
        ("31.13.72.48", 443),
        ("31.13.79.54", 443),
        ("31.13.85.49", 443),
        ("31.13.65.50", 443),
        ("31.13.87.48", 443),
        ("108.168.254.65", 443),
        ("31.13.66.51", 443),
        ("31.13.70.50", 443),
        ("31.13.83.51", 443),
        ("31.13.92.48", 443),
        ("157.240.28.55", 443),
        #("34.194.255.230", 443),
        )

    WHATSAPP_SERVER = "s.whatsapp.net"
    WHATSAPP_GROUP_SERVER = "g.us"

    YOWSUP = "yowsup"

    PREVIEW_WIDTH = 64
    PREVIEW_HEIGHT = 64

image

I also have updated the env android to the latest version and the _MD5_CLASSES.

@pyweb-wa
Copy link

what about registration? I still have temporarily unavailable

@com2it
Copy link

com2it commented Jun 28, 2020

ValueError: too many values to unpack (expected 3)
Have exactly the same error as myckhel . Applied everything as LuKks described in his post. (So MD5 was already updated, this was neccassary to request the sms code, but when logging in I always get the "ValueError" ?? Does anyone knows how to solve this ?

@darobles
Copy link

Have you ever tried with a new version of WhatsApp? For example, version 2.20.193.7 . I tried and it never connected, it may explain why we can not connect e type servers. Whatsapp could change something about connection.

There is fourth digit in version so cosonance library can not handle it, It was set 3 version code part. I fixed it with adding fourth part of Version Code on consonance.

I'm facing the same problem, what file did you modified?

@Johnprogg
Copy link

@fevzican Hey, Which file have your modified to add 4 Digit Version Code?

@fevzican
Copy link

Okay guys, I will post an Pull Request for new versions.

@LuKks
Copy link

LuKks commented Jul 18, 2020

I did it 3 weeks ago: LuKks/consonance@5fa7381

@LuKks
Copy link

LuKks commented Jul 18, 2020

Obviously you have to use that repo, replacing like this:

setup.py

deps = ['consonance', 'argparse', 'python-axolotl==0.2.2', 'six==1.10', 'appdirs', 'protobuf>=3.6.0']

setup(
    ...,
    dependency_links=[
        'git+https://github.com/LuKks/consonance.git#egg=consonance-0.1.4'
    ],
    ...,
)

tox.ini

consonance==0.1.4

Also in the README but it's not strictly need it.

If you really need it I can make a pull request.

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

No branches or pull requests