无法使用yowsup-cli进行Whatsapp注册

时间:2017-08-30 09:09:29

标签: python-2.7 whatsapp yowsup

我正在尝试编写一个示例python脚本,该脚本将消息发送到列出的whatsapp号码。经过一些研究,我发现这个python库“yowsup”。

我正在尝试使用下面写的cli命令进行注册:

yowsup-cli registration --requestcode sms --phone 9195******** --cc 91 --mcc 404 --mnc 86 -d

尝试此命令时出现错误的令牌错误。

搜索类似问题,以下是我执行的一些更改。

    _USERAGENT_STRING = "WhatsApp/2.17.296 Android/4.4.2 Device/SAMSUNG-GT-N7100"
 and 
DEFAULT = "Android"

in

/usr/lib/python2.7/site-packages/yowsup/env/env.py file.

以下是使用调试选项的更详细的o / p /。

[root@localhost whatsapp]# yowsup-cli registration --requestcode sms --phone 91953********* --cc 91 --mcc 404 --mnc 86 -d
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.env.env:Env not set, setting it to android
DEBUG:yowsup.env.env:Current env changed to android 
DEBUG:yowsup.common.http.warequest:{'Accept': 'text/json', 'User-Agent': 'WhatsApp/2.17.296 Android/4.4.2 Device/SAMSUNG-GT-N7100'}
DEBUG:yowsup.common.http.warequest:cc=91&in=9538944697&lc=GB&lg=en&sim_mcc=404&sim_mnc=086&mcc=404&mnc=086&method=sms&mistyped=6&network_radio_type=1&simnum=1&s=&copiedrc=1&hasinrc=1&rcmatch=1&pid=8476&rchash=8ba74b3230363264c788908e6010cb2a7c70a70f3ef7a1e4fea9085424024bab&anhash=%B0%04%C5V%F6%CA%D5%0C%C4%B5%28%90%7C%BBR%D8%F8F%D7%95&extexist=1&extstate=1&token=WhPO3Nlv52KJcgwnOfqBBFVAvw0%3D&id=%C4%0E%8B%22f%7FkX%FFIL%DD%9C%91%EE%89EXco
DEBUG:yowsup.common.http.warequest:Opening connection to v.whatsapp.net
DEBUG:yowsup.common.http.warequest:Sending GET request to /v2/code?cc=91&in=9538******&lc=GB&lg=en&sim_mcc=404&sim_mnc=086&mcc=404&mnc=086&method=sms&mistyped=6&network_radio_type=1&simnum=1&s=&copiedrc=1&hasinrc=1&rcmatch=1&pid=8476&rchash=8ba74b3230363264c788908e6010cb2a7c70a70f3ef7a1e4fea9085424024bab&anhash=%B0%04%C5V%F6%CA%D5%0C%C4%B5%28%90%7C%BBR%D8%F8F%D7%95&extexist=1&extstate=1&token=WhPO3Nlv52KJcgwnOfqBBFVAvw0%3D&id=%C4%0E%8B%22f%7FkX%FFIL%DD%9C%91%EE%89EXco
INFO:yowsup.common.http.warequest:{"login":"919538*******","status":"fail","reason":"bad_token"}

status: fail
reason: bad_token
login: 919538*******

有人可以建议前进的方向吗?

2 个答案:

答案 0 :(得分:0)

使用yowsup-cli注册--requestcode短信 - 电话9195 ******** --cc 91 --mcc 404 --mnc 86 -d -env android

env_android文件中的

将版本更改为最新版本(whatsapp)

我刚刚使用它!!

enter image description here

答案 1 :(得分:0)

在env_android.py文件中,使用以下代码更改类的开头:

_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 = "XBpFzrmxmNufLCYF3Qmm1A=="
_KEY = "eQV5aq/Cg63Gsq1sshN9T3gh+UUp0wIw0xgHYT1bnCjEqOJQKCRrWxdAe2yvsDeCJL+Y4G3PRD2HUF7oUgiGo8vGlNJOaux26k+A2F3hj8A="
_VERSION = "2.17.422"
_OS_NAME = "Android"
_OS_VERSION = "4.3"
_DEVICE_NAME = "endeavoru"
_MANUFACTURER = "HTC"
_BUILD_VERSION = "IMM76D"
_AXOLOTL = True

然后使用命令:

yowsup-cli registration --requestcode sms --phone 9195******** --cc 91 --mcc 404 --mnc 86 -d -env android