Unable to do Whatsapp Registration using yowsup-cli

3.8k views Asked by At

I am trying to write a sample python script that sends message to the listed whatsapp number. Upon little research, i found this python library "yowsup".

I am trying to register using the cli command written below:

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

I am getting a bad token error while trying this command.

Searching for similar problems, here are some of the changes that i performed.

    _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.

Here is the more detailed o/p/ using the debug option.

[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*******

Can someone suggest on the way forward?

2

There are 2 answers

0
PedroNeves On

On the env_android.py file, change the start of the class with this code:

_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

then use the command:

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

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

in the env_android file change the version to the most current one (whatsapp)

i just used it!!

enter image description here