tgalal / yowsup

The WhatsApp lib
GNU General Public License v3.0
7.08k stars 2.23k forks source link

socket.error: [Errno 110] Connection timed out #2656

Open mocart2 opened 5 years ago

mocart2 commented 5 years ago

when i try to send message: yowsup-cli demos -l 7934324324324:CVNVT4324edt4555t/Rxu00Qzc= -s "79123213331" "hello"

yowsup-cli  v2.0.15
yowsup      v2.5.7

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

Traceback (most recent call last):
  File "/usr/local/bin/yowsup-cli", line 368, in <module>
    if not parser.process():
  File "/usr/local/bin/yowsup-cli", line 272, in process
    self.startSendClient()
  File "/usr/local/bin/yowsup-cli", line 324, in startSendClient
    stack.start()
  File "/usr/local/lib/python2.7/dist-packages/yowsup/demos/sendclient/stack.py", line 31, in start
    self.stack.loop()
  File "/usr/local/lib/python2.7/dist-packages/yowsup/stacks/yowstack.py", line 197, in loop
    asyncore.loop(*args, **kwargs)
  File "/usr/lib/python2.7/asyncore.py", line 216, in loop
    poll_fun(timeout, map)
  File "/usr/lib/python2.7/asyncore.py", line 156, in poll
    read(obj)
  File "/usr/lib/python2.7/asyncore.py", line 87, in read
    obj.handle_error()
  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))
socket.error: [Errno 110] Connection timed out

ADD: in interactive mode:

Yowsup Cli client
==================
Type /help for available commands

[offline]:/L
general: Disconnected: Connection Closed
[offline]:

ADD2:

cat /usr/local/lib/python2.7/dist-packages/yowsup/env/env_android.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 = "0bDL1MuGJFkgHN8xbTWLRA=="
    _KEY = "eQV5aq/Cg63Gsq1sshN9T3gh+UUp0wIw0xgHYT1bnCjEqOJQKCRrWxdAe2yvsDeCJL+Y4G3PRD2HUF7oUgiGo8vGlNJOaux26k+A2F3hj8A="

    _VERSION = "2.18.384"
    _OS_NAME = "Android"
    _OS_VERSION = "4.3"
    _DEVICE_NAME = "endeavoru"
    _MANUFACTURER = "HTC"
    _BUILD_VERSION = "IMM76D"
    _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):
        keyDecoded = bytearray(base64.b64decode(self.__class__._KEY))
        sigDecoded = base64.b64decode(self.__class__._SIGNATURE)
        clsDecoded = base64.b64decode(self.__class__._MD5_CLASSES)
        data = sigDecoded + clsDecoded + phoneNumber.encode()

        opad = bytearray()
        ipad = bytearray()
        for i in range(0, 64):
            opad.append(0x5C ^ keyDecoded[i])
            ipad.append(0x36 ^ keyDecoded[i])
        hash = hashlib.sha1()
        subHash = hashlib.sha1()
        try:
            subHash.update(ipad + data)
            hash.update(opad + subHash.digest())
        except TypeError:
            subHash.update(bytes(ipad + data))
            hash.update(bytes(opad + subHash.digest()))
        result = base64.b64encode(hash.digest())
        return result
lisabrauns commented 5 years ago

see the issues 2655

tgalal commented 5 years ago

@mocart2 issue still exists?